[jboss-cvs] JBossAS SVN: r68544 - in projects/microcontainer/trunk: container and 10 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Dec 24 13:04:57 EST 2007


Author: alesj
Date: 2007-12-24 13:04:57 -0500 (Mon, 24 Dec 2007)
New Revision: 68544

Added:
   projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/
   projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/Constructor.java
   projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/JavaBean.java
   projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/JavaBeanBuilder.java
   projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/JavaBeanFactory.java
   projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/Parameter.java
   projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/Property.java
   projects/microcontainer/trunk/container/src/resources/tests/org/jboss/test/javabean/test/ParameterInstantiate.xml
   projects/microcontainer/trunk/container/src/resources/tests/org/jboss/test/javabean/test/Property.xml
   projects/microcontainer/trunk/container/src/resources/tests/org/jboss/test/javabean/test/PropertyWildcard.xml
   projects/microcontainer/trunk/container/src/resources/tests/org/jboss/test/javabean/test/SimpleInstantiate.xml
   projects/microcontainer/trunk/container/src/resources/tests/org/jboss/test/javabean/test/StaticClassMethodInstantiate.xml
   projects/microcontainer/trunk/container/src/resources/tests/org/jboss/test/javabean/test/StaticMethodInstantiate.xml
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestParameterInstantiate.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestProperty.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestPropertyWildcard.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestSimpleInstantiate.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestStaticClassMethodInstantiate.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestStaticClassMethodInstantiator.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestStaticMethodInstantiate.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestWildcard.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/AbstractJavaBeanTest.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/OldAbstractJavaBeanTest.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/ParameterInstantiateUnitTestCase.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/PropertyUnitTestCase.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/PropertyWildcardUnitTestCase.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/SimpleInstantiateUnitTestCase.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/StaticClassMethodInstantiateUnitTestCase.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/StaticMethodInstantiateUnitTestCase.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/xb/
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/xb/builder/
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/xb/builder/AbstractBuilderTest.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/xb/builder/DebugElementHandler.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/xb/builder/JBossXBTestDelegate.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/xb/builder/SchemaPrinter.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/xb/builder/TestSchemaResolver.java
Removed:
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/AbstractJavaBeanTest.java
Modified:
   projects/microcontainer/trunk/build/pom-jdk14.xml
   projects/microcontainer/trunk/build/pom.xml
   projects/microcontainer/trunk/container/pom-jdk14.xml
   projects/microcontainer/trunk/container/pom.xml
   projects/microcontainer/trunk/container/src/main/org/jboss/config/plugins/AbstractConfiguration.java
   projects/microcontainer/trunk/container/src/main/org/jboss/config/spi/Configuration.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/AmbiguityTestCase.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/InstantiateTestCase.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/JavaBeanTestSuite.java
   projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/PropertyTestCase.java
Log:
JBMICROCONT-219 - JavaBeans port to jaxb.

Modified: projects/microcontainer/trunk/build/pom-jdk14.xml
===================================================================
--- projects/microcontainer/trunk/build/pom-jdk14.xml	2007-12-24 07:35:47 UTC (rev 68543)
+++ projects/microcontainer/trunk/build/pom-jdk14.xml	2007-12-24 18:04:57 UTC (rev 68544)
@@ -35,6 +35,7 @@
   <properties>
     <version.jboss.common.core>2.2.1-SNAPSHOT</version.jboss.common.core>
     <version.jbossxb>2.0.0.CR3</version.jbossxb>
+    <version.jbossxb.builder>1.0.0.Beta1</version.jbossxb.builder>
     <version.osgi.r4.core>1.0</version.osgi.r4.core>
     <version.jboss.vfs>2.0.4.snapshot</version.jboss.vfs>
     <version.javassist>3.6-beta</version.javassist>
@@ -336,6 +337,11 @@
         </exclusions>
       </dependency>
       <dependency>
+        <groupId>org.jboss</groupId>
+        <artifactId>jbossxb-builder</artifactId>
+        <version>${version.jbossxb.builder}</version>
+      </dependency>
+      <dependency>
         <groupId>org.osgi</groupId>
         <artifactId>osgi_R4_core</artifactId>
         <version>${version.osgi.r4.core}</version>

Modified: projects/microcontainer/trunk/build/pom.xml
===================================================================
--- projects/microcontainer/trunk/build/pom.xml	2007-12-24 07:35:47 UTC (rev 68543)
+++ projects/microcontainer/trunk/build/pom.xml	2007-12-24 18:04:57 UTC (rev 68544)
@@ -34,6 +34,7 @@
   <properties>
     <version.jboss.common.core>2.2.3.GA</version.jboss.common.core>
     <version.jbossxb>2.0.0.CR4</version.jbossxb>
+    <version.jbossxb.builder>1.0.0-SNAPSHOT</version.jbossxb.builder>
     <version.osgi.r4.core>1.0</version.osgi.r4.core>
     <version.jboss.vfs>2.0.0.Beta6</version.jboss.vfs>
     <version.javassist>3.6.0.GA</version.javassist>
@@ -351,6 +352,11 @@
         <version>${version.jbossxb}</version>
       </dependency>
       <dependency>
+        <groupId>org.jboss</groupId>
+        <artifactId>jbossxb-builder</artifactId>
+        <version>${version.jbossxb.builder}</version>
+      </dependency>
+      <dependency>
         <groupId>apache-xerces</groupId>
         <artifactId>xml-apis</artifactId>
         <version>${version.apache-xerces.xml-apis}</version>

Modified: projects/microcontainer/trunk/container/pom-jdk14.xml
===================================================================
--- projects/microcontainer/trunk/container/pom-jdk14.xml	2007-12-24 07:35:47 UTC (rev 68543)
+++ projects/microcontainer/trunk/container/pom-jdk14.xml	2007-12-24 18:04:57 UTC (rev 68544)
@@ -181,6 +181,10 @@
     </dependency>
     <dependency>
       <groupId>org.jboss</groupId>
+      <artifactId>jbossxb-builder</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss</groupId>
       <artifactId>jboss-common-core-jdk14</artifactId>
     </dependency>
     <dependency>

Modified: projects/microcontainer/trunk/container/pom.xml
===================================================================
--- projects/microcontainer/trunk/container/pom.xml	2007-12-24 07:35:47 UTC (rev 68543)
+++ projects/microcontainer/trunk/container/pom.xml	2007-12-24 18:04:57 UTC (rev 68544)
@@ -81,6 +81,10 @@
       </exclusions>
     </dependency>
     <dependency>
+      <groupId>org.jboss</groupId>
+      <artifactId>jbossxb-builder</artifactId>
+    </dependency>
+    <dependency>
       <groupId>apache-xerces</groupId>
       <artifactId>xml-apis</artifactId>
     </dependency>

Modified: projects/microcontainer/trunk/container/src/main/org/jboss/config/plugins/AbstractConfiguration.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/config/plugins/AbstractConfiguration.java	2007-12-24 07:35:47 UTC (rev 68543)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/config/plugins/AbstractConfiguration.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -100,6 +100,11 @@
       return getTypeInfoFactory().getTypeInfo(type);
    }
 
