[jboss-cvs] JBossAS SVN: r68640 - in projects/microcontainer/trunk/kernel: src/main/org/jboss/beans/metadata/plugins and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Jan 5 16:40:48 EST 2008


Author: alesj
Date: 2008-01-05 16:40:47 -0500 (Sat, 05 Jan 2008)
New Revision: 68640

Added:
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/package-info.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/AbstractMCTest.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/AliasJaxbTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/AnnotationJaxbTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ArrayJaxbTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/BeanFactoryJaxbTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/BeanJaxbTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/CallbackJaxbTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ClassLoaderJaxbTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/CollectionJaxbTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ConstructorJaxbTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/DemandJaxbTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/DependencyJaxbTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/DeploymentJaxbTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/FactoryJaxbTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/InjectionJaxbTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/InstallJaxbTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/LifecycleJaxbTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ListJaxbTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/MapJaxbTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ParameterJaxbTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/PropertyJaxbTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/SetJaxbTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/SupplyJaxbTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ValueFactoryJaxbTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ValueJaxbTestCase.java
Removed:
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/package-info.java
Modified:
   projects/microcontainer/trunk/kernel/pom-jdk14.xml
   projects/microcontainer/trunk/kernel/pom.xml
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractBeanMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractFeatureMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractLazyMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractMapMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractValueFactoryMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractValueMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/MapEntry.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/factory/GenericBeanFactoryMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/AliasMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/AnnotationMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/ValueMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/AbstractKernelDeployment.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/XMLTestSuite.java
Log:
Initial JAXB support for MC IoC - some fixes.
Adding jaxb tests - TODO on failures.

Modified: projects/microcontainer/trunk/kernel/pom-jdk14.xml
===================================================================
--- projects/microcontainer/trunk/kernel/pom-jdk14.xml	2008-01-05 21:39:21 UTC (rev 68639)
+++ projects/microcontainer/trunk/kernel/pom-jdk14.xml	2008-01-05 21:40:47 UTC (rev 68640)
@@ -50,6 +50,7 @@
           </includes>
           <excludes>
             <exclude>org/jboss/test/**/NoJavassistAnnotationCreatorTestCase.java</exclude>
+            <exclude>org/jboss/test/**/*JaxbTestCase.java</exclude>
           </excludes>
           <useSystemClassLoader>true</useSystemClassLoader>
         </configuration>

Modified: projects/microcontainer/trunk/kernel/pom.xml
===================================================================
--- projects/microcontainer/trunk/kernel/pom.xml	2008-01-05 21:39:21 UTC (rev 68639)
+++ projects/microcontainer/trunk/kernel/pom.xml	2008-01-05 21:40:47 UTC (rev 68640)
@@ -91,8 +91,14 @@
       <groupId>jboss</groupId>
       <artifactId>jboss-logging-spi</artifactId>
     </dependency>
-
+    <!-- Jaxb builder tests -->
     <dependency>
+      <groupId>org.jboss.microcontainer</groupId>
+      <artifactId>jboss-container</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>org.jboss</groupId>
       <artifactId>jboss-test</artifactId>
       <exclusions>

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractBeanMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractBeanMetaData.java	2008-01-05 21:39:21 UTC (rev 68639)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractBeanMetaData.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -71,7 +71,7 @@
  * @version $Revision$
  */
 @ManagementObject(properties = ManagementProperties.EXPLICIT) // TODO - explicitly add props we want to manage
- at JBossXmlSchema(namespace="urn:jboss:bean-deployer:2.0", elementFormDefault= XmlNsForm.QUALIFIED)
+ at JBossXmlSchema(namespace="urn:jboss:bean-deployer:2.0", elementFormDefault=XmlNsForm.QUALIFIED)
 @XmlRootElement(name="bean")
 @XmlType(propOrder={"aliases", "annotations", "classLoader", "constructor", "properties", "create", "start", "stop", "destroy", "depends", "demands", "supplies", "installs", "uninstalls", "installCallbacks", "uninstallCallbacks"})
 public class AbstractBeanMetaData extends AbstractFeatureMetaData

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractFeatureMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractFeatureMetaData.java	2008-01-05 21:39:21 UTC (rev 68639)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractFeatureMetaData.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -24,7 +24,6 @@
 import java.io.Serializable;
 import java.util.Iterator;
 import java.util.Set;
-
 import javax.xml.bind.annotation.XmlElement;
 
 import org.jboss.beans.metadata.spi.AnnotationMetaData;
@@ -49,10 +48,10 @@
    private static final long serialVersionUID = 2L;
 
    /** The description */
-   protected String description;
+   private String description;
 
    /** The annotations */
-   protected Set<AnnotationMetaData> annotations;
+   private Set<AnnotationMetaData> annotations;
 
    /**
     * Create a new meta data

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java	2008-01-05 21:39:21 UTC (rev 68639)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -22,9 +22,9 @@
 package org.jboss.beans.metadata.plugins;
 
 import java.util.List;
-
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlAttribute;
 
 import org.jboss.beans.metadata.spi.AutowireType;
 import org.jboss.beans.metadata.spi.MetaDataVisitor;
@@ -126,6 +126,7 @@
       return propertyMetaData;
    }
 
+   @XmlTransient
    public void setPropertyMetaData(AbstractPropertyMetaData propertyMetaData)
    {
       this.propertyMetaData = propertyMetaData;

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractLazyMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractLazyMetaData.java	2008-01-05 21:39:21 UTC (rev 68639)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractLazyMetaData.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -27,10 +27,10 @@
 import java.util.List;
 import java.util.Set;
 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.XmlType;
-import javax.xml.bind.annotation.XmlElement;
 
 import org.jboss.beans.metadata.spi.BeanMetaData;
 import org.jboss.beans.metadata.spi.LazyMetaData;
@@ -97,7 +97,7 @@
       constructor.setParameters(parameters);
       setConstructor(constructor);
 
-      vistor.addDependency(new AbstractDependencyItem(name, beanName, ControllerState.INSTANTIATED, ControllerState.DESCRIBED));
+      vistor.addDependency(new AbstractDependencyItem(getName(), beanName, ControllerState.INSTANTIATED, ControllerState.DESCRIBED));
       super.initialVisit(vistor);
    }
 
@@ -125,7 +125,7 @@
    public void setBeanName(String beanName)
    {
       this.beanName = beanName;
-      if (name == null)
+      if (getName() == null)
          setName(beanName + "Proxy");
    }
 

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractMapMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractMapMetaData.java	2008-01-05 21:39:21 UTC (rev 68639)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractMapMetaData.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -28,18 +28,17 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
-
-import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
 
 import org.jboss.beans.metadata.spi.MetaDataVisitor;
 import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
 import org.jboss.beans.metadata.spi.ValueMetaData;
 import org.jboss.reflect.spi.ClassInfo;
 import org.jboss.reflect.spi.TypeInfo;
-import org.jboss.xb.annotations.JBossXmlNoElements;
-import org.jboss.xb.annotations.JBossXmlChildren;
 import org.jboss.xb.annotations.JBossXmlChild;
+import org.jboss.xb.annotations.JBossXmlChildren;
+import org.jboss.xb.annotations.JBossXmlNoElements;
 
 /**
  * Map metadata.
@@ -60,7 +59,7 @@
    private static final long serialVersionUID = 2L;
 
    /** The map */
-   private HashMap<MetaDataVisitorNode, MetaDataVisitorNode> map = new HashMap<MetaDataVisitorNode, MetaDataVisitorNode>();
+   private Map<MetaDataVisitorNode, MetaDataVisitorNode> map = new HashMap<MetaDataVisitorNode, MetaDataVisitorNode>();
 
    /** The key type */
    protected String keyType;

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractValueFactoryMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractValueFactoryMetaData.java	2008-01-05 21:39:21 UTC (rev 68639)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractValueFactoryMetaData.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -21,13 +21,13 @@
 */
 package org.jboss.beans.metadata.plugins;
 
+import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
-import java.util.ArrayList;
-
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlAttribute;
 
 import org.jboss.beans.metadata.plugins.builder.MutableParameterizedMetaData;
 import org.jboss.beans.metadata.spi.MetaDataVisitor;
@@ -298,6 +298,7 @@
       super.initialVisit(visitor);
    }
 
+   @XmlTransient
    public Iterator<? extends MetaDataVisitorNode> getChildren()
    {
       if (getParameters() != null)

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractValueMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractValueMetaData.java	2008-01-05 21:39:21 UTC (rev 68639)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractValueMetaData.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -25,16 +25,16 @@
 import java.util.Collections;
 import java.util.Iterator;
 import java.util.Stack;
-
+import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
 
 import org.jboss.beans.metadata.spi.MetaDataVisitor;
 import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
 import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.dependency.plugins.JMXObjectNameFix;
 import org.jboss.reflect.spi.TypeInfo;
 import org.jboss.util.JBossObject;
 import org.jboss.util.JBossStringBuilder;
-import org.jboss.dependency.plugins.JMXObjectNameFix;
 import org.jboss.xb.annotations.JBossXmlNoElements;
 
 /**
@@ -131,6 +131,7 @@
       }
    }
 
+   @XmlTransient
    public Iterator<? extends MetaDataVisitorNode> getChildren()
    {
       if (value instanceof MetaDataVisitorNode)

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/MapEntry.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/MapEntry.java	2008-01-05 21:39:21 UTC (rev 68639)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/MapEntry.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -21,6 +21,7 @@
 */
 package org.jboss.beans.metadata.plugins;
 
+import java.util.Map;
 import javax.xml.bind.annotation.XmlType;
 
 import org.jboss.beans.metadata.spi.ValueMetaData;
@@ -33,7 +34,7 @@
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  */
 @XmlType(propOrder= {"key", "value"})
-public class MapEntry
+public class MapEntry implements Map.Entry<ValueMetaData, ValueMetaData>
 {
    /** The key */
    private ValueMetaData key;
@@ -56,8 +57,9 @@
       return value;
    }
 
-   public void setValue(ValueMetaData value)
+   public ValueMetaData setValue(ValueMetaData value)
    {
       this.value = value;
+      return null;
    }
 }
\ No newline at end of file

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/factory/GenericBeanFactoryMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/factory/GenericBeanFactoryMetaData.java	2008-01-05 21:39:21 UTC (rev 68639)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/factory/GenericBeanFactoryMetaData.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -26,21 +26,26 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
-
+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 javax.xml.bind.annotation.XmlElement;
 
 import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractClassLoaderMetaData;
 import org.jboss.beans.metadata.plugins.AbstractConstructorMetaData;
 import org.jboss.beans.metadata.plugins.AbstractDependencyValueMetaData;
 import org.jboss.beans.metadata.plugins.AbstractMapMetaData;
 import org.jboss.beans.metadata.plugins.AbstractParameterMetaData;
 import org.jboss.beans.metadata.plugins.AbstractPropertyMetaData;
 import org.jboss.beans.metadata.plugins.AbstractValueMetaData;
-import org.jboss.beans.metadata.plugins.AbstractClassLoaderMetaData;
-import org.jboss.beans.metadata.spi.*;
+import org.jboss.beans.metadata.spi.ClassLoaderMetaData;
+import org.jboss.beans.metadata.spi.ConstructorMetaData;
+import org.jboss.beans.metadata.spi.LifecycleMetaData;
+import org.jboss.beans.metadata.spi.ParameterMetaData;
+import org.jboss.beans.metadata.spi.PropertyMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
 import org.jboss.kernel.plugins.bootstrap.basic.KernelConstants;
 import org.jboss.kernel.spi.config.KernelConfigurator;
 import org.jboss.xb.annotations.JBossXmlSchema;
@@ -101,6 +106,7 @@
     * 
     * @return the class
     */
+   @XmlTransient
    public String getBeanClass()
    {
       AbstractPropertyMetaData prop = (AbstractPropertyMetaData) getProperty("bean");

Deleted: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/package-info.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/package-info.java	2008-01-05 21:39:21 UTC (rev 68639)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/package-info.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -1,39 +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.
-*/
- at JBossXmlAdaptedTypes
-({
-   @JBossXmlAdaptedType(type=Cardinality.class, valueAdapter=CardinalityValueAdapter.class),
-   @JBossXmlAdaptedType(type=ControllerMode.class, valueAdapter=ControllerModeValueAdapter.class),
-   @JBossXmlAdaptedType(type=ControllerState.class, valueAdapter=ControllerStateValueAdapter.class),
-   @JBossXmlAdaptedType(type=FromContext.class, valueAdapter=FromContextValueAdapter.class),
-   @JBossXmlAdaptedType(type=InjectionOption.class, valueAdapter=InjectionOptionValueAdapter.class),
-   @JBossXmlAdaptedType(type=AutowireType.class, valueAdapter=AutowireTypeValueAdapter.class)
-})
-package org.jboss.beans.metadata.plugins;
-
-import org.jboss.xb.annotations.JBossXmlAdaptedType;
-import org.jboss.xb.annotations.JBossXmlAdaptedTypes;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.ControllerMode;
-import org.jboss.dependency.spi.Cardinality;
-import org.jboss.beans.metadata.spi.AutowireType;
-

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/AliasMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/AliasMetaData.java	2008-01-05 21:39:21 UTC (rev 68639)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/AliasMetaData.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -21,6 +21,8 @@
 */
 package org.jboss.beans.metadata.spi;
 
+import javax.xml.bind.annotation.XmlTransient;
+
 import org.jboss.util.JBossInterface;
 
 /**
@@ -30,5 +32,6 @@
  */
 public interface AliasMetaData extends JBossInterface, MetaDataVisitorNode
 {
+   @XmlTransient
    Object getAliasValue();
 }

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/AnnotationMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/AnnotationMetaData.java	2008-01-05 21:39:21 UTC (rev 68639)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/AnnotationMetaData.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -22,6 +22,7 @@
 package org.jboss.beans.metadata.spi;
 
 import java.lang.annotation.Annotation;
+import javax.xml.bind.annotation.XmlTransient;
 
 import org.jboss.util.JBossInterface;
 
@@ -44,5 +45,6 @@
     * Get the annotation using the thread context classloader
     * @return The annotation instance
     */
+   @XmlTransient
    Annotation getAnnotationInstance();
 }

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/ValueMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/ValueMetaData.java	2008-01-05 21:39:21 UTC (rev 68639)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/ValueMetaData.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -21,8 +21,22 @@
 */
 package org.jboss.beans.metadata.spi;
 
+import org.jboss.beans.metadata.plugins.AbstractArrayMetaData;
+import org.jboss.beans.metadata.plugins.AbstractCollectionMetaData;
+import org.jboss.beans.metadata.plugins.AbstractDependencyValueMetaData;
+import org.jboss.beans.metadata.plugins.AbstractListMetaData;
+import org.jboss.beans.metadata.plugins.AbstractMapMetaData;
+import org.jboss.beans.metadata.plugins.AbstractSetMetaData;
+import org.jboss.beans.metadata.plugins.AbstractValueFactoryMetaData;
+import org.jboss.beans.metadata.plugins.AbstractValueMetaData;
+import org.jboss.beans.metadata.plugins.StringValueMetaData;
+import org.jboss.beans.metadata.plugins.ThisValueMetaData;
 import org.jboss.reflect.spi.TypeInfo;
 import org.jboss.util.JBossInterface;
+import org.jboss.xb.annotations.JBossXmlChild;
+import org.jboss.xb.annotations.JBossXmlGroup;
+import org.jboss.xb.annotations.JBossXmlGroupText;
+import org.jboss.xb.annotations.JBossXmlGroupWildcard;
 
 /**
  * Metadata about a value.
@@ -30,6 +44,21 @@
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision$
  */
+ at JBossXmlGroup
+({
+   @JBossXmlChild(name="array", type=AbstractArrayMetaData.class),
+   @JBossXmlChild(name="collection", type=AbstractCollectionMetaData.class),
+   @JBossXmlChild(name="inject", type=AbstractDependencyValueMetaData.class),
+   @JBossXmlChild(name="list", type=AbstractListMetaData.class),
+   @JBossXmlChild(name="map", type=AbstractMapMetaData.class),
+   @JBossXmlChild(name="null", type=AbstractValueMetaData.class),
+   @JBossXmlChild(name="set", type=AbstractSetMetaData.class),
+   @JBossXmlChild(name="this", type=ThisValueMetaData.class),
+   @JBossXmlChild(name="value", type=StringValueMetaData.class),
+   @JBossXmlChild(name="value-factory", type= AbstractValueFactoryMetaData.class)
+})
+ at JBossXmlGroupText(wrapper= StringValueMetaData.class, property="value")
+ at JBossXmlGroupWildcard(wrapper= AbstractValueMetaData.class, property="value")
 public interface ValueMetaData extends JBossInterface, MetaDataVisitorNode
 {
    /**

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/AbstractKernelDeployment.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/AbstractKernelDeployment.java	2008-01-05 21:39:21 UTC (rev 68639)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/AbstractKernelDeployment.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -69,7 +69,7 @@
  * @version $Revision$
  */
 @ManagementObject(properties = ManagementProperties.EXPLICIT) // TODO - explicitly add props we want to manage 
- at JBossXmlSchema(namespace="urn:jboss:bean-deployer:2.0", elementFormDefault= XmlNsForm.QUALIFIED)
+ at JBossXmlSchema(namespace="urn:jboss:bean-deployer:2.0", elementFormDefault=XmlNsForm.QUALIFIED)
 @XmlRootElement(name="deployment")
 @XmlType(propOrder={"annotations", "classLoader", "beanFactories", "create", "start", "stop", "destroy", "aliases"})
 public class AbstractKernelDeployment extends JBossObject
@@ -262,12 +262,12 @@
       this.scoped = scoped;
    }
 
-   @XmlElement(name="annotation", type= AbstractAnnotationMetaData.class)
    public Set<AnnotationMetaData> getAnnotations()
    {
       return annotations;
    }
 