+   public TypeInfo getTypeInfo(String type, ClassLoader cl) throws ClassNotFoundException
+   {
+      return getTypeInfoFactory().getTypeInfo(type, cl);
+   }
+
    public TypeInfoFactory getTypeInfoFactory()
    {
       if (typeInfoFactory == null)

Modified: projects/microcontainer/trunk/container/src/main/org/jboss/config/spi/Configuration.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/config/spi/Configuration.java	2007-12-24 07:35:47 UTC (rev 68543)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/config/spi/Configuration.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -94,6 +94,17 @@
    TypeInfo getTypeInfo(Type type);
 
    /**
+    * Get the type info for a type
+    *
+    * @param type the type
+    * @return the type info
+    * @param cl the classloader
+    * @throws IllegalArgumentException for a null type
+    * @throws ClassNotFoundException when the class could not be loaded
+    */
+   TypeInfo getTypeInfo(String type, ClassLoader cl) throws ClassNotFoundException;
+
+   /**
     * Get the type info factory
     * 
     * @return the TypeInfoFactory

Added: projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/Constructor.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/Constructor.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/Constructor.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,76 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.javabean.plugins.jaxb;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * Constructor.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+ at XmlRootElement(name="constructor")
+public class Constructor
+{
+   private String factoryClass;
+
+   private String factoryMethod;
+
+   private Parameter[] parameters;
+
+   public String getFactoryClass()
+   {
+      return factoryClass;
+   }
+
+   @XmlAttribute(name="factoryClass")
+   public void setFactoryClass(String factoryClass)
+   {
+      this.factoryClass = factoryClass;
+   }
+
+   public String getFactoryMethod()
+   {
+      return factoryMethod;
+   }
+
+   @XmlAttribute(name="factoryMethod")
+   public void setFactoryMethod(String factoryMethod)
+   {
+      this.factoryMethod = factoryMethod;
+   }
+
+   public Parameter[] getParameters()
+   {
+      return parameters;
+   }
+
+   @XmlElement(name="parameter")
+   public void setParameters(Parameter[] parameters)
+   {
+      this.parameters = parameters;
+   }
+}

Added: projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/JavaBean.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/JavaBean.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/JavaBean.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,253 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.javabean.plugins.jaxb;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.beans.info.spi.PropertyInfo;
+import org.jboss.config.plugins.property.PropertyConfiguration;
+import org.jboss.config.spi.Configuration;
+import org.jboss.joinpoint.plugins.Config;
+import org.jboss.reflect.spi.ConstructorInfo;
+import org.jboss.reflect.spi.MethodInfo;
+import org.jboss.reflect.spi.TypeInfo;
+import org.jboss.xb.annotations.JBossXmlSchema;
+import org.jboss.xb.annotations.JBossXmlType;
+import org.jboss.xb.spi.BeanAdapter;
+import org.jboss.xb.spi.BeanAdapterFactory;
+import org.jboss.util.propertyeditor.PropertyEditors;
+
+/**
+ * JavaBean.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+ at JBossXmlSchema(namespace="test:javabean", elementFormDefault=XmlNsForm.QUALIFIED)
+ at XmlRootElement(name="javabean")
+ at XmlType(name="javabean")
+ at JBossXmlType(beanAdapterBuilder=JavaBeanBuilder.class)
+public class JavaBean extends BeanAdapter
+{
+   private static Configuration configuration;
+
+   static
+   {
+      init();
+   }
+
+   static synchronized void init()
+   {
+      if(configuration == null)
+      {
+         configuration = AccessController.doPrivileged(new PrivilegedAction<Configuration>()
+         {
+            public Configuration run()
+            {
+               return new PropertyConfiguration(System.getProperties());
+            }
+         });
+         PropertyEditors.init();
+      }
+   }
+
+   private String className;
+
+   private Constructor constructor;
+
+   private Property[] properties;
+
+   public JavaBean(BeanAdapterFactory beanAdapterFactory)
+   {
+      super(beanAdapterFactory);
+   }
+
+   public String getClassName()
+   {
+      return className;
+   }
+
+   @XmlAttribute(name="class")
+   public void setClassName(String className)
+   {
+      this.className = className;
+   }
+
+   public Constructor getConstructor()
+   {
+      return constructor;
+   }
+
+   public void setConstructor(Constructor constructor)
+   {
+      this.constructor = constructor;
+   }
+
+   public Property[] getProperties()
+   {
+      return properties;
+   }
+
+   @XmlElement(name="property")
+   public void setProperties(Property[] properties)
+   {
+      this.properties = properties;
+   }
+
+   @XmlTransient
+   public Object getValue()
+   {
+      ClassLoader cl = Thread.currentThread().getContextClassLoader();
+      try
+      {
+         Object result;
+
+         BeanInfo beanInfo = null;
+         if (className != null)
+            beanInfo = configuration.getBeanInfo(className, cl);
+
+         if (constructor != null)
+         {
+            String factoryMethod = constructor.getFactoryMethod();
+            if (factoryMethod != null)
+            {
+               String factoryClass = constructor.getFactoryClass();
+               BeanInfo factoryBeanInfo = beanInfo;
+               if (factoryClass != null)
+                  factoryBeanInfo = configuration.getBeanInfo(factoryClass, cl);
+
+               if (factoryBeanInfo == null)
+                  throw new IllegalArgumentException("Missing className or factoryClass: " + this);
+
+               String[] signature = getSignature(constructor.getParameters());
+               MethodInfo factory = Config.findMethodInfo(factoryBeanInfo.getClassInfo(), factoryMethod, signature, true, true);
+               Object[] params = getParams(constructor.getParameters(), factory.getParameterTypes());
+               result = factory.invoke(null, params);
+            }
+            else
+            {
+               if (beanInfo == null)
+                  throw new IllegalArgumentException("Missing className: " + this);
+
+               String[] signature = getSignature(constructor.getParameters());
+               ConstructorInfo constructorInfo = Config.findConstructorInfo(beanInfo.getClassInfo(), signature);
+               Object[] params = getParams(constructor.getParameters(), constructorInfo.getParameterTypes());
+               result = constructorInfo.newInstance(params);
+            }
+         }
+         else
+         {
+            if (beanInfo == null)
+               throw new IllegalArgumentException("Missing className: " + this);
+
+            result = beanInfo.newInstance();
+         }
+         if (beanInfo == null)
+            beanInfo = configuration.getBeanInfo(result.getClass());
+
+         if (properties != null)
+         {
+            for (Property property : properties)
+            {
+               Object value = property.getValue();
+               if (value != null)
+               {
+                  PropertyInfo propertyInfo = beanInfo.getProperty(property.getName());
+                  TypeInfo typeInfo = propertyInfo.getType();
+                  String type = property.getType();
+                  if (type != null)
+                     typeInfo = configuration.getTypeInfo(type, cl);
+                  value = typeInfo.convertValue(value, false);
+                  propertyInfo.set(result, value);
+               }
+            }
+         }
+
+         return result;
+      }
+      catch (Throwable t)
+      {
+         throw new RuntimeException("Error constructing javabean", t);
+      }
+   }
+
+   public Object get(PropertyInfo propertyInfo) throws Throwable
+   {
+      return propertyInfo.get(this);
+   }
+
+   public void set(PropertyInfo propertyInfo, Object child) throws Throwable
+   {
+      propertyInfo.set(this, child);
+   }
+
+   /**
+    * Get parameter types.
+    *
+    * @param parameters the parameters
+    * @return parameter types
+    */
+   protected String[] getSignature(Parameter[] parameters)
+   {
+      if (parameters == null)
+         return new String[0];
+      String[] signature = new String[parameters.length];
+      for (int i = 0; i < signature.length; ++i)
+         signature[i] = parameters[i].getType();
+      return signature;
+   }
+
+   /**
+    * Get parameter values.
+    *
+    * @param parameters the parameters
+    * @param paramTypes the types
+    * @return parameter values
+    */
+   protected Object[] getParams(Parameter[] parameters, TypeInfo[] paramTypes)
+   {
+      if (parameters == null)
+         return new String[0];
+      Object[] params = new Object[parameters.length];
+      for (int i = 0; i < params.length; ++i)
+      {
+         Object value = parameters[i].getValue();
+         try
+         {
+            params[i] = paramTypes[i].convertValue(value, false);
+         }
+         catch (Throwable t)
+         {
+            throw new RuntimeException("Error converting parameter #" + i + " value=" + value + " to type " + paramTypes[i]);
+         }
+      }
+      return params;
+   }
+}

Added: projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/JavaBeanBuilder.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/JavaBeanBuilder.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/JavaBeanBuilder.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,42 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.javabean.plugins.jaxb;
+
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.reflect.spi.MethodInfo;
+import org.jboss.xb.spi.BeanAdapterBuilder;
+import org.jboss.xb.spi.BeanAdapterFactory;
+
+/**
+ * JavaBeanBuilder.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class JavaBeanBuilder implements BeanAdapterBuilder
+{
+   public BeanAdapterFactory newFactory(BeanInfo beanInfo, MethodInfo factory)
+   {
+      return new JavaBeanFactory();
+   }
+}

Added: projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/JavaBeanFactory.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/JavaBeanFactory.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/JavaBeanFactory.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,40 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.javabean.plugins.jaxb;
+
+import org.jboss.xb.spi.BeanAdapter;
+import org.jboss.xb.spi.BeanAdapterFactory;
+
+/**
+ * JavaBeanBuilder.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class JavaBeanFactory extends BeanAdapterFactory
+{
+   public BeanAdapter newInstance()
+   {
+      return new JavaBean(this);
+   }
+}

Added: projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/Parameter.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/Parameter.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/Parameter.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,63 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.javabean.plugins.jaxb;
+
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlValue;
+
+/**
+ * Parameter.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class Parameter
+{
+   private String type;
+
+   private Object value;
+
+   public String getType()
+   {
+      return type;
+   }
+
+   @XmlAttribute(name="class")
+   public void setType(String type)
+   {
+      this.type = type;
+   }
+
+   public Object getValue()
+   {
+      return value;
+   }
+
+   @XmlValue
+   @XmlAnyElement
+   public void setValue(Object value)
+   {
+      this.value = value;
+   }
+}

Added: projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/Property.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/Property.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/javabean/plugins/jaxb/Property.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,47 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.javabean.plugins.jaxb;
+
+import javax.xml.bind.annotation.XmlAttribute;
+
+/**
+ * Property.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class Property extends Parameter
+{
+   private String name;
+
+   public String getName()
+   {
+      return name;
+   }
+
+   @XmlAttribute
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+}

Added: projects/microcontainer/trunk/container/src/resources/tests/org/jboss/test/javabean/test/ParameterInstantiate.xml
===================================================================
--- projects/microcontainer/trunk/container/src/resources/tests/org/jboss/test/javabean/test/ParameterInstantiate.xml	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/resources/tests/org/jboss/test/javabean/test/ParameterInstantiate.xml	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<javabean xmlns="test:javabean"
+          class="org.jboss.test.javabean.support.TestParameterInstantiate">
+   <constructor>
+      <parameter>Hello</parameter>
+      <parameter>5</parameter>
+   </constructor>
+</javabean>
\ No newline at end of file

Added: projects/microcontainer/trunk/container/src/resources/tests/org/jboss/test/javabean/test/Property.xml
===================================================================
--- projects/microcontainer/trunk/container/src/resources/tests/org/jboss/test/javabean/test/Property.xml	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/resources/tests/org/jboss/test/javabean/test/Property.xml	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<javabean xmlns="test:javabean"
+          class="org.jboss.test.javabean.support.TestProperty">
+   <property name="AString">StringValue</property>
+   <property name="AByte">12</property>
+   <property name="ABoolean">true</property>
+   <property name="AShort">123</property>
+   <property name="anInt">1234</property>
+   <property name="ALong">12345</property>
+   <property name="AFloat">3.14</property>
+   <property name="ADouble">3.14e12</property>
+   <!--property name="ADate">Jan 01 00:00:00 CET 2001</property-->
+   <property name="ABigDecimal">12e4</property>
+   <property name="ABigInteger">123456</property>
+   <property name="abyte">12</property>
+   <property name="aboolean">true</property>
+   <property name="ashort">123</property>
+   <property name="anint">1234</property>
+   <property name="along">12345</property>
+   <property name="afloat">3.14</property>
+   <property name="adouble">3.14e12</property>
+   <property name="ANumber" class="java.lang.Long">12345</property>
+   <property name="overloadedProperty">StringValue</property>
+   <property name="XYZ">XYZ</property>
+   <property name="abc">abc</property>
+</javabean>
\ No newline at end of file

Added: projects/microcontainer/trunk/container/src/resources/tests/org/jboss/test/javabean/test/PropertyWildcard.xml
===================================================================
--- projects/microcontainer/trunk/container/src/resources/tests/org/jboss/test/javabean/test/PropertyWildcard.xml	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/resources/tests/org/jboss/test/javabean/test/PropertyWildcard.xml	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<javabean xmlns="test:javabean"
+          class="org.jboss.test.javabean.support.TestPropertyWildcard">
+   <property name="bean">
+      <javabean class="org.jboss.test.javabean.support.TestWildcard"/>
+   </property>
+</javabean>
\ No newline at end of file

Added: projects/microcontainer/trunk/container/src/resources/tests/org/jboss/test/javabean/test/SimpleInstantiate.xml
===================================================================
--- projects/microcontainer/trunk/container/src/resources/tests/org/jboss/test/javabean/test/SimpleInstantiate.xml	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/resources/tests/org/jboss/test/javabean/test/SimpleInstantiate.xml	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<javabean xmlns="test:javabean"
+          class="org.jboss.test.javabean.support.TestSimpleInstantiate">
+</javabean>
\ No newline at end of file

Added: projects/microcontainer/trunk/container/src/resources/tests/org/jboss/test/javabean/test/StaticClassMethodInstantiate.xml
===================================================================
--- projects/microcontainer/trunk/container/src/resources/tests/org/jboss/test/javabean/test/StaticClassMethodInstantiate.xml	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/resources/tests/org/jboss/test/javabean/test/StaticClassMethodInstantiate.xml	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<javabean xmlns="test:javabean">
+   <constructor factoryClass="org.jboss.test.javabean.support.TestStaticClassMethodInstantiator" factoryMethod="instantiate"/>
+</javabean>
\ No newline at end of file

Added: projects/microcontainer/trunk/container/src/resources/tests/org/jboss/test/javabean/test/StaticMethodInstantiate.xml
===================================================================
--- projects/microcontainer/trunk/container/src/resources/tests/org/jboss/test/javabean/test/StaticMethodInstantiate.xml	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/resources/tests/org/jboss/test/javabean/test/StaticMethodInstantiate.xml	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<javabean xmlns="test:javabean"
+          class="org.jboss.test.javabean.support.TestStaticMethodInstantiate">
+   <constructor factoryMethod="instantiate"/>
+</javabean>
\ No newline at end of file

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestParameterInstantiate.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestParameterInstantiate.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestParameterInstantiate.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,38 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.javabean.support;
+
+/**
+ * TestSimpleInstantiate.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestParameterInstantiate
+{
+   public String constructorUsed;
+   
+   public TestParameterInstantiate(String string, int integer)
+   {
+      constructorUsed = string + integer;
+   }
+}

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestProperty.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestProperty.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestProperty.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,364 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.javabean.support;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Date;
+
+/**
+ * TestStaticMethodInstantiate.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestProperty
+{
+   /** Object */
+   private Object anObject;
+   
+   /** A string */
+   private String aString;
+
+   /** Byte */
+   private Byte aByte;
+
+   /** Boolean */
+   private Boolean aBoolean;
+
+   /** Character */
+   private Character aCharacter;
+
+   /** Short */
+   private Short aShort;
+
+   /** Int */
+   private Integer anInt;
+
+   /** Long */
+   private Long aLong;
+
+   /** Float */
+   private Float aFloat;
+
+   /** Double */
+   private Double aDouble;
+
+   /** Date */
+   private Date aDate;
+
+   /** BigDecimal */
+   private BigDecimal aBigDecimal;
+
+   /** BigDecimal */
+   private BigInteger aBigInteger;
+
+   /** byte */
+   private byte abyte;
+
+   /** boolean */
+   private boolean aboolean;
+
+   /** char */
+   private char achar;
+
+   /** short */
+   private short ashort;
+
+   /** int */
+   private int anint;
+
+   /** long */
+   private long along;
+
+   /** float */
+   private float afloat;
+
+   /** double */
+   private double adouble;
+
+   /** number */
+   private Number aNumber;
+   
+   /** Overloaded property */
+   private String overloadedProperty;
+   private String xyz;
+   private String abc;
+
+   public Object getAnObject()
+   {
+      return anObject;
+   }
+
+   public void setAnObject(Object object)
+   {
+      anObject = object;
+   }
+
+   public BigDecimal getABigDecimal()
+   {
+      return aBigDecimal;
+   }
+
+   public void setABigDecimal(BigDecimal bigDecimal)
+   {
+      aBigDecimal = bigDecimal;
+   }
+
+   public BigInteger getABigInteger()
+   {
+      return aBigInteger;
+   }
+
+   public void setABigInteger(BigInteger bigInteger)
+   {
+      aBigInteger = bigInteger;
+   }
+
+   public boolean isAboolean()
+   {
+      return aboolean;
+   }
+
+   public void setAboolean(boolean aboolean)
+   {
+      this.aboolean = aboolean;
+   }
+
+   public Boolean getABoolean()
+   {
+      return aBoolean;
+   }
+
+   public void setABoolean(Boolean boolean1)
+   {
+      aBoolean = boolean1;
+   }
+
+   public Number getANumber()
+   {
+      return aNumber;
+   }
+
+   public void setANumber(Number number)
+   {
+      aNumber = number;
+   }
+
+   public byte getAbyte()
+   {
+      return abyte;
+   }
+
+   public void setAbyte(byte abyte)
+   {
+      this.abyte = abyte;
+   }
+
+   public Byte getAByte()
+   {
+      return aByte;
+   }
+
+   public void setAByte(Byte byte1)
+   {
+      aByte = byte1;
+   }
+
+   public char getAchar()
+   {
+      return achar;
+   }
+
+   public void setAchar(char achar)
+   {
+      this.achar = achar;
+   }
+
+   public Character getACharacter()
+   {
+      return aCharacter;
+   }
+
+   public void setACharacter(Character character)
+   {
+      aCharacter = character;
+   }
+
+   public Date getADate()
+   {
+      return aDate;
+   }
+
+   public void setADate(Date date)
+   {
+      aDate = date;
+   }
+
+   public double getAdouble()
+   {
+      return adouble;
+   }
+
+   public void setAdouble(double adouble)
+   {
+      this.adouble = adouble;
+   }
+
+   public Double getADouble()
+   {
+      return aDouble;
+   }
+
+   public void setADouble(Double double1)
+   {
+      aDouble = double1;
+   }
+
+   public float getAfloat()
+   {
+      return afloat;
+   }
+
+   public void setAfloat(float afloat)
+   {
+      this.afloat = afloat;
+   }
+
+   public Float getAFloat()
+   {
+      return aFloat;
+   }
+
+   public void setAFloat(Float float1)
+   {
+      aFloat = float1;
+   }
+
+   public long getAlong()
+   {
+      return along;
+   }
+
+   public void setAlong(long along)
+   {
+      this.along = along;
+   }
+
+   public Long getALong()
+   {
+      return aLong;
+   }
+
+   public void setALong(Long long1)
+   {
+      aLong = long1;
+   }
+
+   public int getAnint()
+   {
+      return anint;
+   }
+
+   public void setAnint(int anint)
+   {
+      this.anint = anint;
+   }
+
+   public Integer getAnInt()
+   {
+      return anInt;
+   }
+
+   public void setAnInt(Integer anInt)
+   {
+      this.anInt = anInt;
+   }
+
+   public short getAshort()
+   {
+      return ashort;
+   }
+
+   public void setAshort(short ashort)
+   {
+      this.ashort = ashort;
+   }
+
+   public Short getAShort()
+   {
+      return aShort;
+   }
+
+   public void setAShort(Short short1)
+   {
+      aShort = short1;
+   }
+
+   public String getAString()
+   {
+      return aString;
+   }
+
+   public void setAString(String string)
+   {
+      aString = string;
+   }
+   
+   public String getOverloadedProperty()
+   {
+      return overloadedProperty;
+   }
+   
+   public void setOverloadedProperty(Long broken)
+   {
+      throw new RuntimeException("Invoked the wrong setter");
+   }
+   
+   public void setOverloadedProperty(String overloadedProperty)
+   {
+      this.overloadedProperty = overloadedProperty;
+   }
+   
+   public void setOverloadedProperty(Integer broken)
+   {
+      throw new RuntimeException("Invoked the wrong setter");
+   }
+
+   public String getXYZ()
+   {
+      return xyz;
+   }
+   public void setXYZ(String xyz)
+   {
+      this.xyz = xyz;
+   }
+
+   public String getAbc()
+   {
+      return abc;
+   }
+   public void setAbc(String abc)
+   {
+      this.abc = abc;
+   }
+}

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestPropertyWildcard.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestPropertyWildcard.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestPropertyWildcard.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,44 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.javabean.support;
+
+/**
+ * 
+ * TestPropertyWildcard.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestPropertyWildcard
+{
+   private TestWildcard bean;
+
+   public TestWildcard getBean()
+   {
+      return bean;
+   }
+
+   public void setBean(TestWildcard bean)
+   {
+      this.bean = bean;
+   }
+}

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestSimpleInstantiate.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestSimpleInstantiate.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestSimpleInstantiate.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.javabean.support;
+
+/**
+ * TestSimpleInstantiate.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestSimpleInstantiate
+{
+
+}

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestStaticClassMethodInstantiate.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestStaticClassMethodInstantiate.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestStaticClassMethodInstantiate.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.javabean.support;
+
+/**
+ * TestStaticClassMethodInstantiate.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestStaticClassMethodInstantiate
+{
+   TestStaticClassMethodInstantiate()
+   {
+   }
+}

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestStaticClassMethodInstantiator.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestStaticClassMethodInstantiator.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestStaticClassMethodInstantiator.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,36 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.javabean.support;
+
+/**
+ * TestStaticClassMethodInstantiator.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestStaticClassMethodInstantiator
+{
+   public static TestStaticClassMethodInstantiate instantiate()
+   {
+      return new TestStaticClassMethodInstantiate();
+   }
+}

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestStaticMethodInstantiate.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestStaticMethodInstantiate.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestStaticMethodInstantiate.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,40 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.javabean.support;
+
+/**
+ * TestStaticMethodInstantiate.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestStaticMethodInstantiate
+{
+   public static TestStaticMethodInstantiate instantiate()
+   {
+      return new TestStaticMethodInstantiate();
+   }
+   
+   private TestStaticMethodInstantiate()
+   {
+   }
+}

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestWildcard.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestWildcard.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/support/TestWildcard.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,34 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.javabean.support;
+
+/**
+ * 
+ * TestPropertyWildcard.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestWildcard
+{
+
+}

Deleted: projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/AbstractJavaBeanTest.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/AbstractJavaBeanTest.java	2007-12-24 07:35:47 UTC (rev 68543)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/AbstractJavaBeanTest.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -1,57 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.javabean.test;
-
-import org.jboss.test.AbstractTestDelegate;
-import org.jboss.test.ioc.test.AbstractIoCTest;
-
-/**
- * AbstractJavaBeanTest.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision$
- */
-public class AbstractJavaBeanTest extends AbstractIoCTest
-{
-   /**
-    * Create a new AbstractJBossXBTest.
-    * 
-    * @param name the name of the test
-    */
-   public AbstractJavaBeanTest(String name)
-   {
-      super(name);
-   }
-
-   /**
-    * Setup the test delegate
-    * 
-    * @param clazz the class
-    * @return the delegate
-    * @throws Exception for any error
-    */
-   public static AbstractTestDelegate getDelegate(Class clazz) throws Exception
-   {
-      return new JavaBeanTestDelegate(clazz);
-   }
-
-}

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/AbstractJavaBeanTest.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/AbstractJavaBeanTest.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/AbstractJavaBeanTest.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,45 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.javabean.test;
+
+import org.jboss.test.xb.builder.AbstractBuilderTest;
+import org.jboss.javabean.plugins.jaxb.JavaBean;
+
+/**
+ * AbstractJavaBeanTest.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision$
+ */
+public class AbstractJavaBeanTest extends AbstractBuilderTest
+{
+   public AbstractJavaBeanTest(String name)
+   {
+      super(name);
+   }
+
+   protected <T> T unmarshalJavaBean(Class<T> expected, Class... others) throws Exception
+   {
+      return unmarshalObject(expected, JavaBean.class, others);
+   }
+}