+   @XmlElement(name="annotation", type=AbstractAnnotationMetaData.class)
    public void setAnnotations(Set<AnnotationMetaData> annotations)
    {
       this.annotations = annotations;

Copied: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/package-info.java (from rev 68636, projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/package-info.java)
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/package-info.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/package-info.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -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.
+*/
+ at JBossXmlAdaptedTypes
+({
+   @JBossXmlAdaptedType(type=Cardinality.class, valueAdapter=CardinalityValueAdapter.class),
+   @JBossXmlAdaptedType(type=ControllerMode.class, valueAdapter=ControllerModeValueAdapter.class),
+   @JBossXmlAdaptedType(type=ControllerState.class, valueAdapter=ControllerStateValueAdapter.class),
+   @JBossXmlAdaptedType(type=FromContext.class, valueAdapter=FromContextValueAdapter.class),
+   @JBossXmlAdaptedType(type=InjectionOption.class, valueAdapter=InjectionOptionValueAdapter.class),
+   @JBossXmlAdaptedType(type=AutowireType.class, valueAdapter=AutowireTypeValueAdapter.class)
+})
+package org.jboss.kernel.plugins.deployment;
+
+import org.jboss.beans.metadata.plugins.AutowireTypeValueAdapter;
+import org.jboss.beans.metadata.plugins.CardinalityValueAdapter;
+import org.jboss.beans.metadata.plugins.ControllerModeValueAdapter;
+import org.jboss.beans.metadata.plugins.ControllerStateValueAdapter;
+import org.jboss.beans.metadata.plugins.FromContext;
+import org.jboss.beans.metadata.plugins.FromContextValueAdapter;
+import org.jboss.beans.metadata.plugins.InjectionOption;
+import org.jboss.beans.metadata.plugins.InjectionOptionValueAdapter;
+import org.jboss.beans.metadata.spi.AutowireType;
+import org.jboss.dependency.spi.Cardinality;
+import org.jboss.dependency.spi.ControllerMode;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.xb.annotations.JBossXmlAdaptedType;
+import org.jboss.xb.annotations.JBossXmlAdaptedTypes;
+

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/AbstractMCTest.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/AbstractMCTest.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/AbstractMCTest.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,285 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.beans.metadata.plugins.AbstractArrayMetaData;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractCollectionMetaData;
+import org.jboss.beans.metadata.plugins.AbstractDependencyValueMetaData;
+import org.jboss.beans.metadata.plugins.AbstractListMetaData;
+import org.jboss.beans.metadata.plugins.AbstractMapMetaData;
+import org.jboss.beans.metadata.plugins.AbstractSetMetaData;
+import org.jboss.beans.metadata.plugins.AbstractValueMetaData;
+import org.jboss.beans.metadata.plugins.StringValueMetaData;
+import org.jboss.beans.metadata.plugins.ThisValueMetaData;
+import org.jboss.beans.metadata.plugins.factory.GenericBeanFactoryMetaData;
+import org.jboss.beans.metadata.spi.AnnotationMetaData;
+import org.jboss.beans.metadata.spi.CallbackMetaData;
+import org.jboss.beans.metadata.spi.DemandMetaData;
+import org.jboss.beans.metadata.spi.DependencyMetaData;
+import org.jboss.beans.metadata.spi.InstallMetaData;
+import org.jboss.beans.metadata.spi.ParameterMetaData;
+import org.jboss.beans.metadata.spi.PropertyMetaData;
+import org.jboss.beans.metadata.spi.SupplyMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.javabean.plugins.jaxb.JavaBean;
+import org.jboss.kernel.plugins.deployment.AbstractKernelDeployment;
+import org.jboss.test.xb.builder.AbstractBuilderTest;
+import org.jboss.xb.binding.JBossXBException;
+
+/**
+ * AbstractMCTest.
+ *
+ * @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 AbstractMCTest extends AbstractBuilderTest
+{
+   public AbstractMCTest(String name)
+   {
+      super(name);
+   }
+
+   protected AbstractKernelDeployment unmarshalDeployment() throws Exception
+   {
+      return unmarshalObject(AbstractKernelDeployment.class, AbstractKernelDeployment.class, JavaBean.class);
+   }
+
+   protected AbstractBeanMetaData unmarshalBean() throws Exception
+   {
+      return unmarshalObject(AbstractBeanMetaData.class, AbstractKernelDeployment.class, JavaBean.class);
+   }
+
+   protected GenericBeanFactoryMetaData unmarshalBeanFactory() throws Exception
+   {
+      return unmarshalObject(GenericBeanFactoryMetaData.class, AbstractKernelDeployment.class, JavaBean.class);
+   }
+
+   protected void assertAnnotations(Set<String> expected, Set<AnnotationMetaData> annotations)
+   {
+      assertNotNull(annotations);
+      assertEquals(expected.size(), annotations.size());
+      HashSet<String> clonedExpected = new HashSet<String>(expected);
+      for (Iterator i = annotations.iterator(); i.hasNext();)
+      {
+         AnnotationMetaData annotation = (AnnotationMetaData) i.next();
+         if (clonedExpected.remove(annotation.getAnnotationInstance().annotationType().getName()) == false)
+            fail("Did not expect " + annotation + " expected " + expected);
+      }
+      if (clonedExpected.size() != 0)
+         fail("Expected " + expected + " got " + annotations);
+   }
+
+   protected void assertProperties(Set<String> expected, Set<PropertyMetaData> properties)
+   {
+      assertNotNull(properties);
+      assertEquals(expected.size(), properties.size());
+      HashSet<String> clonedExpected = new HashSet<String>(expected);
+      for (Iterator i = properties.iterator(); i.hasNext();)
+      {
+         PropertyMetaData property = (PropertyMetaData) i.next();
+         if (clonedExpected.remove(property.getName()) == false)
+            fail("Did not expect " + property + " expected " + expected);
+      }
+      if (clonedExpected.size() != 0)
+         fail("Expected " + expected + " got " + properties);
+   }
+
+   protected void assertDepends(Set<String> expected, Set<DependencyMetaData> depends)
+   {
+      assertNotNull(depends);
+      assertEquals(expected.size(), depends.size());
+      HashSet<String> clonedExpected = new HashSet<String>(expected);
+      for (DependencyMetaData depend : depends)
+      {
+         if (clonedExpected.remove(depend.getDependency()) == false)
+            fail("Did not expect " + depend + " expected " + expected);
+      }
+      if (clonedExpected.size() != 0)
+         fail("Expected " + expected + " got " + depends);
+   }
+
+   protected void assertDemands(Set<String> expected, Set<DemandMetaData> demands)
+   {
+      assertNotNull(demands);
+      assertEquals(expected.size(), demands.size());
+      HashSet<String> clonedExpected = new HashSet<String>(expected);
+      for (DemandMetaData demand : demands)
+      {
+         if (clonedExpected.remove(demand.getDemand()) == false)
+            fail("Did not expect " + demand + " expected " + expected);
+      }
+      if (clonedExpected.size() != 0)
+         fail("Expected " + expected + " got " + demands);
+   }
+
+   protected void assertSupplies(Set<String> expected, Set<SupplyMetaData> supplies)
+   {
+      assertNotNull(supplies);
+      assertEquals(expected.size(), supplies.size());
+      HashSet<String> clonedExpected = new HashSet<String>(expected);
+      for (Iterator i = supplies.iterator(); i.hasNext();)
+      {
+         SupplyMetaData supply = (SupplyMetaData) i.next();
+         if (clonedExpected.remove(supply.getSupply()) == false)
+            fail("Did not expect " + supply + " expected " + expected);
+      }
+      if (clonedExpected.size() != 0)
+         fail("Expected " + expected + " got " + supplies);
+   }
+
+   protected void assertInstalls(List expected, List installs)
+   {
+      assertNotNull(installs);
+      assertEquals(expected.size(), installs.size());
+      for (int i = 0; i < expected.size(); ++i)
+      {
+         InstallMetaData install = (InstallMetaData) installs.get(i);
+         String method = (String) expected.get(i);
+         assertEquals(method, install.getMethodName());
+      }
+   }
+
+   protected void assertCallbacks(List expected, List callbacks)
+   {
+      assertNotNull(callbacks);
+      assertEquals(expected.size(), callbacks.size());
+      for (int i = 0; i < expected.size(); ++i)
+      {
+         CallbackMetaData callback = (CallbackMetaData) callbacks.get(i);
+         String method = (String) expected.get(i);
+         assertEquals(method, callback.getMethodName());
+      }
+   }
+
+   protected void assertParameters(List expected, List parameters)
+   {
+      assertNotNull(parameters);
+      assertEquals(expected.size(), parameters.size());
+      for (int i = 0; i < expected.size(); ++i)
+      {
+         ParameterMetaData parameter = (ParameterMetaData) parameters.get(i);
+         String method = (String) expected.get(i);
+         assertEquals(method, parameter.getType());
+      }
+   }
+
+   protected void assertPlainValue(String expected, ValueMetaData valueMetaData)
+   {
+      assertValue(expected, valueMetaData);
+   }
+
+   protected void assertValue(String expected, ValueMetaData valueMetaData)
+   {
+      assertNotNull(valueMetaData);
+      assertTrue(valueMetaData instanceof StringValueMetaData);
+      Object value = valueMetaData.getUnderlyingValue();
+      assertEquals(expected, value);
+   }
+
+   protected void assertInjection(ValueMetaData value)
+   {
+      assertNotNull(value);
+      assertTrue(value instanceof AbstractDependencyValueMetaData);
+   }
+
+   protected void assertNullValue(ValueMetaData value)
+   {
+      assertNotNull(value);
+      assertTrue(value instanceof AbstractValueMetaData);
+      assertNull(value.getUnderlyingValue());
+   }
+
+   protected void assertWildcard(ValueMetaData value)
+   {
+      assertNotNull(value);
+      assertEquals(AbstractValueMetaData.class, value.getClass());
+      Object wildcard = value.getUnderlyingValue();
+      assertNotNull(wildcard);
+   }
+
+   protected void assertCollection(ValueMetaData value)
+   {
+      assertNotNull(value);
+      assertTrue(value instanceof AbstractCollectionMetaData);
+   }
+
+   protected void assertList(ValueMetaData value)
+   {
+      assertNotNull(value);
+      assertTrue(value instanceof AbstractListMetaData);
+   }
+
+   protected void assertSet(ValueMetaData value)
+   {
+      assertNotNull(value);
+      assertTrue(value instanceof AbstractSetMetaData);
+   }
+
+   protected void assertArray(ValueMetaData value)
+   {
+      assertNotNull(value);
+      assertTrue(value instanceof AbstractArrayMetaData);
+   }
+
+   protected void assertMap(ValueMetaData value)
+   {
+      assertNotNull(value);
+      assertTrue(value instanceof AbstractMapMetaData);
+   }
+
+   protected void assertThis(ValueMetaData value)
+   {
+      assertNotNull(value);
+      assertTrue(value instanceof ThisValueMetaData);
+   }
+
+   protected void checkJBossXBException(Class expected, Throwable throwable)
+   {
+      checkThrowable(JBossXBException.class, throwable);
+      JBossXBException e = (JBossXBException) throwable;
+      checkThrowable(expected, e.getCause());
+   }
+
+   /**
+    * Find the xml
+    *
+    * @param name the name
+    * @return the url of the xml
+    */
+   protected String findXML(String name)
+   {
+      name = getName().substring(4) + ".xml";
+
+      URL url = getClass().getResource(name);
+      if (url == null)
+         fail(name + " not found");
+      return url.toString();
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/AliasJaxbTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/AliasJaxbTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/AliasJaxbTestCase.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,124 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.util.Set;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.factory.GenericBeanFactoryMetaData;
+
+/**
+ * AliasJaxbTestCase.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class AliasJaxbTestCase extends AbstractMCTest
+{
+   public AliasJaxbTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return AliasJaxbTestCase.suite(AliasJaxbTestCase.class);
+   }
+
+   protected Object getAlias() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      Set aliases = bean.getAliases();
+      assertNotNull(aliases);
+      assertEquals(1, aliases.size());
+      Object alias = aliases.iterator().next();
+      assertNotNull(alias);
+      return alias;
+   }
+
+   public void testAlias() throws Exception
+   {
+      Object alias = getAlias();
+      assertEquals("SimpleAlias", alias);
+   }
+
+   /* TODO
+   public void testAliasWithClass() throws Exception
+   {
+      Object alias = getAlias();
+      assertEquals(12345, alias);
+   } */
+
+   /* TODO
+   public void testAliasWithReplace() throws Exception
+   {
+      SecurityManager sm = suspendSecurity();
+      try
+      {
+         System.setProperty("alias.test.name", "SimpleAlias");
+         Object alias = getAlias("AliasWithReplace.xml");
+         assertEquals("XSimpleAliasX", alias);
+      }
+      finally
+      {
+         resumeSecurity(sm);
+      }
+   }
+   */
+
+   /* TODO
+   public void testAliasWithNoReplace() throws Exception
+   {
+      SecurityManager sm = suspendSecurity();
+      try
+      {
+         System.setProperty("alias.test.name", "SimpleAlias");
+         Object alias = getAlias("AliasWithNoReplace.xml");
+         assertEquals("X${alias.test.name}X", alias);
+      }
+      finally
+      {
+         resumeSecurity(sm);
+      }
+   }
+   */
+
+   public void testMultipleAlias() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      Set aliases = bean.getAliases();
+      assertNotNull(aliases);
+      int size = aliases.size();
+      assertTrue(size > 1);
+      for(Object alias : aliases)
+         assertNotNull(alias);
+   }
+
+   public void testAliasWithBeanFactory() throws Exception
+   {
+      GenericBeanFactoryMetaData bean = unmarshalBeanFactory();
+      Set aliases = bean.getAliases();
+      assertNotNull(aliases);
+      assertFalse(aliases.isEmpty());
+   }
+
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/AnnotationJaxbTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/AnnotationJaxbTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/AnnotationJaxbTestCase.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,143 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractAnnotationMetaData;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.spi.ConstructorMetaData;
+import org.jboss.test.kernel.deployment.xml.support.Annotation1;
+import org.jboss.test.kernel.deployment.xml.support.AnnotationWithAttribute;
+import org.jboss.test.kernel.deployment.xml.support.AnnotationWithAttributes;
+
+/**
+ * AnnotationJaxbTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 55527 $
+ */
+public class AnnotationJaxbTestCase extends AbstractMCTest
+{
+   protected AbstractAnnotationMetaData getAnnotation() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      ConstructorMetaData constructor = bean.getConstructor();
+      assertNotNull(constructor);
+      Set annotations = constructor.getAnnotations();
+      assertEquals(1, annotations.size());
+      AbstractAnnotationMetaData annotation = (AbstractAnnotationMetaData) annotations.iterator().next();
+      assertNotNull(annotation);
+      return annotation;
+   }
+   
+   public void testAnnotationSimple() throws Exception
+   {
+      AbstractAnnotationMetaData annotation = getAnnotation();
+      Annotation ann = annotation.getAnnotationInstance();
+      assertEquals(Annotation1.class.getName(), ann.annotationType().getName());
+      assertTrue(ann instanceof Annotation1);
+   }
+   
+   public void testAnnotationWithAttribute() throws Exception
+   {
+      AbstractAnnotationMetaData annotation = getAnnotation();
+      Annotation ann = annotation.getAnnotationInstance();
+      assertEquals(AnnotationWithAttribute.class.getName(), ann.annotationType().getName());
+      assertTrue(ann instanceof AnnotationWithAttribute);
+      AnnotationWithAttribute ann1 = (AnnotationWithAttribute)ann;
+      assertNotNull(ann1.attribute());
+      assertEquals(Long.class, ann1.attribute());
+   }
+   
+   public void testAnnotationWithAttributes() throws Exception
+   {
+      AbstractAnnotationMetaData annotation = getAnnotation();
+      Annotation ann = annotation.getAnnotationInstance();
+      assertEquals(AnnotationWithAttributes.class.getName(), ann.annotationType().getName());
+      assertTrue(ann instanceof AnnotationWithAttributes);
+      AnnotationWithAttributes ann1 = (AnnotationWithAttributes)ann;
+      assertNotNull(ann1.clazz());
+      assertEquals(Integer.class, ann1.clazz());
+      assertNotNull(ann1.integer());
+      assertEquals(100, ann1.integer());
+      assertNotNull(ann1.str());
+      assertEquals("Annotations are nice", ann1.str());
+   }
+
+   /* TODO
+   public void testAnnotationBadNoContent() throws Exception
+   {
+      try
+      {
+         unmarshalBean("AnnotationBadNoContent.xml");
+         fail("Should not be here");
+      }
+      catch (Exception expected)
+      {
+         checkJBossXBException(IllegalArgumentException.class, expected);
+      }
+   }
+   */
+
+   /* TODO
+   public void testAnnotationBadNoContent2() throws Exception
+   {
+      try
+      {
+         unmarshalBean("AnnotationBadNoContent2.xml");
+         fail("Should not be here");
+      }
+      catch (Exception expected)
+      {
+         checkJBossXBException(IllegalArgumentException.class, expected);
+      }
+   }
+   */
+
+   /* TODO
+   public void testAnnotationBadNoLeadingAt() throws Exception
+   {
+      try
+      {
+         unmarshalBean("AnnotationBadNoLeadingAt.xml");
+         fail("Should not be here");
+      }
+      catch (Exception expected)
+      {
+         checkJBossXBException(IllegalArgumentException.class, expected);
+      }
+   }
+   */
+
+   public static Test suite()
+   {
+      return AnnotationJaxbTestCase.suite(AnnotationJaxbTestCase.class);
+   }
+
+   public AnnotationJaxbTestCase(String name)
+   {
+      super(name);
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ArrayJaxbTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ArrayJaxbTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ArrayJaxbTestCase.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,170 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.util.Set;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractArrayMetaData;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.spi.PropertyMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+
+/**
+ * ArrayJaxbTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 40781 $
+ */
+public class ArrayJaxbTestCase extends AbstractMCTest
+{
+   protected AbstractArrayMetaData getCollection() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      Set properties = bean.getProperties();
+      assertNotNull(properties);
+      assertEquals(1, properties.size());
+      PropertyMetaData property = (PropertyMetaData) properties.iterator().next();
+      assertNotNull(property);
+      ValueMetaData value = property.getValue();
+      assertNotNull(property);
+      assertTrue(value instanceof AbstractArrayMetaData);
+      return (AbstractArrayMetaData) value;
+   }
+   
+   public void testArray() throws Exception
+   {
+      AbstractArrayMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+   }
+   
+   public void testArrayWithClass() throws Exception
+   {
+      AbstractArrayMetaData collection = getCollection();
+      assertEquals("CollectionClass", collection.getType());
+      assertNull(collection.getElementType());
+   }
+   
+   public void testArrayWithElementClass() throws Exception
+   {
+      AbstractArrayMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertEquals("ElementClass", collection.getElementType());
+   }
+   
+   public void testArrayWithValue() throws Exception
+   {
+      AbstractArrayMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertValue("Value", getValue(collection));
+   }
+   
+   public void testArrayWithInjection() throws Exception
+   {
+      AbstractArrayMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertInjection(getValue(collection));
+   }
+   
+   public void testArrayWithCollection() throws Exception
+   {
+      AbstractArrayMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertCollection(getValue(collection));
+   }
+   
+   public void testArrayWithList() throws Exception
+   {
+      AbstractArrayMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertList(getValue(collection));
+   }
+   
+   public void testArrayWithSet() throws Exception
+   {
+      AbstractArrayMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertSet(getValue(collection));
+   }
+   
+   public void testArrayWithArray() throws Exception
+   {
+      AbstractArrayMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertArray(getValue(collection));
+   }
+   
+   public void testArrayWithMap() throws Exception
+   {
+      AbstractArrayMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertMap(getValue(collection));
+   }
+   
+   public void testArrayWithNull() throws Exception
+   {
+      AbstractArrayMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertNullValue(getValue(collection));
+   }
+   
+   public void testArrayWithThis() throws Exception
+   {
+      AbstractArrayMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertThis(getValue(collection));
+   }
+   
+   public void testArrayWithWildcard() throws Exception
+   {
+      AbstractArrayMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertWildcard(getValue(collection));
+   }
+   
+   protected ValueMetaData getValue(AbstractArrayMetaData collection)
+   {
+      assertEquals(1, collection.size());
+      return (ValueMetaData) collection.iterator().next();
+   }
+   
+   public static Test suite()
+   {
+      return ArrayJaxbTestCase.suite(ArrayJaxbTestCase.class);
+   }
+
+   public ArrayJaxbTestCase(String name)
+   {
+      super(name);
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/BeanFactoryJaxbTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/BeanFactoryJaxbTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/BeanFactoryJaxbTestCase.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,582 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.factory.GenericBeanFactoryMetaData;
+import org.jboss.dependency.spi.ControllerMode;
+
+/**
+ * BeanFactoryJaxbTestCase
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 62474 $
+ */
+public class BeanFactoryJaxbTestCase extends AbstractMCTest
+{
+   public void testBeanFactoryWithName() throws Exception
+   {
+      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
+      assertEquals("Name1", factory.getName());
+      assertEquals("Dummy", factory.getBean());
+      assertNull(factory.getMode());
+      assertNull(factory.getAnnotations());
+      assertNull(factory.getClassLoader());
+      assertNull(factory.getConstructor());
+      assertNull(factory.getProperties());
+      assertNull(factory.getCreate());
+      assertNull(factory.getStart());
+      assertNull(factory.getDepends());
+      assertNull(factory.getDemands());
+      assertNull(factory.getSupplies());
+      assertNull(factory.getInstalls());
+      assertNull(factory.getUninstalls());
+      assertNull(factory.getInstallCallbacks());
+      assertNull(factory.getUninstallCallbacks());
+   }
+
+   public void testBeanFactoryWithClass() throws Exception
+   {
+      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
+      assertNull(factory.getName());
+      assertEquals(Object.class.getName(), factory.getBean());
+      assertNull(factory.getMode());
+      assertNull(factory.getAnnotations());
+      assertNull(factory.getClassLoader());
+      assertNull(factory.getConstructor());
+      assertNull(factory.getProperties());
+      assertNull(factory.getCreate());
+      assertNull(factory.getStart());
+      assertNull(factory.getDepends());
+      assertNull(factory.getDemands());
+      assertNull(factory.getSupplies());
+      assertNull(factory.getInstalls());
+      assertNull(factory.getUninstalls());
+      assertNull(factory.getInstallCallbacks());
+      assertNull(factory.getUninstallCallbacks());
+   }
+
+   public void testBeanFactoryWithMode() throws Exception
+   {
+      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
+      assertNull(factory.getName());
+      assertEquals("Dummy", factory.getBean());
+      assertEquals(ControllerMode.MANUAL, factory.getMode());
+      assertNull(factory.getAnnotations());
+      assertNull(factory.getClassLoader());
+      assertNull(factory.getConstructor());
+      assertNull(factory.getProperties());
+      assertNull(factory.getCreate());
+      assertNull(factory.getStart());
+      assertNull(factory.getDepends());
+      assertNull(factory.getDemands());
+      assertNull(factory.getSupplies());
+      assertNull(factory.getInstalls());
+      assertNull(factory.getUninstalls());
+      assertNull(factory.getInstallCallbacks());
+      assertNull(factory.getUninstallCallbacks());
+   }
+
+   public void testBeanFactoryWithClassLoader() throws Exception
+   {
+      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
+      assertNull(factory.getName());
+      assertEquals("Dummy", factory.getBean());
+      assertNull(factory.getMode());
+      assertNull(factory.getAnnotations());
+      assertNotNull(factory.getClassLoader());
+      assertNull(factory.getConstructor());
+      assertNull(factory.getProperties());
+      assertNull(factory.getCreate());
+      assertNull(factory.getStart());
+      assertNull(factory.getDepends());
+      assertNull(factory.getDemands());
+      assertNull(factory.getSupplies());
+      assertNull(factory.getInstalls());
+      assertNull(factory.getUninstalls());
+      assertNull(factory.getInstallCallbacks());
+      assertNull(factory.getUninstallCallbacks());
+   }
+
+   public void testBeanFactoryWithConstructor() throws Exception
+   {
+      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
+      assertNull(factory.getName());
+      assertEquals("Dummy", factory.getBean());
+      assertNull(factory.getMode());
+      assertNull(factory.getAnnotations());
+      assertNull(factory.getClassLoader());
+      assertNotNull(factory.getConstructor());
+      assertNull(factory.getProperties());
+      assertNull(factory.getCreate());
+      assertNull(factory.getStart());
+      assertNull(factory.getDepends());
+      assertNull(factory.getDemands());
+      assertNull(factory.getSupplies());
+      assertNull(factory.getInstalls());
+      assertNull(factory.getUninstalls());
+      assertNull(factory.getInstallCallbacks());
+      assertNull(factory.getUninstallCallbacks());
+   }
+
+   public void testBeanFactoryWithProperty() throws Exception
+   {
+      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
+      assertNull(factory.getName());
+      assertEquals("Dummy", factory.getBean());
+      assertNull(factory.getMode());
+      assertNull(factory.getAnnotations());
+      assertNull(factory.getClassLoader());
+      assertNull(factory.getConstructor());
+      assertNotNull(factory.getProperties());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add("Property1");
+      assertProperties(expected, factory.getProperties());
+      assertNull(factory.getCreate());
+      assertNull(factory.getStart());
+      assertNull(factory.getDepends());
+      assertNull(factory.getDemands());
+      assertNull(factory.getSupplies());
+      assertNull(factory.getInstalls());
+      assertNull(factory.getUninstalls());
+      assertNull(factory.getInstallCallbacks());
+      assertNull(factory.getUninstallCallbacks());
+   }
+
+   public void testBeanFactoryWithProperties() throws Exception
+   {
+      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
+      assertNull(factory.getName());
+      assertEquals("Dummy", factory.getBean());
+      assertNull(factory.getMode());
+      assertNull(factory.getAnnotations());
+      assertNull(factory.getClassLoader());
+      assertNull(factory.getConstructor());
+      assertNotNull(factory.getProperties());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add("Property1");
+      expected.add("Property2");
+      expected.add("Property3");
+      assertProperties(expected, factory.getProperties());
+      assertNull(factory.getCreate());
+      assertNull(factory.getStart());
+      assertNull(factory.getDepends());
+      assertNull(factory.getDemands());
+      assertNull(factory.getSupplies());
+      assertNull(factory.getInstalls());
+      assertNull(factory.getUninstalls());
+      assertNull(factory.getInstallCallbacks());
+      assertNull(factory.getUninstallCallbacks());
+   }
+
+   public void testBeanFactoryWithCreate() throws Exception
+   {
+      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
+      assertNull(factory.getName());
+      assertEquals("Dummy", factory.getBean());
+      assertNull(factory.getMode());
+      assertNull(factory.getAnnotations());
+      assertNull(factory.getClassLoader());
+      assertNull(factory.getConstructor());
+      assertNull(factory.getProperties());
+      assertNotNull(factory.getCreate());
+      assertNull(factory.getStart());
+      assertNull(factory.getDepends());
+      assertNull(factory.getDemands());
+      assertNull(factory.getSupplies());
+      assertNull(factory.getInstalls());
+      assertNull(factory.getUninstalls());
+      assertNull(factory.getInstallCallbacks());
+      assertNull(factory.getUninstallCallbacks());
+   }
+
+   public void testBeanFactoryWithStart() throws Exception
+   {
+      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
+      assertNull(factory.getName());
+      assertEquals("Dummy", factory.getBean());
+      assertNull(factory.getMode());
+      assertNull(factory.getAnnotations());
+      assertNull(factory.getClassLoader());
+      assertNull(factory.getConstructor());
+      assertNull(factory.getProperties());
+      assertNull(factory.getCreate());
+      assertNotNull(factory.getStart());
+      assertNull(factory.getDepends());
+      assertNull(factory.getDemands());
+      assertNull(factory.getSupplies());
+      assertNull(factory.getInstalls());
+      assertNull(factory.getUninstalls());
+      assertNull(factory.getInstallCallbacks());
+      assertNull(factory.getUninstallCallbacks());
+   }
+
+   public void testBeanFactoryWithDependency() throws Exception
+   {
+      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
+      assertNull(factory.getName());
+      assertEquals("Dummy", factory.getBean());
+      assertNull(factory.getMode());
+      assertNull(factory.getAnnotations());
+      assertNull(factory.getClassLoader());
+      assertNull(factory.getConstructor());
+      assertNull(factory.getProperties());
+      assertNull(factory.getCreate());
+      assertNull(factory.getStart());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add("Depends1");
+      assertDepends(expected, factory.getDepends());
+      assertNull(factory.getDemands());
+      assertNull(factory.getSupplies());
+      assertNull(factory.getInstalls());
+      assertNull(factory.getUninstalls());
+      assertNull(factory.getInstallCallbacks());
+      assertNull(factory.getUninstallCallbacks());
+   }
+
+   public void testBeanFactoryWithDependencies() throws Exception
+   {
+      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
+      assertNull(factory.getName());
+      assertEquals("Dummy", factory.getBean());
+      assertNull(factory.getMode());
+      assertNull(factory.getAnnotations());
+      assertNull(factory.getClassLoader());
+      assertNull(factory.getConstructor());
+      assertNull(factory.getProperties());
+      assertNull(factory.getCreate());
+      assertNull(factory.getStart());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add("Depends1");
+      expected.add("Depends2");
+      expected.add("Depends3");
+      assertDepends(expected, factory.getDepends());
+      assertNull(factory.getDemands());
+      assertNull(factory.getSupplies());
+      assertNull(factory.getInstalls());
+      assertNull(factory.getUninstalls());
+      assertNull(factory.getInstallCallbacks());
+      assertNull(factory.getUninstallCallbacks());
+   }
+
+   public void testBeanFactoryWithDemand() throws Exception
+   {
+      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
+      assertNull(factory.getName());
+      assertEquals("Dummy", factory.getBean());
+      assertNull(factory.getMode());
+      assertNull(factory.getAnnotations());
+      assertNull(factory.getClassLoader());
+      assertNull(factory.getConstructor());
+      assertNull(factory.getProperties());
+      assertNull(factory.getCreate());
+      assertNull(factory.getStart());
+      assertNull(factory.getDepends());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add("Demand1");
+      assertDemands(expected, factory.getDemands());
+      assertNull(factory.getSupplies());
+      assertNull(factory.getInstalls());
+      assertNull(factory.getUninstalls());
+      assertNull(factory.getInstallCallbacks());
+      assertNull(factory.getUninstallCallbacks());
+   }
+
+   public void testBeanFactoryWithDemands() throws Exception
+   {
+      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
+      assertNull(factory.getName());
+      assertEquals("Dummy", factory.getBean());
+      assertNull(factory.getMode());
+      assertNull(factory.getAnnotations());
+      assertNull(factory.getClassLoader());
+      assertNull(factory.getConstructor());
+      assertNull(factory.getProperties());
+      assertNull(factory.getCreate());
+      assertNull(factory.getStart());
+      assertNull(factory.getDepends());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add("Demand1");
+      expected.add("Demand2");
+      expected.add("Demand3");
+      assertDemands(expected, factory.getDemands());
+      assertNull(factory.getSupplies());
+      assertNull(factory.getInstalls());
+      assertNull(factory.getUninstalls());
+      assertNull(factory.getInstallCallbacks());
+      assertNull(factory.getUninstallCallbacks());
+   }
+
+   public void testBeanFactoryWithSupply() throws Exception
+   {
+      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
+      assertNull(factory.getName());
+      assertEquals("Dummy", factory.getBean());
+      assertNull(factory.getMode());
+      assertNull(factory.getAnnotations());
+      assertNull(factory.getClassLoader());
+      assertNull(factory.getConstructor());
+      assertNull(factory.getProperties());
+      assertNull(factory.getCreate());
+      assertNull(factory.getStart());
+      assertNull(factory.getDepends());
+      assertNull(factory.getDemands());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add("Supply1");
+      assertSupplies(expected, factory.getSupplies());
+      assertNull(factory.getInstalls());
+      assertNull(factory.getUninstalls());
+      assertNull(factory.getInstallCallbacks());
+      assertNull(factory.getUninstallCallbacks());
+   }
+
+   public void testBeanFactoryWithSupplies() throws Exception
+   {
+      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
+      assertNull(factory.getName());
+      assertEquals("Dummy", factory.getBean());
+      assertNull(factory.getMode());
+      assertNull(factory.getAnnotations());
+      assertNull(factory.getClassLoader());
+      assertNull(factory.getConstructor());
+      assertNull(factory.getProperties());
+      assertNull(factory.getCreate());
+      assertNull(factory.getStart());
+      assertNull(factory.getDepends());
+      assertNull(factory.getDemands());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add("Supply1");
+      expected.add("Supply2");
+      expected.add("Supply3");
+      assertSupplies(expected, factory.getSupplies());
+      assertNull(factory.getInstalls());
+      assertNull(factory.getUninstalls());
+      assertNull(factory.getInstallCallbacks());
+      assertNull(factory.getUninstallCallbacks());
+   }
+
+   public void testBeanFactoryWithInstall() throws Exception
+   {
+      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
+      assertNull(factory.getName());
+      assertEquals("Dummy", factory.getBean());
+      assertNull(factory.getMode());
+      assertNull(factory.getAnnotations());
+      assertNull(factory.getClassLoader());
+      assertNull(factory.getConstructor());
+      assertNull(factory.getProperties());
+      assertNull(factory.getCreate());
+      assertNull(factory.getStart());
+      assertNull(factory.getDepends());
+      assertNull(factory.getDemands());
+      assertNull(factory.getSupplies());
+      List<String> expected = new ArrayList<String>();
+      expected.add("Install1");
+      assertInstalls(expected, factory.getInstalls());
+      assertNull(factory.getUninstalls());
+      assertNull(factory.getInstallCallbacks());
+      assertNull(factory.getUninstallCallbacks());
+   }
+
+   public void testBeanFactoryWithInstalls() throws Exception
+   {
+      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
+      assertNull(factory.getName());
+      assertEquals("Dummy", factory.getBean());
+      assertNull(factory.getMode());
+      assertNull(factory.getAnnotations());
+      assertNull(factory.getClassLoader());
+      assertNull(factory.getConstructor());
+      assertNull(factory.getProperties());
+      assertNull(factory.getCreate());
+      assertNull(factory.getStart());
+      assertNull(factory.getDepends());
+      assertNull(factory.getDemands());
+      assertNull(factory.getSupplies());
+      List<String> expected = new ArrayList<String>();
+      expected.add("Install1");
+      expected.add("Install2");
+      expected.add("Install3");
+      assertInstalls(expected, factory.getInstalls());
+      assertNull(factory.getUninstalls());
+      assertNull(factory.getInstallCallbacks());
+      assertNull(factory.getUninstallCallbacks());
+   }
+
+   public void testBeanFactoryWithUninstall() throws Exception
+   {
+      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
+      assertNull(factory.getName());
+      assertEquals("Dummy", factory.getBean());
+      assertNull(factory.getMode());
+      assertNull(factory.getAnnotations());
+      assertNull(factory.getClassLoader());
+      assertNull(factory.getConstructor());
+      assertNull(factory.getProperties());
+      assertNull(factory.getCreate());
+      assertNull(factory.getStart());
+      assertNull(factory.getDepends());
+      assertNull(factory.getDemands());
+      assertNull(factory.getSupplies());
+      assertNull(factory.getInstalls());
+      List<String> expected = new ArrayList<String>();
+      expected.add("Uninstall1");
+      assertInstalls(expected, factory.getUninstalls());
+      assertNull(factory.getInstallCallbacks());
+      assertNull(factory.getUninstallCallbacks());
+   }
+
+   public void testBeanFactoryWithUninstalls() throws Exception
+   {
+      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
+      assertNull(factory.getName());
+      assertEquals("Dummy", factory.getBean());
+      assertNull(factory.getMode());
+      assertNull(factory.getAnnotations());
+      assertNull(factory.getClassLoader());
+      assertNull(factory.getConstructor());
+      assertNull(factory.getProperties());
+      assertNull(factory.getCreate());
+      assertNull(factory.getStart());
+      assertNull(factory.getDepends());
+      assertNull(factory.getDemands());
+      assertNull(factory.getSupplies());
+      assertNull(factory.getInstalls());
+      List<String> expected = new ArrayList<String>();
+      expected.add("Uninstall1");
+      expected.add("Uninstall2");
+      expected.add("Uninstall3");
+      assertInstalls(expected, factory.getUninstalls());
+      assertNull(factory.getInstallCallbacks());
+      assertNull(factory.getUninstallCallbacks());
+   }
+
+   public void testBeanFactoryWithInstallCallback() throws Exception
+   {
+      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
+      assertNull(factory.getName());
+      assertEquals("Dummy", factory.getBean());
+      assertNull(factory.getMode());
+      assertNull(factory.getAnnotations());
+      assertNull(factory.getClassLoader());
+      assertNull(factory.getConstructor());
+      assertNull(factory.getProperties());
+      assertNull(factory.getCreate());
+      assertNull(factory.getStart());
+      assertNull(factory.getDepends());
+      assertNull(factory.getDemands());
+      assertNull(factory.getSupplies());
+      assertNull(factory.getInstalls());
+      assertNull(factory.getUninstalls());
+      List<String> expected = new ArrayList<String>();
+      expected.add("Install1");
+      assertCallbacks(expected, factory.getInstallCallbacks());
+      assertNull(factory.getUninstallCallbacks());
+   }
+
+   public void testBeanFactoryWithInstallCallbacks() throws Exception
+   {
+      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
+      assertNull(factory.getName());
+      assertEquals("Dummy", factory.getBean());
+      assertNull(factory.getMode());
+      assertNull(factory.getAnnotations());
+      assertNull(factory.getClassLoader());
+      assertNull(factory.getConstructor());
+      assertNull(factory.getProperties());
+      assertNull(factory.getCreate());
+      assertNull(factory.getStart());
+      assertNull(factory.getDepends());
+      assertNull(factory.getDemands());
+      assertNull(factory.getSupplies());
+      assertNull(factory.getInstalls());
+      assertNull(factory.getUninstalls());
+      List<String> expected = new ArrayList<String>();
+      expected.add("Install1");
+      expected.add("Install2");
+      expected.add("Install3");
+      assertCallbacks(expected, factory.getInstallCallbacks());
+      assertNull(factory.getUninstallCallbacks());
+   }
+
+   public void testBeanFactoryWithUninstallCallback() throws Exception
+   {
+      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
+      assertNull(factory.getName());
+      assertEquals("Dummy", factory.getBean());
+      assertNull(factory.getMode());
+      assertNull(factory.getAnnotations());
+      assertNull(factory.getClassLoader());
+      assertNull(factory.getConstructor());
+      assertNull(factory.getProperties());
+      assertNull(factory.getCreate());
+      assertNull(factory.getStart());
+      assertNull(factory.getDepends());
+      assertNull(factory.getDemands());
+      assertNull(factory.getSupplies());
+      assertNull(factory.getInstalls());
+      assertNull(factory.getUninstalls());
+      assertNull(factory.getInstallCallbacks());
+      List<String> expected = new ArrayList<String>();
+      expected.add("Uninstall1");
+      assertCallbacks(expected, factory.getUninstallCallbacks());
+   }
+
+   public void testBeanFactoryWithUninstallCallbacks() throws Exception
+   {
+      GenericBeanFactoryMetaData factory = unmarshalBeanFactory();
+      assertNull(factory.getName());
+      assertEquals("Dummy", factory.getBean());
+      assertNull(factory.getMode());
+      assertNull(factory.getAnnotations());
+      assertNull(factory.getClassLoader());
+      assertNull(factory.getConstructor());
+      assertNull(factory.getProperties());
+      assertNull(factory.getCreate());
+      assertNull(factory.getStart());
+      assertNull(factory.getDepends());
+      assertNull(factory.getDemands());
+      assertNull(factory.getSupplies());
+      assertNull(factory.getInstalls());
+      assertNull(factory.getUninstalls());
+      assertNull(factory.getInstallCallbacks());
+      List<String> expected = new ArrayList<String>();
+      expected.add("Uninstall1");
+      expected.add("Uninstall2");
+      expected.add("Uninstall3");
+      assertCallbacks(expected, factory.getUninstallCallbacks());
+   }
+   
+   public static Test suite()
+   {
+      return BeanFactoryJaxbTestCase.suite(BeanFactoryJaxbTestCase.class);
+   }
+
+   public BeanFactoryJaxbTestCase(String name)
+   {
+      super(name);
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/BeanJaxbTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/BeanJaxbTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/BeanJaxbTestCase.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,744 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.dependency.spi.ControllerMode;
+import org.jboss.test.kernel.deployment.xml.support.Annotation1;
+import org.jboss.test.kernel.deployment.xml.support.Annotation2;
+import org.jboss.test.kernel.deployment.xml.support.Annotation3;
+
+/**
+ * BeanJaxbTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 62474 $
+ */
+public class BeanJaxbTestCase extends AbstractMCTest
+{
+   public void testBeanWithName() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertEquals("Name1", bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      assertNull(bean.getDemands());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getUninstalls());
+      assertNull(bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+   }
+
+   public void testBeanWithClass() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals(Object.class.getName(), bean.getBean());
+      assertNull(bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      assertNull(bean.getDemands());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getUninstalls());
+      assertNull(bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+   }
+
+   public void testBeanWithMode() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertEquals(ControllerMode.MANUAL, bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      assertNull(bean.getDemands());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getUninstalls());
+      assertNull(bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+   }
+
+   public void testBeanWithAnnotation() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add(Annotation1.class.getName());
+      assertAnnotations(expected, bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      assertNull(bean.getDemands());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getUninstalls());
+      assertNull(bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+   }
+
+   public void testBeanWithAnnotations() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add(Annotation1.class.getName());
+      expected.add(Annotation2.class.getName());
+      expected.add(Annotation3.class.getName());
+      assertAnnotations(expected, bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      assertNull(bean.getDemands());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getUninstalls());
+      assertNull(bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+   }
+
+   public void testBeanWithClassLoader() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNotNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      assertNull(bean.getDemands());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getUninstalls());
+      assertNull(bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+   }
+
+   public void testBeanWithConstructor() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNotNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      assertNull(bean.getDemands());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getUninstalls());
+      assertNull(bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+   }
+
+   public void testBeanWithProperty() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add("Property1");
+      assertProperties(expected, bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      assertNull(bean.getDemands());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getUninstalls());
+      assertNull(bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+   }
+
+   public void testBeanWithProperties() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add("Property1");
+      expected.add("Property2");
+      expected.add("Property3");
+      assertProperties(expected, bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      assertNull(bean.getDemands());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getUninstalls());
+      assertNull(bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+   }
+
+   public void testBeanWithCreate() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNotNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      assertNull(bean.getDemands());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getUninstalls());
+      assertNull(bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+   }
+
+   public void testBeanWithStart() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNotNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      assertNull(bean.getDemands());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getUninstalls());
+      assertNull(bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+   }
+
+   public void testBeanWithStop() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNotNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      assertNull(bean.getDemands());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getUninstalls());
+      assertNull(bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+   }
+
+   public void testBeanWithDestroy() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNotNull(bean.getDestroy());
+      assertNull(bean.getDemands());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getUninstalls());
+      assertNull(bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+   }
+
+   public void testBeanWithDependency() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add("Depends1");
+      assertDepends(expected, bean.getDepends());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getUninstalls());
+      assertNull(bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+   }
+
+   public void testBeanWithDependencies() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add("Depends1");
+      expected.add("Depends2");
+      expected.add("Depends3");
+      assertDepends(expected, bean.getDepends());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getUninstalls());
+      assertNull(bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+   }
+
+   public void testBeanWithDemand() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add("Demand1");
+      assertDemands(expected, bean.getDemands());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getUninstalls());
+      assertNull(bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+   }
+
+   public void testBeanWithDemands() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add("Demand1");
+      expected.add("Demand2");
+      expected.add("Demand3");
+      assertDemands(expected, bean.getDemands());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getUninstalls());
+      assertNull(bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+   }
+
+   public void testBeanWithSupply() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      assertNull(bean.getDemands());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add("Supply1");
+      assertSupplies(expected, bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getUninstalls());
+      assertNull(bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+   }
+
+   public void testBeanWithSupplies() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      assertNull(bean.getDemands());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add("Supply1");
+      expected.add("Supply2");
+      expected.add("Supply3");
+      assertSupplies(expected, bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getUninstalls());
+      assertNull(bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+   }
+
+   public void testBeanWithInstall() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      assertNull(bean.getDemands());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+      ArrayList<String> expected = new ArrayList<String>();
+      expected.add("Install1");
+      assertInstalls(expected, bean.getInstalls());
+      assertNull(bean.getUninstalls());
+   }
+
+   public void testBeanWithInstalls() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      assertNull(bean.getDemands());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+      ArrayList<String> expected = new ArrayList<String>();
+      expected.add("Install1");
+      expected.add("Install2");
+      expected.add("Install3");
+      assertInstalls(expected, bean.getInstalls());
+      assertNull(bean.getUninstalls());
+   }
+
+   public void testBeanWithUninstall() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      assertNull(bean.getDemands());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+      ArrayList<String> expected = new ArrayList<String>();
+      expected.add("Uninstall1");
+      assertInstalls(expected, bean.getUninstalls());
+   }
+
+   public void testBeanWithUninstalls() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      assertNull(bean.getDemands());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+      ArrayList<String> expected = new ArrayList<String>();
+      expected.add("Uninstall1");
+      expected.add("Uninstall2");
+      expected.add("Uninstall3");
+      assertInstalls(expected, bean.getUninstalls());
+   }
+
+   public void testBeanWithInstallCallback() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      assertNull(bean.getDemands());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getUninstalls());
+      ArrayList<String> expected = new ArrayList<String>();
+      expected.add("Install1");
+      assertCallbacks(expected, bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+   }
+
+   public void testBeanWithInstallCallbacks() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      assertNull(bean.getDemands());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getUninstalls());
+      ArrayList<String> expected = new ArrayList<String>();
+      expected.add("Install1");
+      expected.add("Install2");
+      expected.add("Install3");
+      assertCallbacks(expected, bean.getInstallCallbacks());
+      assertNull(bean.getUninstallCallbacks());
+   }
+
+   public void testBeanWithUninstallCallback() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      assertNull(bean.getDemands());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getUninstalls());
+      assertNull(bean.getInstallCallbacks());
+      ArrayList<String> expected = new ArrayList<String>();
+      expected.add("Uninstall1");
+      assertCallbacks(expected, bean.getUninstallCallbacks());
+   }
+
+   public void testBeanWithUninstallCallbacks() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      assertNull(bean.getName());
+      assertEquals("Dummy", bean.getBean());
+      assertNull(bean.getMode());
+      assertNull(bean.getAnnotations());
+      assertNull(bean.getClassLoader());
+      assertNull(bean.getConstructor());
+      assertNull(bean.getProperties());
+      assertNull(bean.getCreate());
+      assertNull(bean.getStart());
+      assertNull(bean.getStop());
+      assertNull(bean.getDestroy());
+      assertNull(bean.getDemands());
+      assertNull(bean.getSupplies());
+      assertNull(bean.getInstalls());
+      assertNull(bean.getUninstalls());
+      assertNull(bean.getInstallCallbacks());
+      ArrayList<String> expected = new ArrayList<String>();
+      expected.add("Uninstall1");
+      expected.add("Uninstall2");
+      expected.add("Uninstall3");
+      assertCallbacks(expected, bean.getUninstallCallbacks());
+   }
+
+   /* TODO
+   public void testBeanBadNoClassOrConstructor() throws Exception
+   {
+      try
+      {
+         unmarshalBean();
+         fail("Should not be here");
+      }
+      catch (Exception expected)
+      {
+         checkJBossXBException(IllegalArgumentException.class, expected);
+      }
+   }
+   */
+
+   /* TODO
+   public void testBeanBadNoClassOrFactoryMethod() throws Exception
+   {
+      try
+      {
+         unmarshalBean();
+         fail("Should not be here");
+      }
+      catch (Exception expected)
+      {
+         checkJBossXBException(IllegalArgumentException.class, expected);
+      }
+   }
+   */
+
+   /* TODO
+   public void testBeanBadNoClassOrFactory() throws Exception
+   {
+      try
+      {
+         unmarshalBean();
+         fail("Should not be here");
+      }
+      catch (Exception expected)
+      {
+         checkJBossXBException(IllegalArgumentException.class, expected);
+      }
+   }
+   */
+   
+   public static Test suite()
+   {
+      return BeanJaxbTestCase.suite(BeanJaxbTestCase.class);
+   }
+
+   public BeanJaxbTestCase(String name)
+   {
+      super(name);
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/CallbackJaxbTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/CallbackJaxbTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/CallbackJaxbTestCase.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,260 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.util.HashSet;
+import java.util.List;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.spi.CallbackMetaData;
+import org.jboss.dependency.spi.Cardinality;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.test.kernel.deployment.xml.support.Annotation1;
+import org.jboss.test.kernel.deployment.xml.support.Annotation2;
+import org.jboss.test.kernel.deployment.xml.support.Annotation3;
+
+/**
+ * CallbackJaxbTestCase.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class CallbackJaxbTestCase extends AbstractMCTest
+{
+   public CallbackJaxbTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return CallbackJaxbTestCase.suite(CallbackJaxbTestCase.class);
+   }
+
+   protected CallbackMetaData getInstallCallback() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      List<CallbackMetaData> callbacks = bean.getInstallCallbacks();
+      assertNotNull(callbacks);
+      assertEquals(1, callbacks.size());
+      CallbackMetaData callback = callbacks.get(0);
+      assertNotNull(callback);
+      return callback;
+   }
+
+   protected CallbackMetaData getUninstallCallback() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      List<CallbackMetaData> callbacks = bean.getUninstallCallbacks();
+      assertNotNull(callbacks);
+      assertEquals(1, callbacks.size());
+      CallbackMetaData callback = callbacks.get(0);
+      assertNotNull(callback);
+      return callback;
+   }
+
+   public void testCallbackInstallWithProperty() throws Exception
+   {
+      CallbackMetaData install = getInstallCallback();
+      assertEquals("someProperty", install.getProperty());
+      assertEquals(ControllerState.INSTALLED, install.getDependentState());
+      assertNull(install.getAnnotations());
+      assertNull(install.getParameters());
+   }
+
+   public void testCallbackInstallWithMethod() throws Exception
+   {
+      CallbackMetaData install = getInstallCallback();
+      assertNull(install.getProperty());
+      assertEquals(ControllerState.INSTALLED, install.getDependentState());
+      assertEquals("someMethod", install.getMethodName());
+      assertNull(install.getAnnotations());
+      assertNull(install.getParameters());
+   }
+
+   public void testCallbackInstallWithState() throws Exception
+   {
+      CallbackMetaData install = getInstallCallback();
+      assertNull(install.getProperty());
+      assertEquals(ControllerState.CONFIGURED, install.getDependentState());
+      assertEquals("Dummy", install.getMethodName());
+      assertNull(install.getAnnotations());
+      assertNull(install.getParameters());
+   }
+
+   public void testCallbackInstallWithAnnotation() throws Exception
+   {
+      CallbackMetaData install = getInstallCallback();
+      assertNull(install.getProperty());
+      assertEquals(ControllerState.INSTALLED, install.getDependentState());
+      assertEquals("Dummy", install.getMethodName());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add(Annotation1.class.getName());
+      assertAnnotations(expected, install.getAnnotations());
+      assertNull(install.getParameters());
+   }
+
+   public void testCallbackInstallWithAnnotations() throws Exception
+   {
+      CallbackMetaData install = getInstallCallback();
+      assertNull(install.getProperty());
+      assertEquals(ControllerState.INSTALLED, install.getDependentState());
+      assertEquals("Dummy", install.getMethodName());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add(Annotation1.class.getName());
+      expected.add(Annotation2.class.getName());
+      expected.add(Annotation3.class.getName());
+      assertAnnotations(expected, install.getAnnotations());
+      assertNull(install.getParameters());
+   }
+
+   public void testCallbackInstallWithSignature() throws Exception
+   {
+      CallbackMetaData install = getInstallCallback();
+      assertNull(install.getProperty());
+      assertEquals(ControllerState.INSTALLED, install.getDependentState());
+      assertEquals("Dummy", install.getMethodName());
+      assertNull(install.getAnnotations());
+      assertNotNull(install.getSignature());
+      assertEquals("someSignature", install.getSignature());
+   }
+
+   public void testCallbackInstallWithCardinality() throws Exception
+   {
+      CallbackMetaData install = getInstallCallback();
+      assertNull(install.getProperty());
+      assertEquals(ControllerState.INSTALLED, install.getDependentState());
+      assertEquals("Dummy", install.getMethodName());
+      assertNull(install.getAnnotations());
+      assertNotNull(install.getCardinality());
+      assertEquals(install.getCardinality(), Cardinality.ONE_TO_MANY);
+   }
+
+   /* TODO
+   public void testInstallBothMethodProperty() throws Exception
+   {
+      try
+      {
+         unmarshalBean("CallbackInstallBadMethodProperty.xml");
+         fail("Should not be here");
+      }
+      catch (Exception expected)
+      {
+         checkJBossXBException(IllegalArgumentException.class, expected);
+      }
+   }
+   */
+
+   // --- Uninstall
+
+   public void testCallbackUninstallWithProperty() throws Exception
+   {
+      CallbackMetaData install = getUninstallCallback();
+      assertEquals("someProperty", install.getProperty());
+      assertEquals(ControllerState.INSTALLED, install.getDependentState());
+      assertNull(install.getAnnotations());
+      assertNull(install.getParameters());
+   }
+
+   public void testCallbackUninstallWithMethod() throws Exception
+   {
+      CallbackMetaData install = getUninstallCallback();
+      assertNull(install.getProperty());
+      assertEquals(ControllerState.INSTALLED, install.getDependentState());
+      assertEquals("someMethod", install.getMethodName());
+      assertNull(install.getAnnotations());
+      assertNull(install.getParameters());
+   }
+
+   public void testCallbackUninstallWithState() throws Exception
+   {
+      CallbackMetaData install = getUninstallCallback();
+      assertNull(install.getProperty());
+      assertEquals(ControllerState.CONFIGURED, install.getDependentState());
+      assertEquals("Dummy", install.getMethodName());
+      assertNull(install.getAnnotations());
+      assertNull(install.getParameters());
+   }
+
+   public void testCallbackUninstallWithAnnotation() throws Exception
+   {
+      CallbackMetaData install = getUninstallCallback();
+      assertNull(install.getProperty());
+      assertEquals(ControllerState.INSTALLED, install.getDependentState());
+      assertEquals("Dummy", install.getMethodName());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add(Annotation1.class.getName());
+      assertAnnotations(expected, install.getAnnotations());
+      assertNull(install.getParameters());
+   }
+
+   public void testCallbackUninstallWithAnnotations() throws Exception
+   {
+      CallbackMetaData install = getUninstallCallback();
+      assertNull(install.getProperty());
+      assertEquals(ControllerState.INSTALLED, install.getDependentState());
+      assertEquals("Dummy", install.getMethodName());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add(Annotation1.class.getName());
+      expected.add(Annotation2.class.getName());
+      expected.add(Annotation3.class.getName());
+      assertAnnotations(expected, install.getAnnotations());
+      assertNull(install.getParameters());
+   }
+
+   public void testCallbackUninstallWithSignature() throws Exception
+   {
+      CallbackMetaData install = getUninstallCallback();
+      assertNull(install.getProperty());
+      assertEquals(ControllerState.INSTALLED, install.getDependentState());
+      assertEquals("Dummy", install.getMethodName());
+      assertNull(install.getAnnotations());
+      assertNotNull(install.getSignature());
+      assertEquals("someSignature", install.getSignature());
+   }
+
+   public void testCallbackUninstallWithCardinality() throws Exception
+   {
+      CallbackMetaData install = getUninstallCallback();
+      assertNull(install.getProperty());
+      assertEquals(ControllerState.INSTALLED, install.getDependentState());
+      assertEquals("Dummy", install.getMethodName());
+      assertNull(install.getAnnotations());
+      assertNotNull(install.getCardinality());
+      assertEquals(install.getCardinality(), Cardinality.fromString("2..10"));
+   }
+
+   /* TODO
+   public void testUninstallBothMethodProperty() throws Exception
+   {
+      try
+      {
+         unmarshalBean("CallbackUninstallBadMethodProperty.xml");
+         fail("Should not be here");
+      }
+      catch (Exception expected)
+      {
+         checkJBossXBException(IllegalArgumentException.class, expected);
+      }
+   }
+   */
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ClassLoaderJaxbTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ClassLoaderJaxbTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ClassLoaderJaxbTestCase.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,94 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.ClassLoaderMetaData;
+import org.jboss.kernel.plugins.deployment.AbstractKernelDeployment;
+
+/**
+ * ClassLoaderJaxbTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 56471 $
+ */
+public class ClassLoaderJaxbTestCase extends AbstractMCTest
+{
+   protected ClassLoaderMetaData getClassLoader() throws Exception
+   {
+      AbstractKernelDeployment deployment = unmarshalDeployment();
+      ClassLoaderMetaData classLoader = deployment.getClassLoader();
+      assertNotNull(classLoader);
+      return classLoader;
+   }
+
+   public void testClassLoaderWithBean() throws Exception
+   {
+      ClassLoaderMetaData classLoader = getClassLoader();
+      assertNotNull(classLoader.getClassLoader());
+      assertTrue(classLoader.getClassLoader() instanceof BeanMetaData);
+   }
+
+   public void testClassLoaderWithInject() throws Exception
+   {
+      ClassLoaderMetaData classLoader = getClassLoader();
+      assertInjection(classLoader.getClassLoader());
+   }
+
+   public void testClassLoaderWithNull() throws Exception
+   {
+      ClassLoaderMetaData classLoader = getClassLoader();
+      assertNullValue(classLoader.getClassLoader());
+   }
+
+   public void testClassLoaderWithWildcard() throws Exception
+   {
+      ClassLoaderMetaData classLoader = getClassLoader();
+      assertWildcard(classLoader.getClassLoader());
+   }
+
+   /* TODO
+   public void testClassLoaderBadNoValue() throws Exception
+   {
+      try
+      {
+         unmarshalDeployment("ClassLoaderBadNoValue.xml");
+         fail("Should not be here");
+      }
+      catch (Exception expected)
+      {
+         checkJBossXBException(IllegalArgumentException.class, expected);
+      }
+   }
+   */
+
+   public static Test suite()
+   {
+      return ClassLoaderJaxbTestCase.suite(ClassLoaderJaxbTestCase.class);
+   }
+
+   public ClassLoaderJaxbTestCase(String name)
+   {
+      super(name);
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/CollectionJaxbTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/CollectionJaxbTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/CollectionJaxbTestCase.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,170 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.util.Set;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractCollectionMetaData;
+import org.jboss.beans.metadata.spi.PropertyMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+
+/**
+ * CollectionJaxbTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 40781 $
+ */
+public class CollectionJaxbTestCase extends AbstractMCTest
+{
+   protected AbstractCollectionMetaData getCollection() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      Set properties = bean.getProperties();
+      assertNotNull(properties);
+      assertEquals(1, properties.size());
+      PropertyMetaData property = (PropertyMetaData) properties.iterator().next();
+      assertNotNull(property);
+      ValueMetaData value = property.getValue();
+      assertNotNull(property);
+      assertTrue(value instanceof AbstractCollectionMetaData);
+      return (AbstractCollectionMetaData) value;
+   }
+   
+   public void testCollection() throws Exception
+   {
+      AbstractCollectionMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+   }
+   
+   public void testCollectionWithClass() throws Exception
+   {
+      AbstractCollectionMetaData collection = getCollection();
+      assertEquals("CollectionClass", collection.getType());
+      assertNull(collection.getElementType());
+   }
+   
+   public void testCollectionWithElementClass() throws Exception
+   {
+      AbstractCollectionMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertEquals("ElementClass", collection.getElementType());
+   }
+   
+   public void testCollectionWithValue() throws Exception
+   {
+      AbstractCollectionMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertValue("Value", getValue(collection));
+   }
+   
+   public void testCollectionWithInjection() throws Exception
+   {
+      AbstractCollectionMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertInjection(getValue(collection));
+   }
+   
+   public void testCollectionWithCollection() throws Exception
+   {
+      AbstractCollectionMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertCollection(getValue(collection));
+   }
+   
+   public void testCollectionWithList() throws Exception
+   {
+      AbstractCollectionMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertList(getValue(collection));
+   }
+   
+   public void testCollectionWithSet() throws Exception
+   {
+      AbstractCollectionMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertSet(getValue(collection));
+   }
+   
+   public void testCollectionWithArray() throws Exception
+   {
+      AbstractCollectionMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertArray(getValue(collection));
+   }
+   
+   public void testCollectionWithMap() throws Exception
+   {
+      AbstractCollectionMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertMap(getValue(collection));
+   }
+   
+   public void testCollectionWithNull() throws Exception
+   {
+      AbstractCollectionMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertNullValue(getValue(collection));
+   }
+   
+   public void testCollectionWithThis() throws Exception
+   {
+      AbstractCollectionMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertThis(getValue(collection));
+   }
+   
+   public void testCollectionWithWildcard() throws Exception
+   {
+      AbstractCollectionMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertWildcard(getValue(collection));
+   }
+   
+   protected ValueMetaData getValue(AbstractCollectionMetaData collection)
+   {
+      assertEquals(1, collection.size());
+      return (ValueMetaData) collection.iterator().next();
+   }
+   
+   public static Test suite()
+   {
+      return CollectionJaxbTestCase.suite(CollectionJaxbTestCase.class);
+   }
+
+   public CollectionJaxbTestCase(String name)
+   {
+      super(name);
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ConstructorJaxbTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ConstructorJaxbTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ConstructorJaxbTestCase.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,279 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.ConstructorMetaData;
+import org.jboss.test.kernel.deployment.xml.support.Annotation1;
+import org.jboss.test.kernel.deployment.xml.support.Annotation2;
+import org.jboss.test.kernel.deployment.xml.support.Annotation3;
+
+/**
+ * ConstructorJaxbTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 56471 $
+ */
+public class ConstructorJaxbTestCase extends AbstractMCTest
+{
+   protected ConstructorMetaData getConstructor() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      ConstructorMetaData constructor = bean.getConstructor();
+      assertNotNull(constructor);
+      return constructor;
+   }
+
+   public void testConstructor() throws Exception
+   {
+      ConstructorMetaData constructor = getConstructor();
+      assertNull(constructor.getFactoryClass());
+      assertNull(constructor.getFactoryMethod());
+      assertNull(constructor.getAnnotations());
+      assertNull(constructor.getFactory());
+      assertNull(constructor.getParameters());
+      assertNull(constructor.getValue());
+   }
+
+   public void testConstructorWithBean() throws Exception
+   {
+      ConstructorMetaData constructor = getConstructor();
+      assertNull(constructor.getFactoryClass());
+      assertNull(constructor.getFactoryMethod());
+      assertNull(constructor.getAnnotations());
+      assertNull(constructor.getFactory());
+      assertNull(constructor.getParameters());
+      assertNotNull(constructor.getValue());
+      assertTrue(constructor.getValue() instanceof BeanMetaData);
+   }
+
+   public void testConstructorWithFactoryClass() throws Exception
+   {
+      ConstructorMetaData constructor = getConstructor();
+      assertEquals("FactoryClass", constructor.getFactoryClass());
+      assertEquals("Dummy", constructor.getFactoryMethod());
+      assertNull(constructor.getAnnotations());
+      assertNull(constructor.getFactory());
+      assertNull(constructor.getParameters());
+      assertNull(constructor.getValue());
+   }
+
+   public void testConstructorWithFactoryMethod() throws Exception
+   {
+      ConstructorMetaData constructor = getConstructor();
+      assertEquals("Dummy", constructor.getFactoryClass());
+      assertEquals("FactoryMethod", constructor.getFactoryMethod());
+      assertNull(constructor.getAnnotations());
+      assertNull(constructor.getFactory());
+      assertNull(constructor.getParameters());
+      assertNull(constructor.getValue());
+   }
+
+   public void testConstructorWithAnnotation() throws Exception
+   {
+      ConstructorMetaData constructor = getConstructor();
+      assertNull(constructor.getFactoryClass());
+      assertNull(constructor.getFactoryMethod());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add(Annotation1.class.getName());
+      assertAnnotations(expected, constructor.getAnnotations());
+      assertNull(constructor.getFactory());
+      assertNull(constructor.getParameters());
+      assertNull(constructor.getValue());
+   }
+
+   public void testConstructorWithAnnotations() throws Exception
+   {
+      ConstructorMetaData constructor = getConstructor();
+      assertNull(constructor.getFactoryClass());
+      assertNull(constructor.getFactoryMethod());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add(Annotation1.class.getName());
+      expected.add(Annotation2.class.getName());
+      expected.add(Annotation3.class.getName());
+      assertAnnotations(expected, constructor.getAnnotations());
+      assertNull(constructor.getFactory());
+      assertNull(constructor.getParameters());
+      assertNull(constructor.getValue());
+   }
+
+   public void testConstructorWithFactory() throws Exception
+   {
+      ConstructorMetaData constructor = getConstructor();
+      assertNull(constructor.getFactoryClass());
+      assertEquals("Dummy", constructor.getFactoryMethod());
+      assertNull(constructor.getAnnotations());
+      assertNotNull(constructor.getFactory());
+      assertNull(constructor.getParameters());
+      assertNull(constructor.getValue());
+   }
+
+   public void testConstructorWithParameter() throws Exception
+   {
+      ConstructorMetaData constructor = getConstructor();
+      assertNull(constructor.getFactoryClass());
+      assertNull(constructor.getFactoryMethod());
+      assertNull(constructor.getAnnotations());
+      assertNull(constructor.getFactory());
+      ArrayList<String> expected = new ArrayList<String>();
+      expected.add("Parameter1");
+      assertParameters(expected, constructor.getParameters());
+      assertNull(constructor.getValue());
+   }
+
+   public void testConstructorWithParameters() throws Exception
+   {
+      ConstructorMetaData constructor = getConstructor();
+      assertNull(constructor.getFactoryClass());
+      assertNull(constructor.getFactoryMethod());
+      assertNull(constructor.getAnnotations());
+      assertNull(constructor.getFactory());
+      ArrayList<String> expected = new ArrayList<String>();
+      expected.add("Parameter1");
+      expected.add("Parameter2");
+      expected.add("Parameter3");
+      assertParameters(expected, constructor.getParameters());
+      assertNull(constructor.getValue());
+   }
+
+   public void testConstructorWithValue() throws Exception
+   {
+      ConstructorMetaData constructor = getConstructor();
+      assertNull(constructor.getFactoryClass());
+      assertNull(constructor.getFactoryMethod());
+      assertNull(constructor.getAnnotations());
+      assertNull(constructor.getFactory());
+      assertNull(constructor.getParameters());
+      assertValue("Value", constructor.getValue());
+   }
+
+   public void testConstructorWithCollection() throws Exception
+   {
+      ConstructorMetaData constructor = getConstructor();
+      assertNull(constructor.getFactoryClass());
+      assertNull(constructor.getFactoryMethod());
+      assertNull(constructor.getAnnotations());
+      assertNull(constructor.getFactory());
+      assertNull(constructor.getParameters());
+      assertCollection(constructor.getValue());
+   }
+
+   public void testConstructorWithList() throws Exception
+   {
+      ConstructorMetaData constructor = getConstructor();
+      assertNull(constructor.getFactoryClass());
+      assertNull(constructor.getFactoryMethod());
+      assertNull(constructor.getAnnotations());
+      assertNull(constructor.getFactory());
+      assertNull(constructor.getParameters());
+      assertList(constructor.getValue());
+   }
+
+   public void testConstructorWithSet() throws Exception
+   {
+      ConstructorMetaData constructor = getConstructor();
+      assertNull(constructor.getFactoryClass());
+      assertNull(constructor.getFactoryMethod());
+      assertNull(constructor.getAnnotations());
+      assertNull(constructor.getFactory());
+      assertNull(constructor.getParameters());
+      assertSet(constructor.getValue());
+   }
+
+   public void testConstructorWithArray() throws Exception
+   {
+      ConstructorMetaData constructor = getConstructor();
+      assertNull(constructor.getFactoryClass());
+      assertNull(constructor.getFactoryMethod());
+      assertNull(constructor.getAnnotations());
+      assertNull(constructor.getFactory());
+      assertNull(constructor.getParameters());
+      assertArray(constructor.getValue());
+   }
+
+   public void testConstructorWithMap() throws Exception
+   {
+      ConstructorMetaData constructor = getConstructor();
+      assertNull(constructor.getFactoryClass());
+      assertNull(constructor.getFactoryMethod());
+      assertNull(constructor.getAnnotations());
+      assertNull(constructor.getFactory());
+      assertNull(constructor.getParameters());
+      assertMap(constructor.getValue());
+   }
+
+   public void testConstructorWithWildcard() throws Exception
+   {
+      ConstructorMetaData constructor = getConstructor();
+      assertNull(constructor.getFactoryClass());
+      assertNull(constructor.getFactoryMethod());
+      assertNull(constructor.getAnnotations());
+      assertNull(constructor.getFactory());
+      assertNull(constructor.getParameters());
+      assertWildcard(constructor.getValue());
+   }
+   
+   /* TODO
+   public void testConstructorBadFactoryClassNoFactoryMethod() throws Exception
+   {
+      try
+      {
+         unmarshalBean("ConstructorBadFactoryClassNoFactoryMethod.xml");
+         fail("Should not be here");
+      }
+      catch (Exception expected)
+      {
+         checkJBossXBException(IllegalArgumentException.class, expected);
+      }
+   }
+   */
+
+   /* TODO
+   public void testConstructorBadFactoryNoFactoryMethod() throws Exception
+   {
+      try
+      {
+         unmarshalBean("ConstructorBadFactoryNoFactoryMethod.xml");
+         fail("Should not be here");
+      }
+      catch (Exception expected)
+      {
+         checkJBossXBException(IllegalArgumentException.class, expected);
+      }
+   }
+   */
+
+   public static Test suite()
+   {
+      return ConstructorJaxbTestCase.suite(ConstructorJaxbTestCase.class);
+   }
+
+   public ConstructorJaxbTestCase(String name)
+   {
+      super(name);
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/DemandJaxbTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/DemandJaxbTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/DemandJaxbTestCase.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,88 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.util.Set;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractDemandMetaData;
+import org.jboss.dependency.spi.ControllerState;
+
+/**
+ * Demand TestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 40800 $
+ */
+public class DemandJaxbTestCase extends AbstractMCTest
+{
+   protected AbstractDemandMetaData getDemand() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      Set demands = bean.getDemands();
+      assertNotNull(demands);
+      assertEquals(1, demands.size());
+      AbstractDemandMetaData demand = (AbstractDemandMetaData) demands.iterator().next();
+      assertNotNull(demand);
+      return demand;
+   }
+   
+   public void testDemand() throws Exception
+   {
+      AbstractDemandMetaData demand = getDemand();
+      assertEquals("Demand", demand.getDemand());
+      assertEquals(ControllerState.DESCRIBED, demand.getWhenRequired());
+   }
+   
+   public void testDemandWithWhenRequired() throws Exception
+   {
+      AbstractDemandMetaData demand = getDemand();
+      assertEquals("Demand", demand.getDemand());
+      assertEquals(ControllerState.CONFIGURED, demand.getWhenRequired());
+   }
+
+   /* TODO
+   public void testDemandBadNoValue() throws Exception
+   {
+      try
+      {
+         unmarshalBean("DemandBadNoValue.xml");
+         fail("Should not be here");
+      }
+      catch (Exception expected)
+      {
+         checkJBossXBException(IllegalArgumentException.class, expected);
+      }
+   }
+   */
+
+   public static Test suite()
+   {
+      return DemandJaxbTestCase.suite(DemandJaxbTestCase.class);
+   }
+
+   public DemandJaxbTestCase(String name)
+   {
+      super(name);
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/DependencyJaxbTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/DependencyJaxbTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/DependencyJaxbTestCase.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,80 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.util.Set;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractDependencyMetaData;
+import org.jboss.beans.metadata.spi.DependencyMetaData;
+
+/**
+ * DependencyJaxbTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 55527 $
+ */
+public class DependencyJaxbTestCase extends AbstractMCTest
+{
+   protected AbstractDependencyMetaData getDependency() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      Set<DependencyMetaData> dependencies = bean.getDepends();
+      assertNotNull(dependencies);
+      assertEquals(1, dependencies.size());
+      AbstractDependencyMetaData dependency = (AbstractDependencyMetaData) dependencies.iterator().next();
+      assertNotNull(dependency);
+      return dependency;
+   }
+   
+   public void testDependency() throws Exception
+   {
+      AbstractDependencyMetaData dependency = getDependency();
+      assertEquals("Dependency", dependency.getDependency());
+   }
+
+   /* TODO
+   public void testDependencyBadNoValue() throws Exception
+   {
+      try
+      {
+         unmarshalBean("DependencyBadNoValue.xml");
+         fail("Should not be here");
+      }
+      catch (Exception expected)
+      {
+         checkJBossXBException(IllegalArgumentException.class, expected);
+      }
+   }
+   */
+
+   public static Test suite()
+   {
+      return DependencyJaxbTestCase.suite(DependencyJaxbTestCase.class);
+   }
+
+   public DependencyJaxbTestCase(String name)
+   {
+      super(name);
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/DeploymentJaxbTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/DeploymentJaxbTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/DeploymentJaxbTestCase.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,243 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.util.List;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaDataFactory;
+import org.jboss.kernel.plugins.deployment.AbstractKernelDeployment;
+import org.jboss.test.kernel.deployment.xml.support.TestBeanMetaDataFactory;
+import org.jboss.test.kernel.deployment.xml.support.TestBeanMetaDataFactory1;
+import org.jboss.test.kernel.deployment.xml.support.TestBeanMetaDataFactory2;
+
+/**
+ * DeploymentJaxbTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 56476 $
+ */
+public class DeploymentJaxbTestCase extends AbstractMCTest
+{
+   public void testDeployment() throws Exception
+   {
+      AbstractKernelDeployment deployment = unmarshalDeployment();
+      assertNull(deployment.getName());
+      assertNull(deployment.getClassLoader());
+      assertNull(deployment.getBeans());
+   }
+
+   public void testDeploymentWithName() throws Exception
+   {
+      AbstractKernelDeployment deployment = unmarshalDeployment();
+      assertEquals("SimpleDeployment", deployment.getName());
+      assertNull(deployment.getClassLoader());
+      assertNull(deployment.getBeans());
+   }
+
+   public void testDeploymentWithClassLoader() throws Exception
+   {
+      AbstractKernelDeployment deployment = unmarshalDeployment();
+      assertEquals("SimpleDeployment", deployment.getName());
+      assertNotNull(deployment.getClassLoader());
+      assertNull(deployment.getBeans());
+   }
+
+   public void testDeploymentWithBean() throws Exception
+   {
+      AbstractKernelDeployment deployment = unmarshalDeployment();
+      assertEquals("SimpleDeployment", deployment.getName());
+      assertNull(deployment.getClassLoader());
+      List beans = deployment.getBeans();
+      assertNotNull(beans);
+      assertEquals(1, beans.size());
+      BeanMetaData bean = (BeanMetaData) beans.get(0);
+      assertNotNull(bean);
+      assertEquals("Bean1", bean.getName());
+      assertEquals(Object.class.getName(), bean.getBean());
+   }
+
+   public void testDeploymentWithMultipleBeans() throws Exception
+   {
+      AbstractKernelDeployment deployment = unmarshalDeployment();
+      assertEquals("SimpleDeployment", deployment.getName());
+      assertNull(deployment.getClassLoader());
+      List beans = deployment.getBeans();
+      assertNotNull(beans);
+      assertEquals(3, beans.size());
+      BeanMetaData bean = (BeanMetaData) beans.get(0);
+      assertNotNull(bean);
+      assertEquals("Bean1", bean.getName());
+      assertEquals(Object.class.getName(), bean.getBean());
+      bean = (BeanMetaData) beans.get(1);
+      assertNotNull(bean);
+      assertEquals("Bean2", bean.getName());
+      assertEquals(Object.class.getName(), bean.getBean());
+      bean = (BeanMetaData) beans.get(2);
+      assertNotNull(bean);
+      assertEquals("Bean3", bean.getName());
+      assertEquals(Object.class.getName(), bean.getBean());
+   }
+
+   public void testDeploymentWithBeanFactory() throws Exception
+   {
+      AbstractKernelDeployment deployment = unmarshalDeployment();
+      assertEquals("SimpleDeployment", deployment.getName());
+      assertNull(deployment.getClassLoader());
+      List beans = deployment.getBeans();
+      assertNotNull(beans);
+      assertEquals(1, beans.size());
+      BeanMetaData bean = (BeanMetaData) beans.get(0);
+      assertNotNull(bean);
+      assertEquals("Bean1", bean.getName());
+      assertEquals("GenericBeanFactory", bean.getBean());
+   }
+
+   public void testDeploymentWithMultipleBeanFactorys() throws Exception
+   {
+      AbstractKernelDeployment deployment = unmarshalDeployment();
+      assertEquals("SimpleDeployment", deployment.getName());
+      assertNull(deployment.getClassLoader());
+      List beans = deployment.getBeans();
+      assertNotNull(beans);
+      assertEquals(3, beans.size());
+      BeanMetaData bean = (BeanMetaData) beans.get(0);
+      assertNotNull(bean);
+      assertEquals("Bean1", bean.getName());
+      assertEquals("GenericBeanFactory", bean.getBean());
+      bean = (BeanMetaData) beans.get(1);
+      assertNotNull(bean);
+      assertEquals("Bean2", bean.getName());
+      assertEquals("GenericBeanFactory", bean.getBean());
+      bean = (BeanMetaData) beans.get(2);
+      assertNotNull(bean);
+      assertEquals("Bean3", bean.getName());
+      assertEquals("GenericBeanFactory", bean.getBean());
+   }
+
+   public void testDeploymentWithMultipleBeanMetaDataFactorys() throws Exception
+   {
+      AbstractKernelDeployment deployment = unmarshalDeployment();
+      assertEquals("SimpleDeployment", deployment.getName());
+      assertNull(deployment.getClassLoader());
+      List beanFactories = deployment.getBeanFactories();
+      assertNotNull(beanFactories);
+      assertEquals(3, beanFactories.size());
+      BeanMetaDataFactory factory = (BeanMetaDataFactory) beanFactories.get(0);
+      assertEquals(TestBeanMetaDataFactory.class.getName(), factory.getClass().getName());
+      factory = (BeanMetaDataFactory) beanFactories.get(1);
+      assertEquals(TestBeanMetaDataFactory1.class.getName(), factory.getClass().getName());
+      factory = (BeanMetaDataFactory) beanFactories.get(2);
+      assertEquals(TestBeanMetaDataFactory2.class.getName(), factory.getClass().getName());
+      List beans = deployment.getBeans();
+      assertNotNull(beans);
+      assertEquals(6, beans.size());
+      BeanMetaData bean = (BeanMetaData) beans.get(0);
+      assertNotNull(bean);
+      assertEquals("Bean1", bean.getBean());
+      bean = (BeanMetaData) beans.get(1);
+      assertNotNull(bean);
+      assertEquals("Bean2", bean.getBean());
+      bean = (BeanMetaData) beans.get(2);
+      assertNotNull(bean);
+      assertEquals("Bean3", bean.getBean());
+      bean = (BeanMetaData) beans.get(3);
+      assertNotNull(bean);
+      assertEquals("Bean4", bean.getBean());
+      bean = (BeanMetaData) beans.get(4);
+      assertNotNull(bean);
+      assertEquals("Bean5", bean.getBean());
+      bean = (BeanMetaData) beans.get(5);
+      assertNotNull(bean);
+      assertEquals("Bean6", bean.getBean());
+   }
+
+   public void testDeploymentWithBeanMetaDataFactory() throws Exception
+   {
+      AbstractKernelDeployment deployment = unmarshalDeployment();
+      assertEquals("SimpleDeployment", deployment.getName());
+      assertNull(deployment.getClassLoader());
+      List beanFactories = deployment.getBeanFactories();
+      assertNotNull(beanFactories);
+      assertEquals(1, beanFactories.size());
+      BeanMetaDataFactory factory = (BeanMetaDataFactory) beanFactories.get(0);
+      assertEquals(TestBeanMetaDataFactory.class.getName(), factory.getClass().getName());
+      List beans = deployment.getBeans();
+      assertNotNull(beans);
+      assertEquals(2, beans.size());
+      BeanMetaData bean = (BeanMetaData) beans.get(0);
+      assertNotNull(bean);
+      assertEquals("Bean1", bean.getBean());
+      bean = (BeanMetaData) beans.get(1);
+      assertNotNull(bean);
+      assertEquals("Bean2", bean.getBean());
+   }
+
+   public void testDeploymentWithMixed() throws Exception
+   {
+      AbstractKernelDeployment deployment = unmarshalDeployment();
+      assertEquals("SimpleDeployment", deployment.getName());
+      assertNull(deployment.getClassLoader());
+      List beans = deployment.getBeans();
+      assertNotNull(beans);
+      assertEquals(8, beans.size());
+      BeanMetaData bean = (BeanMetaData) beans.get(0);
+      assertNotNull(bean);
+      assertEquals("Bean1", bean.getName());
+      assertEquals(Object.class.getName(), bean.getBean());
+      bean = (BeanMetaData) beans.get(1);
+      assertNotNull(bean);
+      assertEquals("Bean2", bean.getName());
+      assertEquals("GenericBeanFactory", bean.getBean());
+      bean = (BeanMetaData) beans.get(2);
+      assertNotNull(bean);
+      assertEquals("Bean1", bean.getBean());
+      bean = (BeanMetaData) beans.get(3);
+      assertNotNull(bean);
+      assertEquals("Bean2", bean.getBean());
+      bean = (BeanMetaData) beans.get(4);
+      assertNotNull(bean);
+      assertEquals("Bean3", bean.getName());
+      assertEquals(Object.class.getName(), bean.getBean());
+      bean = (BeanMetaData) beans.get(5);
+      assertNotNull(bean);
+      assertEquals("Bean4", bean.getName());
+      assertEquals("GenericBeanFactory", bean.getBean());
+      bean = (BeanMetaData) beans.get(6);
+      assertNotNull(bean);
+      assertEquals("Bean3", bean.getBean());
+      bean = (BeanMetaData) beans.get(7);
+      assertNotNull(bean);
+      assertEquals("Bean4", bean.getBean());
+   }
+   
+   public static Test suite()
+   {
+      return DeploymentJaxbTestCase.suite(DeploymentJaxbTestCase.class);
+   }
+
+   public DeploymentJaxbTestCase(String name)
+   {
+      super(name);
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/FactoryJaxbTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/FactoryJaxbTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/FactoryJaxbTestCase.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,109 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractDependencyValueMetaData;
+import org.jboss.beans.metadata.plugins.AbstractValueMetaData;
+import org.jboss.beans.metadata.spi.ConstructorMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.dependency.spi.ControllerState;
+
+/**
+ * FactoryJaxbTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 40798 $
+ */
+public class FactoryJaxbTestCase extends AbstractMCTest
+{
+   protected AbstractValueMetaData getFactory() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      ConstructorMetaData constructor = bean.getConstructor();
+      assertNotNull(constructor);
+      ValueMetaData factory = constructor.getFactory();
+      assertNotNull(factory);
+      assertTrue(factory instanceof AbstractValueMetaData);
+      return (AbstractValueMetaData) factory;
+   }
+
+   protected AbstractDependencyValueMetaData getFactoryDependency() throws Exception
+   {
+      return (AbstractDependencyValueMetaData) getFactory();
+   }
+
+   public void testFactoryWithBean() throws Exception
+   {
+      AbstractDependencyValueMetaData dependency = getFactoryDependency();
+      assertEquals("Bean1", dependency.getValue());
+      assertNull(dependency.getProperty());
+      assertEquals(ControllerState.INSTALLED, dependency.getDependentState());
+   }
+
+   public void testFactoryWithProperty() throws Exception
+   {
+      AbstractDependencyValueMetaData dependency = getFactoryDependency();
+      assertEquals("Dummy", dependency.getValue());
+      assertEquals("Property1", dependency.getProperty());
+      assertEquals(ControllerState.INSTALLED, dependency.getDependentState());
+   }
+
+   public void testFactoryWithState() throws Exception
+   {
+      AbstractDependencyValueMetaData dependency = getFactoryDependency();
+      assertEquals("Dummy", dependency.getValue());
+      assertNull(dependency.getProperty());
+      assertEquals(ControllerState.CONFIGURED, dependency.getDependentState());
+   }
+
+   public void testFactoryWithWildcard() throws Exception
+   {
+      assertWildcard(getFactory());
+   }
+
+   /* TODO
+   public void testFactoryBadNoBeanOrWildcard() throws Exception
+   {
+      try
+      {
+         unmarshalBean("FactoryBadNoBeanOrWildcard.xml");
+         fail("Should not be here");
+      }
+      catch (Exception expected)
+      {
+         checkJBossXBException(IllegalArgumentException.class, expected);
+      }
+   }
+   */
+
+   public static Test suite()
+   {
+      return FactoryJaxbTestCase.suite(FactoryJaxbTestCase.class);
+   }
+
+   public FactoryJaxbTestCase(String name)
+   {
+      super(name);
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/InjectionJaxbTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/InjectionJaxbTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/InjectionJaxbTestCase.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,103 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.util.Set;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractDependencyValueMetaData;
+import org.jboss.beans.metadata.spi.PropertyMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.dependency.spi.ControllerState;
+
+/**
+ * InjectionJaxbTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 57133 $
+ */
+public class InjectionJaxbTestCase extends AbstractMCTest
+{
+   protected AbstractDependencyValueMetaData getInjection() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      Set properties = bean.getProperties();
+      assertNotNull(properties);
+      assertEquals(1, properties.size());
+      PropertyMetaData property = (PropertyMetaData) properties.iterator().next();
+      assertNotNull(property);
+      ValueMetaData value = property.getValue();
+      assertNotNull(property);
+      assertTrue(value instanceof AbstractDependencyValueMetaData);
+      return (AbstractDependencyValueMetaData) value;
+   }
+
+   public void testInjectionWithBean() throws Exception
+   {
+      AbstractDependencyValueMetaData dependency = getInjection();
+      assertEquals("Bean1", dependency.getValue());
+      assertNull(dependency.getProperty());
+      assertEquals(ControllerState.INSTALLED, dependency.getDependentState());
+   }
+
+   public void testInjectionWithProperty() throws Exception
+   {
+      AbstractDependencyValueMetaData dependency = getInjection();
+      assertEquals("Dummy", dependency.getValue());
+      assertEquals("Property1", dependency.getProperty());
+      assertEquals(ControllerState.INSTALLED, dependency.getDependentState());
+   }
+
+   public void testInjectionWithState() throws Exception
+   {
+      AbstractDependencyValueMetaData dependency = getInjection();
+      assertEquals("Dummy", dependency.getValue());
+      assertNull(dependency.getProperty());
+      assertEquals(ControllerState.CONFIGURED, dependency.getDependentState());
+   }
+
+   /* TODO
+   public void testInjectionBadNoBean() throws Exception
+   {
+      try
+      {
+         AbstractDependencyValueMetaData dependency = getInjection("InjectionBadNoBean.xml");
+         assertNull(dependency.getValue());                  
+      }
+      catch (Exception expected)
+      {
+         checkJBossXBException(IllegalArgumentException.class, expected);
+      }
+   }
+   */
+
+   public static Test suite()
+   {
+      return InjectionJaxbTestCase.suite(InjectionJaxbTestCase.class);
+   }
+
+   public InjectionJaxbTestCase(String name)
+   {
+      super(name);
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/InstallJaxbTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/InstallJaxbTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/InstallJaxbTestCase.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,161 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.spi.InstallMetaData;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.test.kernel.deployment.xml.support.Annotation1;
+import org.jboss.test.kernel.deployment.xml.support.Annotation2;
+import org.jboss.test.kernel.deployment.xml.support.Annotation3;
+
+/**
+ * InstallJaxbTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 46386 $
+ */
+public class InstallJaxbTestCase extends AbstractMCTest
+{
+   protected InstallMetaData getInstall() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      List installs = bean.getInstalls();
+      assertNotNull(installs);
+      assertEquals(1, installs.size());
+      InstallMetaData install = (InstallMetaData) installs.get(0);
+      assertNotNull(install);
+      return install;
+   }
+
+   public void testInstallWithBean() throws Exception
+   {
+      InstallMetaData install = getInstall();
+      assertEquals("Bean", install.getBean());
+      assertEquals(ControllerState.INSTALLED, install.getDependentState());
+      assertEquals("Dummy", install.getMethodName());
+      assertNull(install.getAnnotations());
+      assertNull(install.getParameters());
+   }
+
+   public void testInstallWithState() throws Exception
+   {
+      InstallMetaData install = getInstall();
+      assertNull(install.getBean());
+      assertEquals(ControllerState.CONFIGURED, install.getDependentState());
+      assertEquals("Dummy", install.getMethodName());
+      assertNull(install.getAnnotations());
+      assertNull(install.getParameters());
+   }
+
+   public void testInstallWithMethod() throws Exception
+   {
+      InstallMetaData install = getInstall();
+      assertNull(install.getBean());
+      assertEquals(ControllerState.INSTALLED, install.getDependentState());
+      assertEquals("Method", install.getMethodName());
+      assertNull(install.getAnnotations());
+      assertNull(install.getParameters());
+   }
+
+   public void testInstallWithAnnotation() throws Exception
+   {
+      InstallMetaData install = getInstall();
+      assertNull(install.getBean());
+      assertEquals(ControllerState.INSTALLED, install.getDependentState());
+      assertEquals("Dummy", install.getMethodName());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add(Annotation1.class.getName());
+      assertAnnotations(expected, install.getAnnotations());
+      assertNull(install.getParameters());
+   }
+
+   public void testInstallWithAnnotations() throws Exception
+   {
+      InstallMetaData install = getInstall();
+      assertNull(install.getBean());
+      assertEquals(ControllerState.INSTALLED, install.getDependentState());
+      assertEquals("Dummy", install.getMethodName());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add(Annotation1.class.getName());
+      expected.add(Annotation2.class.getName());
+      expected.add(Annotation3.class.getName());
+      assertAnnotations(expected, install.getAnnotations());
+      assertNull(install.getParameters());
+   }
+
+   public void testInstallWithParameter() throws Exception
+   {
+      InstallMetaData install = getInstall();
+      assertNull(install.getBean());
+      assertEquals(ControllerState.INSTALLED, install.getDependentState());
+      assertEquals("Dummy", install.getMethodName());
+      assertNull(install.getAnnotations());
+      ArrayList<String> expected = new ArrayList<String>();
+      expected.add("Parameter1");
+      assertParameters(expected, install.getParameters());
+   }
+
+   public void testInstallWithParameters() throws Exception
+   {
+      InstallMetaData install = getInstall();
+      assertNull(install.getBean());
+      assertEquals(ControllerState.INSTALLED, install.getDependentState());
+      assertEquals("Dummy", install.getMethodName());
+      assertNull(install.getAnnotations());
+      ArrayList<String> expected = new ArrayList<String>();
+      expected.add("Parameter1");
+      expected.add("Parameter2");
+      expected.add("Parameter3");
+      assertParameters(expected, install.getParameters());
+   }
+
+   /* TODO
+   public void testInstallBadNoMethod() throws Exception
+   {
+      try
+      {
+         unmarshalBean("InstallBadNoMethod.xml");
+         fail("Should not be here");
+      }
+      catch (Exception expected)
+      {
+         checkJBossXBException(IllegalArgumentException.class, expected);
+      }
+   }
+   */
+
+   public static Test suite()
+   {
+      return InstallJaxbTestCase.suite(InstallJaxbTestCase.class);
+   }
+
+   public InstallJaxbTestCase(String name)
+   {
+      super(name);
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/LifecycleJaxbTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/LifecycleJaxbTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/LifecycleJaxbTestCase.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,128 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.spi.LifecycleMetaData;
+import org.jboss.test.kernel.deployment.xml.support.Annotation1;
+import org.jboss.test.kernel.deployment.xml.support.Annotation2;
+import org.jboss.test.kernel.deployment.xml.support.Annotation3;
+
+/**
+ * LifecycleJaxbTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 63037 $
+ */
+public class LifecycleJaxbTestCase extends AbstractMCTest
+{
+   protected LifecycleMetaData getLifecycle() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      LifecycleMetaData lifecycle = bean.getCreate();
+      assertNotNull(lifecycle);
+      return lifecycle;
+   }
+
+   public void testLifecycle() throws Exception
+   {
+      LifecycleMetaData lifecycle = getLifecycle();
+      assertNull(lifecycle.getMethodName());
+      assertNull(lifecycle.getAnnotations());
+      assertNull(lifecycle.getParameters());
+   }
+
+   public void testLifecycleWithMethod() throws Exception
+   {
+      LifecycleMetaData lifecycle = getLifecycle();
+      assertEquals("Method", lifecycle.getMethodName());
+      assertNull(lifecycle.getAnnotations());
+      assertNull(lifecycle.getParameters());
+   }
+
+   public void testLifecycleWithIgnored() throws Exception
+   {
+      LifecycleMetaData lifecycle = getLifecycle();
+      assertTrue(lifecycle.isIgnored());
+      assertNull(lifecycle.getMethodName());
+      assertNull(lifecycle.getAnnotations());
+      assertNull(lifecycle.getParameters());
+   }
+
+   public void testLifecycleWithAnnotation() throws Exception
+   {
+      LifecycleMetaData lifecycle = getLifecycle();
+      assertNull(lifecycle.getMethodName());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add(Annotation1.class.getName());
+      assertAnnotations(expected, lifecycle.getAnnotations());
+      assertNull(lifecycle.getParameters());
+   }
+
+   public void testLifecycleWithAnnotations() throws Exception
+   {
+      LifecycleMetaData lifecycle = getLifecycle();
+      assertNull(lifecycle.getMethodName());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add(Annotation1.class.getName());
+      expected.add(Annotation2.class.getName());
+      expected.add(Annotation3.class.getName());
+      assertAnnotations(expected, lifecycle.getAnnotations());
+      assertNull(lifecycle.getParameters());
+   }
+
+   public void testLifecycleWithParameter() throws Exception
+   {
+      LifecycleMetaData lifecycle = getLifecycle();
+      assertNull(lifecycle.getMethodName());
+      assertNull(lifecycle.getAnnotations());
+      ArrayList<String> expected = new ArrayList<String>();
+      expected.add("Parameter1");
+      assertParameters(expected, lifecycle.getParameters());
+   }
+
+   public void testLifecycleWithParameters() throws Exception
+   {
+      LifecycleMetaData lifecycle = getLifecycle();
+      assertNull(lifecycle.getMethodName());
+      assertNull(lifecycle.getAnnotations());
+      ArrayList<String> expected = new ArrayList<String>();
+      expected.add("Parameter1");
+      expected.add("Parameter2");
+      expected.add("Parameter3");
+      assertParameters(expected, lifecycle.getParameters());
+   }
+   
+   public static Test suite()
+   {
+      return LifecycleJaxbTestCase.suite(LifecycleJaxbTestCase.class);
+   }
+
+   public LifecycleJaxbTestCase(String name)
+   {
+      super(name);
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ListJaxbTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ListJaxbTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ListJaxbTestCase.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,170 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.util.Set;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractListMetaData;
+import org.jboss.beans.metadata.spi.PropertyMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+
+/**
+ * ListJaxbTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 40781 $
+ */
+public class ListJaxbTestCase extends AbstractMCTest
+{
+   protected AbstractListMetaData getCollection() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      Set properties = bean.getProperties();
+      assertNotNull(properties);
+      assertEquals(1, properties.size());
+      PropertyMetaData property = (PropertyMetaData) properties.iterator().next();
+      assertNotNull(property);
+      ValueMetaData value = property.getValue();
+      assertNotNull(property);
+      assertTrue(value instanceof AbstractListMetaData);
+      return (AbstractListMetaData) value;
+   }
+   
+   public void testList() throws Exception
+   {
+      AbstractListMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+   }
+   
+   public void testListWithClass() throws Exception
+   {
+      AbstractListMetaData collection = getCollection();
+      assertEquals("CollectionClass", collection.getType());
+      assertNull(collection.getElementType());
+   }
+   
+   public void testListWithElementClass() throws Exception
+   {
+      AbstractListMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertEquals("ElementClass", collection.getElementType());
+   }
+   
+   public void testListWithValue() throws Exception
+   {
+      AbstractListMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertValue("Value", getValue(collection));
+   }
+   
+   public void testListWithInjection() throws Exception
+   {
+      AbstractListMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertInjection(getValue(collection));
+   }
+
+   public void testListWithCollection() throws Exception
+   {
+      AbstractListMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertCollection(getValue(collection));
+   }
+   
+   public void testListWithList() throws Exception
+   {
+      AbstractListMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertList(getValue(collection));
+   }
+   
+   public void testListWithSet() throws Exception
+   {
+      AbstractListMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertSet(getValue(collection));
+   }
+   
+   public void testListWithArray() throws Exception
+   {
+      AbstractListMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertArray(getValue(collection));
+   }
+   
+   public void testListWithMap() throws Exception
+   {
+      AbstractListMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertMap(getValue(collection));
+   }
+   
+   public void testListWithNull() throws Exception
+   {
+      AbstractListMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertNullValue(getValue(collection));
+   }
+   
+   public void testListWithThis() throws Exception
+   {
+      AbstractListMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertThis(getValue(collection));
+   }
+   
+   public void testListWithWildcard() throws Exception
+   {
+      AbstractListMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertWildcard(getValue(collection));
+   }
+   
+   protected ValueMetaData getValue(AbstractListMetaData collection)
+   {
+      assertEquals(1, collection.size());
+      return (ValueMetaData) collection.iterator().next();
+   }
+   
+   public static Test suite()
+   {
+      return ListJaxbTestCase.suite(ListJaxbTestCase.class);
+   }
+
+   public ListJaxbTestCase(String name)
+   {
+      super(name);
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/MapJaxbTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/MapJaxbTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/MapJaxbTestCase.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,207 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.util.Set;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractMapMetaData;
+import org.jboss.beans.metadata.spi.PropertyMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+
+/**
+ * MapJaxbTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 40781 $
+ */
+public class MapJaxbTestCase extends AbstractMCTest
+{
+   protected AbstractMapMetaData getMap() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      Set properties = bean.getProperties();
+      assertNotNull(properties);
+      assertEquals(1, properties.size());
+      PropertyMetaData property = (PropertyMetaData) properties.iterator().next();
+      assertNotNull(property);
+      ValueMetaData value = property.getValue();
+      assertNotNull(property);
+      assertTrue(value instanceof AbstractMapMetaData);
+      return (AbstractMapMetaData) value;
+   }
+   
+   public void testMap() throws Exception
+   {
+      AbstractMapMetaData map = getMap();
+      assertNull(map.getType());
+      assertNull(map.getKeyType());
+      assertNull(map.getValueType());
+   }
+   
+   public void testMapWithClass() throws Exception
+   {
+      AbstractMapMetaData map = getMap();
+      assertEquals("MapClass", map.getType());
+      assertNull(map.getKeyType());
+      assertNull(map.getValueType());
+   }
+   
+   public void testMapWithKeyClass() throws Exception
+   {
+      AbstractMapMetaData map = getMap();
+      assertNull(map.getType());
+      assertEquals("KeyClass", map.getKeyType());
+      assertNull(map.getValueType());
+   }
+   
+   public void testMapWithValueClass() throws Exception
+   {
+      AbstractMapMetaData map = getMap();
+      assertNull(map.getType());
+      assertNull(map.getKeyType());
+      assertEquals("ValueClass", map.getValueType());
+   }
+   
+   public void testMapWithValue() throws Exception
+   {
+      AbstractMapMetaData map = getMap();
+      assertNull(map.getType());
+      assertNull(map.getKeyType());
+      assertNull(map.getValueType());
+      assertValue("Key", getKey(map));
+      assertValue("Value", getValue(map));
+   }
+   
+   public void testMapWithInjection() throws Exception
+   {
+      AbstractMapMetaData map = getMap();
+      assertNull(map.getType());
+      assertNull(map.getKeyType());
+      assertNull(map.getValueType());
+      assertInjection(getKey(map));
+      assertInjection(getValue(map));
+   }
+   
+   public void testMapWithCollection() throws Exception
+   {
+      AbstractMapMetaData map = getMap();
+      assertNull(map.getType());
+      assertNull(map.getKeyType());
+      assertNull(map.getValueType());
+      assertCollection(getKey(map));
+      assertCollection(getValue(map));
+   }
+   
+   public void testMapWithList() throws Exception
+   {
+      AbstractMapMetaData map = getMap();
+      assertNull(map.getType());
+      assertNull(map.getKeyType());
+      assertNull(map.getValueType());
+      assertList(getKey(map));
+      assertList(getValue(map));
+   }
+   
+   public void testMapWithSet() throws Exception
+   {
+      AbstractMapMetaData map = getMap();
+      assertNull(map.getType());
+      assertNull(map.getKeyType());
+      assertNull(map.getValueType());
+      assertSet(getKey(map));
+      assertSet(getValue(map));
+   }
+   
+   public void testMapWithArray() throws Exception
+   {
+      AbstractMapMetaData map = getMap();
+      assertNull(map.getType());
+      assertNull(map.getKeyType());
+      assertNull(map.getValueType());
+      assertArray(getKey(map));
+      assertArray(getValue(map));
+   }
+   
+   public void testMapWithMap() throws Exception
+   {
+      AbstractMapMetaData map = getMap();
+      assertNull(map.getType());
+      assertNull(map.getKeyType());
+      assertNull(map.getValueType());
+      assertMap(getKey(map));
+      assertMap(getValue(map));
+   }
+   
+   public void testMapWithNull() throws Exception
+   {
+      AbstractMapMetaData map = getMap();
+      assertNull(map.getType());
+      assertNull(map.getKeyType());
+      assertNull(map.getValueType());
+      assertNullValue(getKey(map));
+      assertNullValue(getValue(map));
+   }
+   
+   public void testMapWithThis() throws Exception
+   {
+      AbstractMapMetaData map = getMap();
+      assertNull(map.getType());
+      assertNull(map.getKeyType());
+      assertNull(map.getValueType());
+      assertThis(getKey(map));
+      assertThis(getValue(map));
+   }
+   
+   public void testMapWithWildcard() throws Exception
+   {
+      AbstractMapMetaData map = getMap();
+      assertNull(map.getType());
+      assertNull(map.getKeyType());
+      assertNull(map.getValueType());
+      assertWildcard(getKey(map));
+      assertWildcard(getValue(map));
+   }
+   
+   protected ValueMetaData getKey(AbstractMapMetaData map)
+   {
+      assertEquals(1, map.size());
+      return (ValueMetaData) map.keySet().iterator().next();
+   }
+   
+   protected ValueMetaData getValue(AbstractMapMetaData map)
+   {
+      assertEquals(1, map.size());
+      return (ValueMetaData) map.values().iterator().next();
+   }
+   
+   public static Test suite()
+   {
+      return MapJaxbTestCase.suite(MapJaxbTestCase.class);
+   }
+
+   public MapJaxbTestCase(String name)
+   {
+      super(name);
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ParameterJaxbTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ParameterJaxbTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ParameterJaxbTestCase.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,192 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.util.HashSet;
+import java.util.List;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.ConstructorMetaData;
+import org.jboss.beans.metadata.spi.ParameterMetaData;
+import org.jboss.test.kernel.deployment.xml.support.Annotation1;
+import org.jboss.test.kernel.deployment.xml.support.Annotation2;
+import org.jboss.test.kernel.deployment.xml.support.Annotation3;
+
+/**
+ * ParameterJaxbTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 56471 $
+ */
+public class ParameterJaxbTestCase extends AbstractMCTest
+{
+   protected ParameterMetaData getParameter() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      ConstructorMetaData constructor = bean.getConstructor();
+      assertNotNull(constructor);
+      List parameters = constructor.getParameters();
+      assertNotNull(parameters);
+      assertEquals(1, parameters.size());
+      ParameterMetaData parameter = (ParameterMetaData) parameters.get(0);
+      assertNotNull(parameter);
+      return parameter;
+   }
+   
+   public void testParameter() throws Exception
+   {
+      ParameterMetaData parameter = getParameter();
+      assertNull(parameter.getType());
+      assertNull(parameter.getAnnotations());
+      assertNull(parameter.getValue());
+   }
+   
+   public void testParameterWithBean() throws Exception
+   {
+      ParameterMetaData parameter = getParameter();
+      assertNull(parameter.getAnnotations());
+      assertNotNull(parameter.getValue());
+      assertTrue(parameter.getValue() instanceof BeanMetaData);
+   }
+   
+   public void testParameterWithClass() throws Exception
+   {
+      ParameterMetaData parameter = getParameter();
+      assertEquals("ParameterClass", parameter.getType());
+      assertNull(parameter.getAnnotations());
+      assertNull(parameter.getValue());
+   }
+
+   public void testParameterWithAnnotation() throws Exception
+   {
+      ParameterMetaData parameter = getParameter();
+      assertNull(parameter.getType());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add(Annotation1.class.getName());
+      assertAnnotations(expected, parameter.getAnnotations());
+      assertNull(parameter.getValue());
+   }
+   
+   public void testParameterWithAnnotations() throws Exception
+   {
+      ParameterMetaData parameter = getParameter();
+      assertNull(parameter.getType());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add(Annotation1.class.getName());
+      expected.add(Annotation2.class.getName());
+      expected.add(Annotation3.class.getName());
+      assertAnnotations(expected, parameter.getAnnotations());
+      assertNull(parameter.getValue());
+   }
+   
+   public void testParameterWithPlainValue() throws Exception
+   {
+      ParameterMetaData parameter = getParameter();
+      assertNull(parameter.getType());
+      assertNull(parameter.getAnnotations());
+      assertPlainValue("PlainValue", parameter.getValue());
+   }
+   
+   public void testParameterWithValue() throws Exception
+   {
+      ParameterMetaData parameter = getParameter();
+      assertNull(parameter.getType());
+      assertNull(parameter.getAnnotations());
+      assertValue("Value", parameter.getValue());
+   }
+   
+   public void testParameterWithInjection() throws Exception
+   {
+      ParameterMetaData parameter = getParameter();
+      assertNull(parameter.getType());
+      assertNull(parameter.getAnnotations());
+      assertInjection(parameter.getValue());
+   }
+   
+   public void testParameterWithCollection() throws Exception
+   {
+      ParameterMetaData parameter = getParameter();
+      assertNull(parameter.getType());
+      assertNull(parameter.getAnnotations());
+      assertCollection(parameter.getValue());
+   }
+   
+   public void testParameterWithList() throws Exception
+   {
+      ParameterMetaData parameter = getParameter();
+      assertNull(parameter.getType());
+      assertNull(parameter.getAnnotations());
+      assertList(parameter.getValue());
+   }
+   
+   public void testParameterWithSet() throws Exception
+   {
+      ParameterMetaData parameter = getParameter();
+      assertNull(parameter.getType());
+      assertNull(parameter.getAnnotations());
+      assertSet(parameter.getValue());
+   }
+   
+   public void testParameterWithArray() throws Exception
+   {
+      ParameterMetaData parameter = getParameter();
+      assertNull(parameter.getType());
+      assertNull(parameter.getAnnotations());
+      assertArray(parameter.getValue());
+   }
+   
+   public void testParameterWithMap() throws Exception
+   {
+      ParameterMetaData parameter = getParameter();
+      assertNull(parameter.getType());
+      assertNull(parameter.getAnnotations());
+      assertMap(parameter.getValue());
+   }
+   
+   public void testParameterWithThis() throws Exception
+   {
+      ParameterMetaData parameter = getParameter();
+      assertNull(parameter.getType());
+      assertNull(parameter.getAnnotations());
+      assertThis(parameter.getValue());
+   }
+   
+   public void testParameterWithWildcard() throws Exception
+   {
+      ParameterMetaData parameter = getParameter();
+      assertNull(parameter.getType());
+      assertNull(parameter.getAnnotations());
+      assertWildcard(parameter.getValue());
+   }
+   
+   public static Test suite()
+   {
+      return ParameterJaxbTestCase.suite(ParameterJaxbTestCase.class);
+   }
+
+   public ParameterJaxbTestCase(String name)
+   {
+      super(name);
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/PropertyJaxbTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/PropertyJaxbTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/PropertyJaxbTestCase.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,211 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.StringValueMetaData;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.PropertyMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.test.kernel.deployment.xml.support.Annotation1;
+import org.jboss.test.kernel.deployment.xml.support.Annotation2;
+import org.jboss.test.kernel.deployment.xml.support.Annotation3;
+
+/**
+ * PropertyJaxbTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 56471 $
+ */
+public class PropertyJaxbTestCase extends AbstractMCTest
+{
+   protected PropertyMetaData getProperty() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      Set properties = bean.getProperties();
+      assertNotNull(properties);
+      assertEquals(1, properties.size());
+      PropertyMetaData property = (PropertyMetaData) properties.iterator().next();
+      assertNotNull(property);
+      return property;
+   }
+   
+   public void testProperty() throws Exception
+   {
+      PropertyMetaData property = getProperty();
+      assertNotNull("PropertyName", property.getName());
+      assertNull(property.getAnnotations());
+      assertNull(property.getValue());
+   }
+   
+   public void testPropertyWithBean() throws Exception
+   {
+      PropertyMetaData property = getProperty();
+      assertNotNull("PropertyName", property.getName());
+      assertNull(property.getAnnotations());
+      ValueMetaData value = property.getValue();
+      assertNotNull(value);
+      assertTrue(value instanceof BeanMetaData);
+   }
+   
+   public void testPropertyWithClass() throws Exception
+   {
+      PropertyMetaData property = getProperty();
+      assertNotNull("PropertyName", property.getName());
+      assertNull(property.getAnnotations());
+      ValueMetaData value = property.getValue();
+      assertNotNull(value);
+      assertTrue(value instanceof StringValueMetaData);
+      StringValueMetaData string = (StringValueMetaData) value;
+      assertEquals("PropertyClass", string.getType());
+   }
+
+   public void testPropertyWithAnnotation() throws Exception
+   {
+      PropertyMetaData property = getProperty();
+      assertNotNull("PropertyName", property.getName());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add(Annotation1.class.getName());
+      assertAnnotations(expected, property.getAnnotations());
+      assertNull(property.getValue());
+   }
+   
+   public void testPropertyWithAnnotations() throws Exception
+   {
+      PropertyMetaData property = getProperty();
+      assertNotNull("PropertyName", property.getName());
+      HashSet<String> expected = new HashSet<String>();
+      expected.add(Annotation1.class.getName());
+      expected.add(Annotation2.class.getName());
+      expected.add(Annotation3.class.getName());
+      assertAnnotations(expected, property.getAnnotations());
+      assertNull(property.getValue());
+   }
+   
+   public void testPropertyWithPlainValue() throws Exception
+   {
+      PropertyMetaData property = getProperty();
+      assertNotNull("PropertyName", property.getName());
+      assertNull(property.getAnnotations());
+      assertPlainValue("PlainValue", property.getValue());
+   }
+   
+   public void testPropertyWithValue() throws Exception
+   {
+      PropertyMetaData property = getProperty();
+      assertNotNull("PropertyName", property.getName());
+      assertNull(property.getAnnotations());
+      assertValue("Value", property.getValue());
+   }
+   
+   public void testPropertyWithInjection() throws Exception
+   {
+      PropertyMetaData property = getProperty();
+      assertNotNull("PropertyName", property.getName());
+      assertNull(property.getAnnotations());
+      assertInjection(property.getValue());
+   }
+   
+   public void testPropertyWithCollection() throws Exception
+   {
+      PropertyMetaData property = getProperty();
+      assertNotNull("PropertyName", property.getName());
+      assertNull(property.getAnnotations());
+      assertCollection(property.getValue());
+   }
+   
+   public void testPropertyWithList() throws Exception
+   {
+      PropertyMetaData property = getProperty();
+      assertNotNull("PropertyName", property.getName());
+      assertNull(property.getAnnotations());
+      assertList(property.getValue());
+   }
+   
+   public void testPropertyWithSet() throws Exception
+   {
+      PropertyMetaData property = getProperty();
+      assertNotNull("PropertyName", property.getName());
+      assertNull(property.getAnnotations());
+      assertSet(property.getValue());
+   }
+   
+   public void testPropertyWithArray() throws Exception
+   {
+      PropertyMetaData property = getProperty();
+      assertNotNull("PropertyName", property.getName());
+      assertNull(property.getAnnotations());
+      assertArray(property.getValue());
+   }
+   
+   public void testPropertyWithMap() throws Exception
+   {
+      PropertyMetaData property = getProperty();
+      assertNotNull("PropertyName", property.getName());
+      assertNull(property.getAnnotations());
+      assertMap(property.getValue());
+   }
+   
+   public void testPropertyWithThis() throws Exception
+   {
+      PropertyMetaData property = getProperty();
+      assertNotNull("PropertyName", property.getName());
+      assertNull(property.getAnnotations());
+      assertThis(property.getValue());
+   }
+   
+   public void testPropertyWithWildcard() throws Exception
+   {
+      PropertyMetaData property = getProperty();
+      assertNotNull("PropertyName", property.getName());
+      assertNull(property.getAnnotations());
+      assertWildcard(property.getValue());
+   }
+
+   /* TODO
+   public void testPropertyBadNoName() throws Exception
+   {
+      try
+      {
+         unmarshalBean("PropertyBadNoName.xml");
+         fail("Should not be here");
+      }
+      catch (Exception expected)
+      {
+         checkJBossXBException(IllegalArgumentException.class, expected);
+      }
+   } */
+
+   public static Test suite()
+   {
+      return PropertyJaxbTestCase.suite(PropertyJaxbTestCase.class);
+   }
+
+   public PropertyJaxbTestCase(String name)
+   {
+      super(name);
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/SetJaxbTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/SetJaxbTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/SetJaxbTestCase.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,170 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.util.Set;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractSetMetaData;
+import org.jboss.beans.metadata.spi.PropertyMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+
+/**
+ * SetJaxbTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 40781 $
+ */
+public class SetJaxbTestCase extends AbstractMCTest
+{
+   protected AbstractSetMetaData getCollection() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      Set properties = bean.getProperties();
+      assertNotNull(properties);
+      assertEquals(1, properties.size());
+      PropertyMetaData property = (PropertyMetaData) properties.iterator().next();
+      assertNotNull(property);
+      ValueMetaData value = property.getValue();
+      assertNotNull(property);
+      assertTrue(value instanceof AbstractSetMetaData);
+      return (AbstractSetMetaData) value;
+   }
+   
+   public void testSet() throws Exception
+   {
+      AbstractSetMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+   }
+   
+   public void testSetWithClass() throws Exception
+   {
+      AbstractSetMetaData collection = getCollection();
+      assertEquals("CollectionClass", collection.getType());
+      assertNull(collection.getElementType());
+   }
+   
+   public void testSetWithElementClass() throws Exception
+   {
+      AbstractSetMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertEquals("ElementClass", collection.getElementType());
+   }
+   
+   public void testSetWithValue() throws Exception
+   {
+      AbstractSetMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertValue("Value", getValue(collection));
+   }
+   
+   public void testSetWithInjection() throws Exception
+   {
+      AbstractSetMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertInjection(getValue(collection));
+   }
+   
+   public void testSetWithCollection() throws Exception
+   {
+      AbstractSetMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertCollection(getValue(collection));
+   }
+   
+   public void testSetWithList() throws Exception
+   {
+      AbstractSetMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertList(getValue(collection));
+   }
+   
+   public void testSetWithSet() throws Exception
+   {
+      AbstractSetMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertSet(getValue(collection));
+   }
+   
+   public void testSetWithArray() throws Exception
+   {
+      AbstractSetMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertArray(getValue(collection));
+   }
+   
+   public void testSetWithMap() throws Exception
+   {
+      AbstractSetMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertMap(getValue(collection));
+   }
+   
+   public void testSetWithNull() throws Exception
+   {
+      AbstractSetMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertNullValue(getValue(collection));
+   }
+   
+   public void testSetWithThis() throws Exception
+   {
+      AbstractSetMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertThis(getValue(collection));
+   }
+   
+   public void testSetWithWildcard() throws Exception
+   {
+      AbstractSetMetaData collection = getCollection();
+      assertNull(collection.getType());
+      assertNull(collection.getElementType());
+      assertWildcard(getValue(collection));
+   }
+   
+   protected ValueMetaData getValue(AbstractSetMetaData collection)
+   {
+      assertEquals(1, collection.size());
+      return (ValueMetaData) collection.iterator().next();
+   }
+   
+   public static Test suite()
+   {
+      return SetJaxbTestCase.suite(SetJaxbTestCase.class);
+   }
+
+   public SetJaxbTestCase(String name)
+   {
+      super(name);
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/SupplyJaxbTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/SupplyJaxbTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/SupplyJaxbTestCase.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,79 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.util.Set;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractSupplyMetaData;
+
+/**
+ * SupplyJaxbTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 40800 $
+ */
+public class SupplyJaxbTestCase extends AbstractMCTest
+{
+   protected AbstractSupplyMetaData getSupply() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      Set supplies = bean.getSupplies();
+      assertNotNull(supplies);
+      assertEquals(1, supplies.size());
+      AbstractSupplyMetaData supply = (AbstractSupplyMetaData) supplies.iterator().next();
+      assertNotNull(supply);
+      return supply;
+   }
+   
+   public void testSupply() throws Exception
+   {
+      AbstractSupplyMetaData supply = getSupply();
+      assertEquals("Supply", supply.getSupply());
+   }
+
+   /* TODO
+   public void testSupplyBadNoValue() throws Exception
+   {
+      try
+      {
+         unmarshalBean("SupplyBadNoValue.xml");
+         fail("Should not be here");
+      }
+      catch (Exception expected)
+      {
+         checkJBossXBException(IllegalArgumentException.class, expected);
+      }
+   }
+   */
+   
+   public static Test suite()
+   {
+      return SupplyJaxbTestCase.suite(SupplyJaxbTestCase.class);
+   }
+
+   public SupplyJaxbTestCase(String name)
+   {
+      super(name);
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ValueFactoryJaxbTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ValueFactoryJaxbTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ValueFactoryJaxbTestCase.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,163 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.util.List;
+import java.util.Set;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractValueFactoryMetaData;
+import org.jboss.beans.metadata.spi.ParameterMetaData;
+import org.jboss.beans.metadata.spi.PropertyMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+import org.jboss.dependency.spi.ControllerState;
+
+/**
+ * Test value factoty.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ValueFactoryJaxbTestCase extends AbstractMCTest
+{
+   protected AbstractValueFactoryMetaData getValueFactory(String name) throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      Set properties = bean.getProperties();
+      assertNotNull(properties);
+      assertEquals(1, properties.size());
+      PropertyMetaData property = (PropertyMetaData) properties.iterator().next();
+      assertNotNull(property);
+      ValueMetaData value = property.getValue();
+      assertNotNull(value);
+      assertTrue(value instanceof AbstractValueFactoryMetaData);
+      return (AbstractValueFactoryMetaData) value;
+   }
+
+   public void testValueFactoryWithBean() throws Exception
+   {
+      AbstractValueFactoryMetaData dependency = getValueFactory("ValueFactoryWithBean.xml");
+      assertEquals("Dummy", dependency.getValue());
+      assertEquals("getValue", dependency.getMethod());
+      assertNull(dependency.getDependentState());
+   }
+
+   public void testValueFactoryWithParameter() throws Exception
+   {
+      AbstractValueFactoryMetaData dependency = getValueFactory("ValueFactoryWithParameter.xml");
+      assertEquals("Dummy", dependency.getValue());
+      assertEquals("getValue", dependency.getMethod());
+      List<ParameterMetaData> parameters = dependency.getParameters();
+      assertNotNull(parameters);
+      assertFalse(parameters.isEmpty());
+      assertTrue(parameters.size() == 1);
+      ParameterMetaData pmd = parameters.get(0);
+      assertNotNull(pmd);
+      ValueMetaData value = pmd.getValue();
+      assertNotNull(value);
+      assertEquals("foo.bar.key", value.getUnderlyingValue());
+      assertNull(dependency.getDependentState());
+   }
+
+   public void testValueFactoryWithParameters() throws Exception
+   {
+      AbstractValueFactoryMetaData dependency = getValueFactory("ValueFactoryWithParameters.xml");
+      assertEquals("Dummy", dependency.getValue());
+      assertEquals("getValue", dependency.getMethod());
+      List<ParameterMetaData> parameters = dependency.getParameters();
+      assertNotNull(parameters);
+      assertFalse(parameters.isEmpty());
+      assertTrue(parameters.size() == 2);
+      ParameterMetaData pmd1 = parameters.get(0);
+      assertNotNull(pmd1);
+      ValueMetaData value1 = pmd1.getValue();
+      assertNotNull(value1);
+      assertEquals("foo.bar.key", value1.getUnderlyingValue());
+      ParameterMetaData pmd2 = parameters.get(1);
+      assertNotNull(pmd2);
+      ValueMetaData value2 = pmd2.getValue();
+      assertNotNull(value2);
+      assertEquals("mydefault", value2.getUnderlyingValue());
+      assertNull(dependency.getDependentState());
+   }
+
+   public void testValueFactoryWithDefault() throws Exception
+   {
+      AbstractValueFactoryMetaData dependency = getValueFactory("ValueFactoryWithDefault.xml");
+      assertEquals("Dummy", dependency.getValue());
+      assertEquals("getValue", dependency.getMethod());
+      assertEquals("mydefault", dependency.getDefaultValue());
+      assertNull(dependency.getDependentState());
+   }
+
+   public void testValueFactoryWithState() throws Exception
+   {
+      AbstractValueFactoryMetaData dependency = getValueFactory("ValueFactoryWithState.xml");
+      assertEquals("Dummy", dependency.getValue());
+      assertEquals("getValue", dependency.getMethod());
+      assertEquals(ControllerState.CONFIGURED, dependency.getDependentState());
+   }
+
+   public void testValueFactoryWithWhenRequired() throws Exception
+   {
+      AbstractValueFactoryMetaData dependency = getValueFactory("ValueFactoryWithWhenRequired.xml");
+      assertEquals("Dummy", dependency.getValue());
+      assertEquals("getValue", dependency.getMethod());
+      assertEquals(ControllerState.CREATE, dependency.getWhenRequiredState());
+   }
+
+   public void testValueFactoryBadNoBean() throws Exception
+   {
+      try
+      {
+         AbstractValueFactoryMetaData dependency = getValueFactory("ValueFactoryBadNoBean.xml");
+         assertNull(dependency.getValue());
+      }
+      catch (Exception expected)
+      {
+         checkJBossXBException(IllegalArgumentException.class, expected);
+      }
+   }
+
+   public void testValueFactoryBadNoMethod() throws Exception
+   {
+      try
+      {
+         AbstractValueFactoryMetaData dependency = getValueFactory("ValueFactoryBadNoMethod.xml");
+         assertNull(dependency.getValue());
+      }
+      catch (Exception expected)
+      {
+         checkJBossXBException(IllegalArgumentException.class, expected);
+      }
+   }
+
+   public static Test suite()
+   {
+      return suite(ValueFactoryTestCase.class);
+   }
+
+   public ValueFactoryJaxbTestCase(String name)
+   {
+      super(name);
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ValueJaxbTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ValueJaxbTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/ValueJaxbTestCase.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -0,0 +1,84 @@
+/*
+* 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.kernel.deployment.xml.test;
+
+import java.util.Set;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.StringValueMetaData;
+import org.jboss.beans.metadata.spi.PropertyMetaData;
+import org.jboss.beans.metadata.spi.ValueMetaData;
+
+/**
+ * ValueJaxbTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 40781 $
+ */
+public class ValueJaxbTestCase extends AbstractMCTest
+{
+   protected StringValueMetaData getValue() throws Exception
+   {
+      AbstractBeanMetaData bean = unmarshalBean();
+      Set properties = bean.getProperties();
+      assertNotNull(properties);
+      assertEquals(1, properties.size());
+      PropertyMetaData property = (PropertyMetaData) properties.iterator().next();
+      assertNotNull(property);
+      ValueMetaData value = property.getValue();
+      assertNotNull(property);
+      assertTrue(value instanceof StringValueMetaData);
+      return (StringValueMetaData) value;
+   }
+   
+   public void testValue() throws Exception
+   {
+      StringValueMetaData value = getValue();
+      assertNull(value.getType());
+      assertNull(value.getUnderlyingValue());
+   }
+   
+   public void testValueWithClass() throws Exception
+   {
+      StringValueMetaData value = getValue();
+      assertEquals("ValueClass", value.getType());
+      assertNull(value.getUnderlyingValue());
+   }
+   
+   public void testValueWithValue() throws Exception
+   {
+      StringValueMetaData value = getValue();
+      assertNull(value.getType());
+      assertEquals("Value", value.getUnderlyingValue());
+   }
+   
+   public static Test suite()
+   {
+      return ValueJaxbTestCase.suite(ValueJaxbTestCase.class);
+   }
+
+   public ValueJaxbTestCase(String name)
+   {
+      super(name);
+   }
+}

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/XMLTestSuite.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/XMLTestSuite.java	2008-01-05 21:39:21 UTC (rev 68639)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/xml/test/XMLTestSuite.java	2008-01-05 21:40:47 UTC (rev 68640)
@@ -69,6 +69,31 @@
       suite.addTest(AliasTestCase.suite());
       suite.addTest(CallbackTestCase.suite());
       suite.addTest(ValueFactoryTestCase.suite());
+      // jaxb
+      suite.addTest(DeploymentJaxbTestCase.suite());
+      suite.addTest(BeanJaxbTestCase.suite());
+      suite.addTest(BeanFactoryJaxbTestCase.suite());
+      suite.addTest(ClassLoaderJaxbTestCase.suite());
+      suite.addTest(ConstructorJaxbTestCase.suite());
+      suite.addTest(FactoryJaxbTestCase.suite());
+      suite.addTest(ParameterJaxbTestCase.suite());
+      suite.addTest(PropertyJaxbTestCase.suite());
+      suite.addTest(LifecycleJaxbTestCase.suite());
+      suite.addTest(DependencyJaxbTestCase.suite());
+      suite.addTest(DemandJaxbTestCase.suite());
+      suite.addTest(SupplyJaxbTestCase.suite());
+      suite.addTest(InstallJaxbTestCase.suite());
+      suite.addTest(ValueJaxbTestCase.suite());
+      suite.addTest(InjectionJaxbTestCase.suite());
+      suite.addTest(CollectionJaxbTestCase.suite());
+      suite.addTest(ListJaxbTestCase.suite());
+      suite.addTest(SetJaxbTestCase.suite());
+      suite.addTest(ArrayJaxbTestCase.suite());
+      suite.addTest(MapJaxbTestCase.suite());
+      suite.addTest(AnnotationJaxbTestCase.suite());
+      suite.addTest(AliasJaxbTestCase.suite());
+      suite.addTest(CallbackJaxbTestCase.suite());
+      suite.addTest(ValueFactoryJaxbTestCase.suite());
 
       return suite;
    }




More information about the jboss-cvs-commits mailing list