Modified: projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/AmbiguityTestCase.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/AmbiguityTestCase.java	2007-12-24 07:35:47 UTC (rev 68543)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/AmbiguityTestCase.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -30,7 +30,7 @@
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision: 58996 $
  */
-public class AmbiguityTestCase extends AbstractJavaBeanTest
+public class AmbiguityTestCase extends OldAbstractJavaBeanTest
 {
    /**
     * Create a new AmbiguityTestCase.

Modified: projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/InstantiateTestCase.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/InstantiateTestCase.java	2007-12-24 07:35:47 UTC (rev 68543)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/InstantiateTestCase.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -30,7 +30,7 @@
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision$
  */
-public class InstantiateTestCase extends AbstractJavaBeanTest
+public class InstantiateTestCase extends OldAbstractJavaBeanTest
 {
    public void testInstantiate() throws Exception
    {

Modified: projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/JavaBeanTestSuite.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/JavaBeanTestSuite.java	2007-12-24 07:35:47 UTC (rev 68543)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/JavaBeanTestSuite.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -28,6 +28,7 @@
 /**
  * JavaBean Test Suite.
  * 
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision$
  */
@@ -45,6 +46,13 @@
       suite.addTest(InstantiateTestCase.suite());
       suite.addTest(PropertyTestCase.suite());
       suite.addTest(AmbiguityTestCase.suite());
+      // jaxb tests
+      suite.addTest(SimpleInstantiateUnitTestCase.suite());
+      suite.addTest(StaticMethodInstantiateUnitTestCase.suite());
+      suite.addTest(StaticClassMethodInstantiateUnitTestCase.suite());
+      suite.addTest(ParameterInstantiateUnitTestCase.suite());
+      suite.addTest(PropertyUnitTestCase.suite());
+      suite.addTest(PropertyWildcardUnitTestCase.suite());
 
       return suite;
    }

Copied: projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/OldAbstractJavaBeanTest.java (from rev 68538, projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/AbstractJavaBeanTest.java)
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/OldAbstractJavaBeanTest.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/OldAbstractJavaBeanTest.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,56 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.javabean.test;
+
+import org.jboss.test.AbstractTestDelegate;
+import org.jboss.test.ioc.test.AbstractIoCTest;
+
+/**
+ * AbstractJavaBeanTest.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision$
+ */
+public class OldAbstractJavaBeanTest extends AbstractIoCTest
+{
+   /**
+    * Create a new AbstractJBossXBTest.
+    * 
+    * @param name the name of the test
+    */
+   public OldAbstractJavaBeanTest(String name)
+   {
+      super(name);
+   }
+
+   /**
+    * Setup the test delegate
+    * 
+    * @param clazz the class
+    * @return the delegate
+    * @throws Exception for any error
+    */
+   public static AbstractTestDelegate getDelegate(Class clazz) throws Exception
+   {
+      return new JavaBeanTestDelegate(clazz);
+   }
+}


Property changes on: projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/OldAbstractJavaBeanTest.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/ParameterInstantiateUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/ParameterInstantiateUnitTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/ParameterInstantiateUnitTestCase.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,51 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.javabean.test;
+
+import junit.framework.Test;
+
+import org.jboss.test.javabean.support.TestParameterInstantiate;
+
+/**
+ * ParameterInstantiateUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ParameterInstantiateUnitTestCase extends AbstractJavaBeanTest
+{
+   public static Test suite()
+   {
+      return suite(ParameterInstantiateUnitTestCase.class);
+   }
+   
+   public ParameterInstantiateUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testParameterInstantiate() throws Exception
+   {
+      TestParameterInstantiate result = unmarshalJavaBean(TestParameterInstantiate.class);
+      assertEquals("Hello5", result.constructorUsed);
+   }
+}

Modified: projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/PropertyTestCase.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/PropertyTestCase.java	2007-12-24 07:35:47 UTC (rev 68543)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/PropertyTestCase.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -41,7 +41,7 @@
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision$
  */
-public class PropertyTestCase extends AbstractJavaBeanTest
+public class PropertyTestCase extends OldAbstractJavaBeanTest
 {
 //   private static DateFormat dateFormat = new SimpleDateFormat("EEE MMM d HH:mm:ss z yyyy");
    // EEE names - Locale configured

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/PropertyUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/PropertyUnitTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/PropertyUnitTestCase.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,115 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.javabean.test;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import junit.framework.Test;
+
+import org.jboss.test.javabean.support.TestProperty;
+
+/**
+ * PropertyInstantiateUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class PropertyUnitTestCase extends AbstractJavaBeanTest
+{
+   private static DateFormat dateFormat = new SimpleDateFormat("MMM d HH:mm:ss z yyyy");
+
+   String stringValue =  "StringValue";
+   Byte byteValue = new Byte("12");
+   Boolean booleanValue = Boolean.TRUE;
+   // TODO character
+   // Character characterValue = new Character('a');
+   Short shortValue = new Short("123");
+   Integer integerValue = new Integer("1234");
+   Long longValue = new Long("12345");
+   Float floatValue = new Float("3.14");
+   Double doubleValue = new Double("3.14e12");
+//   Date dateValue = createDate("Mon Jan 01 00:00:00 CET 2001");
+//   Date dateValue = createDate("Jan 01 00:00:00 CET 2001");
+   BigDecimal bigDecimalValue = new BigDecimal("12e4");
+   BigInteger bigIntegerValue = new BigInteger("123456");
+
+   public static Test suite()
+   {
+      return suite(PropertyUnitTestCase.class);
+   }
+   
+   public PropertyUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testProperty() throws Exception
+   {
+      TestProperty bean = unmarshalJavaBean(TestProperty.class);
+
+      assertEquals(stringValue, bean.getAString());
+      assertEquals(byteValue, bean.getAByte());
+      assertEquals(booleanValue, bean.getABoolean());
+      // TODO character
+      // assertEquals(characterValue, bean.getACharacter());
+      assertEquals(shortValue, bean.getAShort());
+      assertEquals(integerValue, bean.getAnInt());
+      assertEquals(longValue, bean.getALong());
+      assertEquals(floatValue, bean.getAFloat());
+      assertEquals(doubleValue, bean.getADouble());
+      // TODO assertEquals(dateValue, bean.getADate());
+      assertEquals(bigDecimalValue, bean.getABigDecimal());
+      assertEquals(bigIntegerValue, bean.getABigInteger());
+      assertEquals(byteValue.byteValue(), bean.getAbyte());
+      assertEquals(booleanValue.booleanValue(), bean.isAboolean());
+      // TODO character
+      // assertEquals(characterValue.charValue(), bean.getAchar());
+      assertEquals(shortValue.shortValue(), bean.getAshort());
+      assertEquals(integerValue.intValue(), bean.getAnint());
+      assertEquals(longValue.longValue(), bean.getAlong());
+      assertEquals(floatValue.floatValue(), bean.getAfloat());
+      assertEquals(doubleValue.doubleValue(), bean.getAdouble());
+      Number number = bean.getANumber();
+      assertEquals(Long.class, number.getClass());
+      assertEquals(longValue, number);
+      assertEquals(stringValue, bean.getOverloadedProperty());
+      // An all uppercase property
+      assertEquals("XYZ", bean.getXYZ());
+      assertEquals("abc", bean.getAbc());      
+   }
+
+   protected Date createDate(String date)
+   {
+      try
+      {
+         return dateFormat.parse(date);
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException(e);
+      }
+   }
+}

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/PropertyWildcardUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/PropertyWildcardUnitTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/PropertyWildcardUnitTestCase.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,53 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.javabean.test;
+
+import junit.framework.Test;
+
+import org.jboss.test.javabean.support.TestPropertyWildcard;
+import org.jboss.test.javabean.support.TestWildcard;
+
+/**
+ * PropertyWildcardUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class PropertyWildcardUnitTestCase extends AbstractJavaBeanTest
+{
+   public static Test suite()
+   {
+      return suite(PropertyWildcardUnitTestCase.class);
+   }
+   
+   public PropertyWildcardUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testProperty() throws Exception
+   {
+      TestPropertyWildcard bean = unmarshalJavaBean(TestPropertyWildcard.class);
+      TestWildcard wildcard = bean.getBean();
+      assertNotNull(wildcard);
+   }
+}

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/SimpleInstantiateUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/SimpleInstantiateUnitTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/SimpleInstantiateUnitTestCase.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,50 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.javabean.test;
+
+import junit.framework.Test;
+
+import org.jboss.test.javabean.support.TestSimpleInstantiate;
+
+/**
+ * SimpleInstantiateUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class SimpleInstantiateUnitTestCase extends AbstractJavaBeanTest
+{
+   public static Test suite()
+   {
+      return suite(SimpleInstantiateUnitTestCase.class);
+   }
+   
+   public SimpleInstantiateUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testSimpleInstantiate() throws Exception
+   {
+      unmarshalJavaBean(TestSimpleInstantiate.class);
+   }
+}

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/StaticClassMethodInstantiateUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/StaticClassMethodInstantiateUnitTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/StaticClassMethodInstantiateUnitTestCase.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,50 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.javabean.test;
+
+import junit.framework.Test;
+
+import org.jboss.test.javabean.support.TestStaticClassMethodInstantiate;
+
+/**
+ * StaticClassMethodInstantiateUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class StaticClassMethodInstantiateUnitTestCase extends AbstractJavaBeanTest
+{
+   public static Test suite()
+   {
+      return suite(StaticClassMethodInstantiateUnitTestCase.class);
+   }
+   
+   public StaticClassMethodInstantiateUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testStaticClassMethodInstantiate() throws Exception
+   {
+      unmarshalJavaBean(TestStaticClassMethodInstantiate.class);
+   }
+}

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/StaticMethodInstantiateUnitTestCase.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/StaticMethodInstantiateUnitTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/javabean/test/StaticMethodInstantiateUnitTestCase.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,50 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.javabean.test;
+
+import junit.framework.Test;
+
+import org.jboss.test.javabean.support.TestStaticMethodInstantiate;
+
+/**
+ * StaticMethodInstantiateUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class StaticMethodInstantiateUnitTestCase extends AbstractJavaBeanTest
+{
+   public static Test suite()
+   {
+      return suite(StaticMethodInstantiateUnitTestCase.class);
+   }
+   
+   public StaticMethodInstantiateUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testStaticMethodInstantiate() throws Exception
+   {
+      unmarshalJavaBean(TestStaticMethodInstantiate.class);
+   }
+}

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/xb/builder/AbstractBuilderTest.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/xb/builder/AbstractBuilderTest.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/xb/builder/AbstractBuilderTest.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,269 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.xb.builder;
+
+import java.net.URL;
+import java.util.Collection;
+
+import org.jboss.test.AbstractTestCaseWithSetup;
+import org.jboss.test.AbstractTestDelegate;
+import org.jboss.util.UnreachableStatementException;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultHandlers;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
+import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.TermBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler;
+import org.jboss.xb.builder.JBossXBBuilder;
+
+/**
+ * AbstractBuilderTest.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractBuilderTest extends AbstractTestCaseWithSetup
+{
+   protected String rootName = getRootName();
+
+   private static final DebugElementHandler DEBUG_ELEMENT_HANDLER = new DebugElementHandler();
+   private ParticleHandler elementHandler;
+   private ParticleHandler simpleHandler;
+
+   public AbstractBuilderTest(String name)
+   {
+      super(name);
+   }
+
+   /**
+    * Setup the test delegate
+    *
+    * @param clazz the class
+    * @return the delegate
+    * @throws Exception for any error
+    */
+   public static AbstractTestDelegate getDelegate(Class<?> clazz) throws Exception
+   {
+      return new JBossXBTestDelegate(clazz);
+   }
+
+   protected JBossXBTestDelegate getJBossXBDelegate()
+   {
+      return (JBossXBTestDelegate) getDelegate();
+   }
+
+   @Override
+   protected void setUp() throws Exception
+   {
+      elementHandler = DefaultHandlers.ELEMENT_HANDLER;
+      simpleHandler = DefaultHandlers.SIMPLE_HANDLER;
+      DefaultHandlers.ELEMENT_HANDLER = DEBUG_ELEMENT_HANDLER;
+      DefaultHandlers.SIMPLE_HANDLER = DefaultHandlers.ELEMENT_HANDLER;
+
+      super.setUp();
+      configureLogging();
+   }
+
+   protected void tearDown() throws Exception
+   {
+      super.tearDown();
+
+      DefaultHandlers.ELEMENT_HANDLER = elementHandler;
+      elementHandler = null;
+      DefaultHandlers.SIMPLE_HANDLER = simpleHandler;
+      simpleHandler = null;
+   }
+
+   protected <T> T unmarshalObjectFromSchema(Class<T> expected) throws Exception
+   {
+      DefaultSchemaResolver resolver = new DefaultSchemaResolver();
+      // TODO this is a mess
+      String nsURI = "http://www.jboss.org/test/xml/" + rootName;
+      String packageName = getClass().getPackage().getName();
+      packageName = packageName.replace(".", "/");
+      String name = getClass().getName();
+      int dot = name.lastIndexOf('.');
+      if (dot != -1)
+         name = name.substring(dot + 1);
+      dot = name.lastIndexOf("UnitTestCase");
+      if (dot != -1)
+         name = name.substring(0, dot);
+      String testXsd = packageName + '/' + name + ".xsd";
+      resolver.addSchemaLocation(nsURI, testXsd);
+      resolver.addSchemaInitializer(nsURI, JBossXBBuilder.newInitializer(expected));
+
+      String testXml = findTestXml();
+      Object o = unmarshal(testXml, expected, resolver);
+      assertNotNull(o);
+      getLog().debug("Unmarshalled " + o + " of type " + o.getClass().getName());
+      return expected.cast(o);
+   }
+
+   protected <T, U> T unmarshalObject(Class<T> expected, Class<U> reference, Class... others) throws Exception
+   {
+      TestSchemaResolver resolver = new TestSchemaResolver();
+
+      SchemaBinding schemaBinding = JBossXBBuilder.build(reference);
+      resolver.addSchemaBinding(schemaBinding);
+      if (others != null)
+      {
+         for (Class<?> other : others)
+         {
+            SchemaBinding otherBinding = JBossXBBuilder.build(other);
+            resolver.addSchemaBinding(otherBinding);
+         }
+      }
+
+      String testXml = findTestXml();
+      Object o = unmarshal(testXml, schemaBinding);
+      assertNotNull(o);
+      getLog().debug("Unmarshalled " + o + " of type " + o.getClass().getName());
+      try
+      {
+         return expected.cast(o);
+      }
+      catch (ClassCastException e)
+      {
+         fail("Expected " + expected.getName() + " got " + o.getClass().getName());
+         throw new UnreachableStatementException();
+      }
+   }
+
+   /**
+    * Unmarshal some xml
+    *
+    * @param name the name
+    * @param schema the schema
+    * @return the unmarshalled object
+    * @throws Exception for any error
+    */
+   protected Object unmarshal(String name, SchemaBinding schema) throws Exception
+   {
+      String url = findXML(name);
+      return getJBossXBDelegate().unmarshal(url, schema);
+   }
+
+   protected <T, U> T unmarshalObject(Class<T> expected, Class<U> reference) throws Exception
+   {
+      return unmarshalObject(expected, reference, null);
+   }
+
+   protected <T> T unmarshalObject(Class<T> expected) throws Exception
+   {
+      return unmarshalObject(expected, expected, null);
+   }
+
+   /**
+    * Unmarshal some xml
+    *
+    * @param name the name
+    * @param expected the expected type
+    * @param resolver the resolver
+    * @return the unmarshalled object
+    * @throws Exception for any error
+    */
+   protected Object unmarshal(String name, Class<?> expected, SchemaBindingResolver resolver) throws Exception
+   {
+      Object object = unmarshal(name, resolver);
+      if (object == null)
+         fail("No object from " + name);
+      assertTrue("Object '" + object + "' cannot be assigned to " + expected.getName(), expected.isAssignableFrom(object.getClass()));
+      return object;
+   }
+
+   /**
+    * Unmarshal some xml
+    *
+    * @param name the name
+    * @param resolver the resolver
+    * @return the unmarshalled object
+    * @throws Exception for any error
+    */
+   protected Object unmarshal(String name, SchemaBindingResolver resolver) throws Exception
+   {
+      String url = findXML(name);
+      return getJBossXBDelegate().unmarshal(url, resolver);
+   }
+
+   protected String findTestXml()
+   {
+      String result = rootName + "_" + getName() + ".xml";
+      if (getResource(result) == null)
+         result = rootName + ".xml";
+      return result;
+   }
+
+   /**
+    * Get the package root name
+    *
+    * @return the root name
+    */
+   protected String getRootName()
+   {
+      String longName = getClass().getName();
+      int dot = longName.lastIndexOf('.');
+      if (dot != -1)
+         longName = longName.substring(dot + 1);
+      dot = longName.lastIndexOf("UnitTestCase");
+      if (dot != -1)
+         longName = longName.substring(0, dot);
+      return longName;
+   }
+
+   @SuppressWarnings("unchecked")
+   protected TermBinding assertSingleSequence(TermBinding term)
+   {
+      assertNotNull(term);
+      assertTrue(term instanceof SequenceBinding);
+      SequenceBinding sequence = (SequenceBinding) term;
+      Collection<ParticleBinding> particles = sequence.getParticles();
+      assertTrue(particles.size() == 1);
+      ParticleBinding particle = particles.iterator().next();
+      term = particle.getTerm();
+      assertNotNull(term);
+      return term;
+   }
+
+   /**
+    * Find the xml
+    *
+    * @param name the name
+    * @return the url of the xml
+    */
+   protected String findXML(String name)
+   {
+      URL url = getResource(name);
+      if (url == null)
+         fail(name + " not found");
+      return url.toString();
+   }
+
+   @Override
+   public void configureLogging()
+   {
+      //enableTrace("org.jboss.xb");
+      //enableTrace("org.jboss.test.xb");
+   }
+}

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/xb/builder/DebugElementHandler.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/xb/builder/DebugElementHandler.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/xb/builder/DebugElementHandler.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,54 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.xb.builder;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+
+import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.ParticleHandler;
+import org.xml.sax.Attributes;
+
+/**
+ * DebugElementHandler.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class DebugElementHandler implements ParticleHandler
+{
+   public Object startParticle(Object parent, QName elementName, ParticleBinding particle, Attributes attrs, NamespaceContext nsCtx)
+   {
+      throw new UnsupportedOperationException("Using Default Handler! startParticle: " + elementName + " " + particle);
+   }
+
+   public void setParent(Object parent, Object o, QName elementName, ParticleBinding particle, ParticleBinding parentParticle)
+   {
+      throw new UnsupportedOperationException("Using Default Handler! setParent: " + elementName + " " + particle);
+   }
+
+   public Object endParticle(Object o, QName elementName, ParticleBinding particle)
+   {
+      throw new UnsupportedOperationException("Using Default Handler! endParticle: " + elementName + " " + particle);
+   }
+}

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/xb/builder/JBossXBTestDelegate.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/xb/builder/JBossXBTestDelegate.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/xb/builder/JBossXBTestDelegate.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,171 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.xb.builder;
+
+import java.lang.reflect.Method;
+import java.net.URL;
+
+import org.jboss.net.protocol.URLStreamHandlerFactory;
+import org.jboss.test.AbstractTestDelegate;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
+import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder;
+
+/**
+ * JBossXBTestDelegate.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 40492 $
+ */
+public class JBossXBTestDelegate extends AbstractTestDelegate
+{
+   /** Whether initialization has been done */
+   private static boolean done = false;
+
+   /** The unmarshaller factory */
+   protected UnmarshallerFactory unmarshallerFactory;
+
+   /** The resolver */
+   protected SchemaBindingResolver defaultResolver;
+
+   /**
+    * Initialize
+    */
+   public synchronized static void init()
+   {
+      if (done)
+         return;
+      done = true;
+      URL.setURLStreamHandlerFactory(new URLStreamHandlerFactory());
+      URLStreamHandlerFactory.preload();
+      String handlerPkgs = System.getProperty("java.protocol.handler.pkgs");
+      if (handlerPkgs != null)
+         handlerPkgs += "|org.jboss.net.protocol";
+      else
+         handlerPkgs = "org.jboss.net.protocol";
+      System.setProperty("java.protocol.handler.pkgs", handlerPkgs);
+   }
+
+   /**
+    * Create a new JBossXBTestDelegate.
+    *
+    * @param clazz the test class
+    */
+   public JBossXBTestDelegate(Class<?> clazz)
+   {
+      super(clazz);
+   }
+
+   @Override
+   public void setUp() throws Exception
+   {
+      super.setUp();
+      init();
+      unmarshallerFactory = UnmarshallerFactory.newInstance();
+      initResolver();
+   }
+
+   protected void initResolver() throws Exception
+   {
+      try
+      {
+         Method method = clazz.getMethod("initResolver", null);
+         defaultResolver = (SchemaBindingResolver) method.invoke(null, null);
+      }
+      catch (NoSuchMethodException ignored)
+      {
+         defaultResolver = new DefaultSchemaResolver();
+      }
+   }
+
+   /**
+    * Unmarshal an object
+    *
+    * @param url the url
+    * @param resolver the resolver
+    * @return the object
+    * @throws Exception for any error
+    */
+   public Object unmarshal(String url, SchemaBindingResolver resolver) throws Exception
+   {
+      if (resolver == null)
+         resolver = defaultResolver;
+
+      long start = System.currentTimeMillis();
+      Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
+      log.debug("Initialized parsing in " + (System.currentTimeMillis() - start) + "ms");
+      try
+      {
+         Object result = unmarshaller.unmarshal(url, resolver);
+         log.debug("Total parse for " + url + " took " + (System.currentTimeMillis() - start) + "ms");
+         return result;
+      }
+      catch (Exception e)
+      {
+         log.debug("Error during parsing: " + url, e);
+         throw e;
+      }
+   }
+
+   /**
+    * Unmarshal an object
+    *
+    * @param url the url
+    * @param schema the schema
+    * @return the object
+    * @throws Exception for any error
+    */
+   public Object unmarshal(String url, SchemaBinding schema) throws Exception
+   {
+      long start = System.currentTimeMillis();
+      Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
+      log.debug("Initialized parsing in " + (System.currentTimeMillis() - start) + "ms");
+      try
+      {
+         Object result = unmarshaller.unmarshal(url, schema);
+         log.debug("Total parse for " + url + " took " + (System.currentTimeMillis() - start) + "ms");
+         return result;
+      }
+      catch (Exception e)
+      {
+         log.debug("Error during parsing: " + url, e);
+         throw e;
+      }
+   }
+
+   /**
+    * Bind a schema
+    *
+    * @param url the url
+    * @param resolver the resolver
+    * @return the object
+    * @throws Exception for any error
+    */
+   public SchemaBinding bind(String url, SchemaBindingResolver resolver) throws Exception
+   {
+      return XsdBinder.bind(url, resolver);
+   }
+}

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/xb/builder/SchemaPrinter.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/xb/builder/SchemaPrinter.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/xb/builder/SchemaPrinter.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,277 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.xb.builder;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.xml.XMLConstants;
+
+import org.jboss.xb.binding.sunday.unmarshalling.AllBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.AttributeBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.ChoiceBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.ParticleBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.TermBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.TypeBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.WildcardBinding;
+
+/**
+ * SchemaPrinter.
+ *
+ * TODO finish this off properly
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class SchemaPrinter
+{
+   @SuppressWarnings("unchecked")
+   public static String printSchema(SchemaBinding schemaBinding)
+   {
+      String nsURI = (String) schemaBinding.getNamespaces().iterator().next();
+      StringBuilder builder = new StringBuilder();
+      builder.append("<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n");
+      if (XMLConstants.NULL_NS_URI.equals(nsURI) == false)
+      {
+         builder.append("            targetNamespace=\"").append(nsURI).append("\"\n");
+         builder.append("            xmlns=\"").append(nsURI).append("\"\n");
+      }
+      builder.append(">\n");
+      int pad=3;
+      Iterator<ParticleBinding> elements = schemaBinding.getElementParticles();
+      while (elements != null && elements.hasNext())
+         printElement(builder, pad, elements.next());
+      Iterator<TypeBinding> types = schemaBinding.getTypes();
+      while (types != null && types.hasNext())
+         printType(builder, pad, types.next());
+      builder.append("</xsd:schema>");
+      return builder.toString();
+   }
+
+   public static void printElement(StringBuilder builder, int pad, ParticleBinding particle)
+   {
+      ElementBinding element = (ElementBinding) particle.getTerm();
+      pad(builder, pad);
+      builder.append("<element name=\"").append(element.getQName()).append("\"");
+      int minOccurs = particle.getMinOccurs();
+      if (minOccurs != 1)
+         builder.append(" minOccurs=\"").append(minOccurs).append("\"");
+      int maxOccurs = particle.getMaxOccurs();
+      if (maxOccurs != 1)
+      {
+         builder.append(" maxOccurs=\"");
+         if (maxOccurs == -1)
+            builder.append("unbounded");
+         else
+            builder.append(maxOccurs);
+         builder.append("\"");
+      }
+      TypeBinding type = element.getType();
+      if (type != null && type.getQName() != null)
+         builder.append(" type=\"").append(type.getQName()).append("\"");
+      builder.append(">");
+      if (type != null && type.getQName() == null)
+         printAnonymousType(builder, pad + 3, type);
+      pad(builder, pad);
+      builder.append("</element>");
+   }
+
+   public static void printAnonymousType(StringBuilder builder, int pad, TypeBinding type)
+   {
+      pad(builder, pad);
+      builder.append("<complexType>");
+      TypeBinding baseTypeBinding = type.getBaseType();
+      String qName;
+      if (baseTypeBinding != null)
+         qName = baseTypeBinding.getQName().toString();
+      else
+         qName = "xsd:anyType";
+      pad(builder, pad);
+      builder.append("   <restriction base=\"").append(qName).append("\">");
+      printTypeInfo(builder, pad+6, type);
+      pad(builder, pad);
+      builder.append("   </restriction>");
+      pad(builder, pad);
+      builder.append("</complexType>");
+   }
+
+   public static void printType(StringBuilder builder, int pad, TypeBinding type)
+   {
+      if (type.isSimple())
+         printSimpleType(builder, pad, type);
+      else
+         printComplexType(builder, pad, type);
+   }
+
+   public static void printSimpleType(StringBuilder builder, int pad, TypeBinding type)
+   {
+      pad(builder, pad);
+      builder.append("<simpleType name=\"").append(type.getQName()).append("\"");
+      TypeBinding baseTypeBinding = type.getBaseType();
+      String qName = null;
+      if (baseTypeBinding != null)
+         qName = baseTypeBinding.getQName().toString();
+      else
+         qName = "xsd:anySimpleType";
+      builder.append(" base=\"").append(qName).append("\">");
+      printTypeInfo(builder, pad+3, type);
+      pad(builder, pad);
+      builder.append("</simpleType>");
+   }
+
+   public static void printComplexType(StringBuilder builder, int pad, TypeBinding type)
+   {
+      pad(builder, pad);
+      builder.append("<complexType name=\"").append(type.getQName()).append("\"");
+      TypeBinding baseTypeBinding = type.getBaseType();
+      String qName = null;
+      if (baseTypeBinding != null)
+         qName = baseTypeBinding.getQName().toString();
+      else
+         qName = "xsd:anyType";
+      builder.append(" base=\"").append(qName).append("\">");
+      printTypeInfo(builder, pad+3, type);
+      pad(builder, pad);
+      builder.append("</complexType>");
+   }
+
+   @SuppressWarnings("unchecked")
+   public static void printTypeInfo(StringBuilder builder, int pad, TypeBinding type)
+   {
+      ParticleBinding particle = type.getParticle();
+      if (particle != null)
+      {
+         printParticle(builder, pad, particle);
+      }
+
+      Collection<AttributeBinding> attributes = type.getAttributes();
+      if (attributes != null)
+      {
+         for (AttributeBinding attribute : attributes)
+         {
+            printAttribute(builder, pad, attribute);
+         }
+      }
+   }
+
+   public static void printParticle(StringBuilder builder, int pad, ParticleBinding particle)
+   {
+      TermBinding term = particle.getTerm();
+      if (term instanceof ElementBinding)
+         printElement(builder, pad, particle);
+      else if (term instanceof WildcardBinding)
+         printWildcard(builder, pad, particle);
+      else if (term instanceof SequenceBinding)
+         printModel(builder, pad, particle, "sequence");
+      else if (term instanceof AllBinding)
+         printModel(builder, pad, particle, "all");
+      else if (term instanceof ChoiceBinding)
+         printModel(builder, pad, particle, "choice");
+   }
+
+   @SuppressWarnings("unchecked")
+   public static void printModel(StringBuilder builder, int pad, ParticleBinding particle, String prefix)
+   {
+      pad(builder, pad);
+      builder.append("<").append(prefix);
+      int minOccurs = particle.getMinOccurs();
+      if (minOccurs != 1)
+         builder.append(" minOccurs=\"").append(minOccurs).append("\"");
+      int maxOccurs = particle.getMaxOccurs();
+      if (maxOccurs != 1)
+      {
+         builder.append(" maxOccurs=\"");
+         if (maxOccurs == -1)
+            builder.append("unbounded");
+         else
+            builder.append(maxOccurs);
+         builder.append("\"");
+      }
+      builder.append(">");
+      ModelGroupBinding model = (ModelGroupBinding) particle.getTerm();
+      Collection<ParticleBinding> particles = model.getParticles();
+      boolean newLine = true;
+      if (particles != null)
+      {
+         for (ParticleBinding component : particles)
+            printParticle(builder, pad+3, component);
+      }
+      else
+      {
+         newLine = false;
+      }
+      pad(builder, pad, newLine);
+      builder.append("</").append(prefix).append(">");
+   }
+
+   public static void printWildcard(StringBuilder builder, int pad, ParticleBinding particle)
+   {
+      pad(builder, pad);
+      builder.append("<any");
+      int minOccurs = particle.getMinOccurs();
+      if (minOccurs != 1)
+         builder.append(" minOccurs=\"").append(minOccurs).append("\"");
+      int maxOccurs = particle.getMaxOccurs();
+      if (maxOccurs != 1)
+      {
+         builder.append(" maxOccurs=\"");
+         if (maxOccurs == -1)
+            builder.append("unbounded");
+         else
+            builder.append(maxOccurs);
+         builder.append("\"");
+      }
+      builder.append("/>");
+   }
+
+   public static void printAttribute(StringBuilder builder, int pad, AttributeBinding attribute)
+   {
+      pad(builder, pad);
+      TypeBinding typeBinding = attribute.getType();
+      String qName = null;
+      if (typeBinding != null && typeBinding.getQName() != null)
+         qName = typeBinding.getQName().toString();
+      else
+         qName = "CDATA";
+      builder.append("<attribute name=\"").append(attribute.getQName().getLocalPart()).append("\"");
+      builder.append(" type=\"").append(qName).append("\"");
+      if (attribute.getRequired() == false)
+         builder.append(" optional=\"true\"/>");
+   }
+
+   public static void pad(StringBuilder builder, int pad)
+   {
+      pad(builder, pad, true);
+   }
+
+   public static void pad(StringBuilder builder, int pad, boolean newLine)
+   {
+      if (newLine)
+         builder.append("\n");
+      for (int i = 0; i < pad; ++ i)
+         builder.append(' ');
+   }
+}

Added: projects/microcontainer/trunk/container/src/tests/org/jboss/test/xb/builder/TestSchemaResolver.java
===================================================================
--- projects/microcontainer/trunk/container/src/tests/org/jboss/test/xb/builder/TestSchemaResolver.java	                        (rev 0)
+++ projects/microcontainer/trunk/container/src/tests/org/jboss/test/xb/builder/TestSchemaResolver.java	2007-12-24 18:04:57 UTC (rev 68544)
@@ -0,0 +1,78 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.xb.builder;
+
+import java.util.HashMap;
+
+import org.jboss.logging.Logger;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
+import org.w3c.dom.ls.LSInput;
+
+/**
+ * TestSchemaResolver.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestSchemaResolver implements SchemaBindingResolver
+{
+   private static final Logger log = Logger.getLogger(TestSchemaResolver.class);
+
+   private HashMap<String, SchemaBinding> bindings = new HashMap<String, SchemaBinding>();
+
+   public String getBaseURI()
+   {
+      return null;
+   }
+
+   public void addSchemaBinding(SchemaBinding schemaBinding)
+   {
+      schemaBinding.setSchemaResolver(this);
+      String nsURI = (String) schemaBinding.getNamespaces().iterator().next();
+      bindings.put(nsURI, schemaBinding);
+      if (log.isTraceEnabled())
+      {
+         String schema = SchemaPrinter.printSchema(schemaBinding);
+         log.trace("Bound: " + nsURI + "\n" + schema);
+      }
+   }
+
+   public SchemaBinding resolve(String nsUri, String baseURI, String schemaLocation)
+   {
+      SchemaBinding result = bindings.get(nsUri);
+      if (result == null)
+         throw new RuntimeException("Schema not bound: " + nsUri + " available: " + bindings.keySet());
+      return result;
+   }
+
+   public LSInput resolveAsLSInput(String nsUri, String baseUri, String schemaLocation)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   public void setBaseURI(String baseURI)
+   {
+      throw new org.jboss.util.NotImplementedException("setBaseURI");
+   }
+}




More information about the jboss-cvs-commits mailing list