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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Mar 18 12:27:56 EDT 2008


Author: alesj
Date: 2008-03-18 12:27:55 -0400 (Tue, 18 Mar 2008)
New Revision: 70952

Added:
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/BeanRepository.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimpleFieldsBeanRepository.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimpleFieldsBeanRepository2.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimplerBean.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimplerBeanImpl.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimplerBeanImpl2.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/StatesAndBeanRepository.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackCollectionFields2TestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackCollectionFieldsTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/GenericBeanFactoryField2PropertyDependencyTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/GenericBeanFactoryFieldPropertyDependencyTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/PropertyField2DependencyTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/PropertyFieldDependencyTestCase.java
Modified:
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/CallbackCreatorUtil.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/config/Configurator.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/PropertyAttributeInfo.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/registry/BeanKernelRegistryEntry.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimpleBean.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimpleBeanRepository.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/DependencyTestSuite.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/GenericBeanFactoryPropertyDependencyTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/PropertyDependencyTestCase.java
Log:
Initial property/callback field tests.
Introducing InvokeDispatchContext to BeanKernelRegistryEntry.

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/CallbackCreatorUtil.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/CallbackCreatorUtil.java	2008-03-18 16:22:42 UTC (rev 70951)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/CallbackCreatorUtil.java	2008-03-18 16:27:55 UTC (rev 70952)
@@ -33,7 +33,6 @@
 import org.jboss.kernel.plugins.dependency.BasicCollectionCallbackItemFactory;
 import org.jboss.kernel.plugins.dependency.ClassAttributeCallbackItem;
 import org.jboss.kernel.plugins.dependency.ClassSingleCallbackItem;
-import org.jboss.kernel.plugins.dependency.CollectionCallbackItem;
 import org.jboss.kernel.plugins.dependency.CollectionCallbackItemFactory;
 import org.jboss.kernel.plugins.dependency.MethodAttributeInfo;
 import org.jboss.kernel.plugins.dependency.PropertyAttributeInfo;
@@ -93,8 +92,7 @@
             throw new IllegalArgumentException("Component type too general - equals Object: " + info);
          Class<? extends Collection<Object>> collectionType = (Class) info.getType();
          CollectionCallbackItemFactory factory = getCollectionFactory();
-         CollectionCallbackItem collectionCallback = factory.createCollectionCallbackItem(collectionType, clazz, whenRequired, dependentState, cardinality, context, attribute);
-         return collectionCallback;
+         return factory.createCollectionCallbackItem(collectionType, clazz, whenRequired, dependentState, cardinality, context, attribute);
       }
       else
          throw new IllegalArgumentException("Unable to determine collection element class type: " + info);

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/config/Configurator.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/config/Configurator.java	2008-03-18 16:22:42 UTC (rev 70951)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/config/Configurator.java	2008-03-18 16:27:55 UTC (rev 70952)
@@ -387,9 +387,13 @@
 
       JoinpointFactory jpf = info.getBeanInfo().getJoinpointFactory();
       MethodInfo minfo = info.getGetter();
-      if (minfo == null)
+      FieldInfo finfo = info.getFieldInfo();
+      if (minfo != null)
+         return getMethodJoinpoint(null, jpf, minfo.getName(), null, null);
+      else if (finfo != null)
+         return getFieldGetJoinpoint(null, jpf, finfo.getName());
+      else
          throw new IllegalArgumentException("Property is write only: " + info);
-      return getMethodJoinpoint(null, jpf, minfo.getName(), null, null);
    }
 
    /**
@@ -513,10 +517,16 @@
       Object value = metaData.getValue(type, cl);
       JoinpointFactory jpf = info.getBeanInfo().getJoinpointFactory();
       MethodInfo minfo = info.getSetter();
-      if (minfo == null)
-         throw new IllegalArgumentException("No setter configured for property: " + info);
-      String[] parameterTypes = getParameterTypes(trace, minfo.getParameterTypes());
-      return getMethodJoinpoint(null, jpf, minfo.getName(), parameterTypes, new Object[] { value });
+      FieldInfo finfo = info.getFieldInfo();
+      if (minfo != null)
+      {
+         String[] parameterTypes = getParameterTypes(trace, minfo.getParameterTypes());
+         return getMethodJoinpoint(null, jpf, minfo.getName(), parameterTypes, new Object[] { value });
+      }
+      else if (finfo != null)
+         return getFieldSetJoinpoint(null, jpf, finfo.getName(), value);
+      else
+         throw new IllegalArgumentException("Property is read only: " + info);
    }
 
    /**
@@ -665,10 +675,16 @@
 
       JoinpointFactory jpf = info.getBeanInfo().getJoinpointFactory();
       MethodInfo minfo = info.getSetter();
-      if (minfo == null)
+      FieldInfo finfo = info.getFieldInfo();
+      if (minfo != null)
+      {
+         String[] parameterTypes = getParameterTypes(trace, minfo.getParameterTypes());
+         return getMethodJoinpoint(null, jpf, minfo.getName(), parameterTypes, new Object[] { null });
+      }
+      else if (finfo != null)
+         return getFieldSetJoinpoint(null, jpf, finfo.getName(), null);
+      else
          throw new IllegalArgumentException("Property is read only: " + info);
-      String[] parameterTypes = getParameterTypes(trace, minfo.getParameterTypes());
-      return getMethodJoinpoint(null, jpf, minfo.getName(), parameterTypes, new Object[] { null });
    }
 
    /**

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/PropertyAttributeInfo.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/PropertyAttributeInfo.java	2008-03-18 16:22:42 UTC (rev 70951)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/PropertyAttributeInfo.java	2008-03-18 16:27:55 UTC (rev 70952)
@@ -53,6 +53,6 @@
 
    public boolean isValid()
    {
-      return (info.getSetter() != null && super.isValid());
+      return (info.isWritable() && super.isValid());
    }
 }

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/registry/BeanKernelRegistryEntry.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/registry/BeanKernelRegistryEntry.java	2008-03-18 16:22:42 UTC (rev 70951)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/registry/BeanKernelRegistryEntry.java	2008-03-18 16:27:55 UTC (rev 70952)
@@ -22,14 +22,14 @@
 package org.jboss.kernel.plugins.registry;
 
 import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.dependency.spi.dispatch.AttributeDispatchContext;
+import org.jboss.dependency.spi.dispatch.InvokeDispatchContext;
 
 /**
  * Bean Kernel registry entry.
  *
  * @author <a href="ales.justin at jboss.com">Ales Justin</a>
  */
-public class BeanKernelRegistryEntry extends AbstractKernelRegistryEntry implements AttributeDispatchContext
+public class BeanKernelRegistryEntry extends AbstractKernelRegistryEntry implements InvokeDispatchContext
 {
    private BeanInfo beanInfo;
 
@@ -56,4 +56,18 @@
    {
       beanInfo.setProperty(target, name, value);
    }
+
+   public Object invoke(String name, Object parameters[], String[] signature) throws Throwable
+   {
+      return beanInfo.invoke(target, name, signature, parameters);
+   }
+
+   public ClassLoader getClassLoader() throws Throwable
+   {
+      if (target == null)
+         throw new IllegalArgumentException("Cannot get classloader, target is null.");
+
+      // this already checks for permission
+      return target.getClass().getClassLoader();
+   }
 }

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/BeanRepository.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/BeanRepository.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/BeanRepository.java	2008-03-18 16:27:55 UTC (rev 70952)
@@ -0,0 +1,29 @@
+/*
+* 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.dependency.support;
+
+import java.util.List;
+
+public interface BeanRepository
+{
+   List<SimpleBean> getBeans();
+}

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimpleBean.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimpleBean.java	2008-03-18 16:22:42 UTC (rev 70951)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimpleBean.java	2008-03-18 16:27:55 UTC (rev 70952)
@@ -27,7 +27,7 @@
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision$
  */
-public interface SimpleBean
+public interface SimpleBean extends SimplerBean
 {
    // Constants -----------------------------------------------------
 
@@ -35,8 +35,6 @@
    
    String getConstructorString();
 
-   String getString();
-
    void setString(String string);
 
    // Inner classes -------------------------------------------------

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimpleBeanRepository.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimpleBeanRepository.java	2008-03-18 16:22:42 UTC (rev 70951)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimpleBeanRepository.java	2008-03-18 16:27:55 UTC (rev 70952)
@@ -28,7 +28,7 @@
 
 import org.jboss.dependency.spi.ControllerState;
 
-public class SimpleBeanRepository
+public class SimpleBeanRepository implements StatesAndBeanRepository
 {
    List<SimpleBean> beans = new ArrayList<SimpleBean>();
    Set<ControllerState> states = new HashSet<ControllerState>();

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimpleFieldsBeanRepository.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimpleFieldsBeanRepository.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimpleFieldsBeanRepository.java	2008-03-18 16:27:55 UTC (rev 70952)
@@ -0,0 +1,40 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.dependency.support;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Set;
+import java.util.HashSet;
+
+import org.jboss.dependency.spi.ControllerState;
+
+public class SimpleFieldsBeanRepository implements BeanRepository
+{
+   public List<SimpleBean> beans = new ArrayList<SimpleBean>();
+   public Set<ControllerState> states = new HashSet<ControllerState>();
+
+   public List<SimpleBean> getBeans()
+   {
+      return beans;
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimpleFieldsBeanRepository2.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimpleFieldsBeanRepository2.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimpleFieldsBeanRepository2.java	2008-03-18 16:27:55 UTC (rev 70952)
@@ -0,0 +1,40 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.test.kernel.dependency.support;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Set;
+import java.util.HashSet;
+
+import org.jboss.dependency.spi.ControllerState;
+
+public class SimpleFieldsBeanRepository2 implements BeanRepository
+{
+   List<SimpleBean> beans = new ArrayList<SimpleBean>();
+   Set<ControllerState> states = new HashSet<ControllerState>();
+
+   public List<SimpleBean> getBeans()
+   {
+      return beans;
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimplerBean.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimplerBean.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimplerBean.java	2008-03-18 16:27:55 UTC (rev 70952)
@@ -0,0 +1,32 @@
+/*
+* 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.dependency.support;
+
+/**
+ * A SimplerBean.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface SimplerBean
+{
+   String getString();
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimplerBeanImpl.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimplerBeanImpl.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimplerBeanImpl.java	2008-03-18 16:27:55 UTC (rev 70952)
@@ -0,0 +1,41 @@
+/*
+* 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.dependency.support;
+
+import java.io.Serializable;
+
+/**
+ * A simpler bean
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SimplerBeanImpl implements Serializable, SimplerBean
+{
+   private static final long serialVersionUID = 3258132440433243443L;
+
+   public String string;
+
+   public String getString()
+   {
+      return string;
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimplerBeanImpl2.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimplerBeanImpl2.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/SimplerBeanImpl2.java	2008-03-18 16:27:55 UTC (rev 70952)
@@ -0,0 +1,41 @@
+/*
+* 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.dependency.support;
+
+import java.io.Serializable;
+
+/**
+ * A simpler bean
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SimplerBeanImpl2 implements Serializable, SimplerBean
+{
+   private static final long serialVersionUID = 3258132440433243443L;
+
+   private String string;
+
+   public String getString()
+   {
+      return string;
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/StatesAndBeanRepository.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/StatesAndBeanRepository.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/support/StatesAndBeanRepository.java	2008-03-18 16:27:55 UTC (rev 70952)
@@ -0,0 +1,31 @@
+/*
+* 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.dependency.support;
+
+import java.util.Set;
+
+import org.jboss.dependency.spi.ControllerState;
+
+public interface StatesAndBeanRepository extends BeanRepository
+{
+   Set<ControllerState> getStates();
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackCollectionFields2TestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackCollectionFields2TestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackCollectionFields2TestCase.java	2008-03-18 16:27:55 UTC (rev 70952)
@@ -0,0 +1,87 @@
+/*
+* 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.dependency.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Test;
+import org.jboss.beans.info.spi.BeanAccessMode;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.InstallCallbackMetaData;
+import org.jboss.beans.metadata.plugins.UninstallCallbackMetaData;
+import org.jboss.beans.metadata.spi.CallbackMetaData;
+import org.jboss.dependency.spi.Cardinality;
+import org.jboss.test.kernel.dependency.support.SimpleFieldsBeanRepository2;
+import org.jboss.test.AbstractTestDelegate;
+
+/**
+ * Callback collection tests.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class CallbackCollectionFields2TestCase extends CallbackTestCase
+{
+   public CallbackCollectionFields2TestCase(String name)
+         throws Throwable
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(CallbackCollectionFields2TestCase.class);
+   }
+
+   protected AbstractBeanMetaData buildRepository(Cardinality cardinality)
+   {
+      AbstractBeanMetaData repository = new AbstractBeanMetaData("Name1", SimpleFieldsBeanRepository2.class.getName());
+      repository.setAccessMode(BeanAccessMode.ALL);
+      List<CallbackMetaData> installs = new ArrayList<CallbackMetaData>();
+      repository.setInstallCallbacks(installs);
+      InstallCallbackMetaData install = new InstallCallbackMetaData();
+      install.setProperty("beans");
+      if (cardinality != null)
+         install.setCardinality(cardinality);
+      installs.add(install);
+      List<CallbackMetaData> unstalls = new ArrayList<CallbackMetaData>();
+      repository.setUninstallCallbacks(unstalls);
+      UninstallCallbackMetaData uninstall = new UninstallCallbackMetaData();
+      uninstall.setProperty("beans");
+      unstalls.add(uninstall);
+      return repository;
+   }
+
+   /**
+    * Default setup with security manager disabled
+    *
+    * @param clazz the class
+    * @return the delegate
+    * @throws Exception for any error
+    */
+   public static AbstractTestDelegate getDelegate(Class<?> clazz) throws Exception
+   {
+      AbstractTestDelegate delegate = new AbstractTestDelegate(clazz);
+      delegate.enableSecurity = false;
+      return delegate;
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackCollectionFieldsTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackCollectionFieldsTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackCollectionFieldsTestCase.java	2008-03-18 16:27:55 UTC (rev 70952)
@@ -0,0 +1,72 @@
+/*
+* 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.dependency.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.InstallCallbackMetaData;
+import org.jboss.beans.metadata.plugins.UninstallCallbackMetaData;
+import org.jboss.beans.metadata.spi.CallbackMetaData;
+import org.jboss.beans.info.spi.BeanAccessMode;
+import org.jboss.dependency.spi.Cardinality;
+import org.jboss.test.kernel.dependency.support.SimpleFieldsBeanRepository;
+
+/**
+ * Callback collection tests.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class CallbackCollectionFieldsTestCase extends CallbackTestCase
+{
+   public CallbackCollectionFieldsTestCase(String name)
+         throws Throwable
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(CallbackCollectionFieldsTestCase.class);
+   }
+
+   protected AbstractBeanMetaData buildRepository(Cardinality cardinality)
+   {
+      AbstractBeanMetaData repository = new AbstractBeanMetaData("Name1", SimpleFieldsBeanRepository.class.getName());
+      repository.setAccessMode(BeanAccessMode.FIELDS);
+      List<CallbackMetaData> installs = new ArrayList<CallbackMetaData>();
+      repository.setInstallCallbacks(installs);
+      InstallCallbackMetaData install = new InstallCallbackMetaData();
+      install.setProperty("beans");
+      if (cardinality != null)
+         install.setCardinality(cardinality);
+      installs.add(install);
+      List<CallbackMetaData> unstalls = new ArrayList<CallbackMetaData>();
+      repository.setUninstallCallbacks(unstalls);
+      UninstallCallbackMetaData uninstall = new UninstallCallbackMetaData();
+      uninstall.setProperty("beans");
+      unstalls.add(uninstall);
+      return repository;
+   }
+}

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackTestCase.java	2008-03-18 16:22:42 UTC (rev 70951)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/CallbackTestCase.java	2008-03-18 16:27:55 UTC (rev 70952)
@@ -28,9 +28,10 @@
 import org.jboss.dependency.spi.ControllerContext;
 import org.jboss.dependency.spi.Cardinality;
 import org.jboss.dependency.spi.ControllerState;
-import org.jboss.test.kernel.dependency.support.SimpleBeanRepository;
 import org.jboss.test.kernel.dependency.support.SimpleBean;
 import org.jboss.test.kernel.dependency.support.SimpleBeanImpl;
+import org.jboss.test.kernel.dependency.support.BeanRepository;
+import org.jboss.test.kernel.dependency.support.SimpleBeanRepository;
 import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
 import org.jboss.beans.metadata.plugins.InstallCallbackMetaData;
 import org.jboss.beans.metadata.plugins.UninstallCallbackMetaData;
@@ -66,7 +67,7 @@
       callbackCorrectOrder();
 
       ControllerContext context1 = assertInstall(0, "Name1");
-      SimpleBeanRepository repository = (SimpleBeanRepository)context1.getTarget();
+      BeanRepository repository = (BeanRepository)context1.getTarget();
       assertNotNull(repository);
       assertEmpty(repository.getBeans());
 
@@ -93,7 +94,7 @@
       assertNotNull(bean);
 
       ControllerContext context1 = assertInstall(0, "Name1");
-      SimpleBeanRepository repository = (SimpleBeanRepository)context1.getTarget();
+      BeanRepository repository = (BeanRepository)context1.getTarget();
       assertNotNull(repository);
       List<SimpleBean> beans = repository.getBeans();
       assertFalse(beans.isEmpty());
@@ -111,7 +112,7 @@
       callbackReinstall();
 
       ControllerContext context1 = assertInstall(0, "Name1");
-      SimpleBeanRepository repository = (SimpleBeanRepository)context1.getTarget();
+      BeanRepository repository = (BeanRepository)context1.getTarget();
       assertNotNull(repository);
       assertEmpty(repository.getBeans());
 
@@ -128,7 +129,7 @@
       assertEmpty(repository.getBeans());
 
       context1 = assertInstall(0, "Name1");
-      repository = (SimpleBeanRepository)context1.getTarget();
+      repository = (BeanRepository)context1.getTarget();
       assertNotNull(repository);
       assertFalse(repository.getBeans().isEmpty());
       assertEquals(1, repository.getBeans().size());
@@ -149,7 +150,7 @@
       callbackCardinalityCorrectOrder();
 
       ControllerContext context1 = assertInstall(0, "Name1", ControllerState.START);
-      SimpleBeanRepository repository = (SimpleBeanRepository)context1.getTarget();
+      BeanRepository repository = (BeanRepository)context1.getTarget();
       assertNotNull(repository);
       assertEmpty(repository.getBeans());
 
@@ -190,7 +191,7 @@
       SimpleBean bean2 = (SimpleBean)context3.getTarget();
 
       ControllerContext context1 = assertInstall(0, "Name1");
-      SimpleBeanRepository repository = (SimpleBeanRepository)context1.getTarget();
+      BeanRepository repository = (BeanRepository)context1.getTarget();
       assertNotNull(repository);
 
       assertFalse(repository.getBeans().isEmpty());
@@ -213,7 +214,7 @@
       callbackCardinalityReinstall();
 
       ControllerContext context1 = assertInstall(0, "Name1", ControllerState.START);
-      SimpleBeanRepository repository = (SimpleBeanRepository)context1.getTarget();
+      BeanRepository repository = (BeanRepository)context1.getTarget();
       assertNotNull(repository);
       assertEmpty(repository.getBeans());
 
@@ -234,7 +235,7 @@
       assertEmpty(repository.getBeans());
 
       context1 = assertInstall(0, "Name1");
-      repository = (SimpleBeanRepository)context1.getTarget();
+      repository = (BeanRepository)context1.getTarget();
       assertNotNull(repository);
       assertFalse(repository.getBeans().isEmpty());
       assertEquals(2, repository.getBeans().size());

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/DependencyTestSuite.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/DependencyTestSuite.java	2008-03-18 16:22:42 UTC (rev 70951)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/DependencyTestSuite.java	2008-03-18 16:27:55 UTC (rev 70952)
@@ -54,8 +54,12 @@
       suite.addTest(PropertyDependencyTestCase.suite());
       suite.addTest(PropertyDependencyXMLTestCase.suite());
       suite.addTest(PropertyDependencyAnnotationTestCase.suite());
+      suite.addTest(PropertyFieldDependencyTestCase.suite());
+      suite.addTest(PropertyField2DependencyTestCase.suite());
       suite.addTest(GenericBeanFactoryPropertyDependencyTestCase.suite());
       suite.addTest(GenericBeanFactoryPropertyDependencyXMLTestCase.suite());
+      suite.addTest(GenericBeanFactoryFieldPropertyDependencyTestCase.suite());
+      suite.addTest(GenericBeanFactoryField2PropertyDependencyTestCase.suite());
       suite.addTest(ConstructorDependencyTestCase.suite());
       suite.addTest(ConstructorDependencyXMLTestCase.suite());
       suite.addTest(ConstructorDependencyAnnotationTestCase.suite());
@@ -97,6 +101,8 @@
       suite.addTest(CallbackCollectionTestCase.suite());
       suite.addTest(CallbackCollectionXMLTestCase.suite());
       suite.addTest(CallbackCollectionAnnotationTestCase.suite());
+      suite.addTest(CallbackCollectionFieldsTestCase.suite());
+      suite.addTest(CallbackCollectionFields2TestCase.suite());
       suite.addTest(MatcherDemandSupplyTestCase.suite());
       suite.addTest(MatcherDemandSupplyXMLTestCase.suite());
       suite.addTest(MatcherDemandSupplyAnnotationTestCase.suite());

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/GenericBeanFactoryField2PropertyDependencyTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/GenericBeanFactoryField2PropertyDependencyTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/GenericBeanFactoryField2PropertyDependencyTestCase.java	2008-03-18 16:27:55 UTC (rev 70952)
@@ -0,0 +1,67 @@
+/*
+* 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.dependency.test;
+
+import junit.framework.Test;
+import org.jboss.beans.info.spi.BeanAccessMode;
+import org.jboss.beans.metadata.plugins.factory.GenericBeanFactoryMetaData;
+import org.jboss.test.kernel.dependency.support.SimplerBeanImpl2;
+import org.jboss.test.AbstractTestDelegate;
+
+/**
+ * Property Field Dependency Test Case.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class GenericBeanFactoryField2PropertyDependencyTestCase extends GenericBeanFactoryPropertyDependencyTestCase
+{
+   public static Test suite()
+   {
+      return suite(GenericBeanFactoryField2PropertyDependencyTestCase.class);
+   }
+
+   public GenericBeanFactoryField2PropertyDependencyTestCase(String name) throws Throwable
+   {
+      super(name);
+   }
+
+   protected GenericBeanFactoryMetaData createBeanFactory()
+   {
+      GenericBeanFactoryMetaData beanFactoryMetaData = new GenericBeanFactoryMetaData("Name2", SimplerBeanImpl2.class.getName());
+      beanFactoryMetaData.setAccessMode(BeanAccessMode.ALL);
+      return beanFactoryMetaData;
+   }
+
+   /**
+    * Default setup with security manager disabled
+    *
+    * @param clazz the class
+    * @return the delegate
+    * @throws Exception for any error
+    */
+   public static AbstractTestDelegate getDelegate(Class<?> clazz) throws Exception
+   {
+      AbstractTestDelegate delegate = new AbstractTestDelegate(clazz);
+      delegate.enableSecurity = false;
+      return delegate;
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/GenericBeanFactoryFieldPropertyDependencyTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/GenericBeanFactoryFieldPropertyDependencyTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/GenericBeanFactoryFieldPropertyDependencyTestCase.java	2008-03-18 16:27:55 UTC (rev 70952)
@@ -0,0 +1,67 @@
+/*
+* 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.dependency.test;
+
+import junit.framework.Test;
+import org.jboss.beans.info.spi.BeanAccessMode;
+import org.jboss.beans.metadata.plugins.factory.GenericBeanFactoryMetaData;
+import org.jboss.test.kernel.dependency.support.SimplerBeanImpl;
+import org.jboss.test.AbstractTestDelegate;
+
+/**
+ * Property Field Dependency Test Case.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class GenericBeanFactoryFieldPropertyDependencyTestCase extends GenericBeanFactoryPropertyDependencyTestCase
+{
+   public static Test suite()
+   {
+      return suite(GenericBeanFactoryFieldPropertyDependencyTestCase.class);
+   }
+
+   public GenericBeanFactoryFieldPropertyDependencyTestCase(String name) throws Throwable
+   {
+      super(name);
+   }
+
+   protected GenericBeanFactoryMetaData createBeanFactory()
+   {
+      GenericBeanFactoryMetaData beanFactoryMetaData = new GenericBeanFactoryMetaData("Name2", SimplerBeanImpl.class.getName());
+      beanFactoryMetaData.setAccessMode(BeanAccessMode.FIELDS);
+      return beanFactoryMetaData;
+   }
+
+   /**
+    * Default setup with security manager disabled
+    *
+    * @param clazz the class
+    * @return the delegate
+    * @throws Exception for any error
+    */
+   public static AbstractTestDelegate getDelegate(Class<?> clazz) throws Exception
+   {
+      AbstractTestDelegate delegate = new AbstractTestDelegate(clazz);
+      delegate.enableSecurity = false;
+      return delegate;
+   }
+}

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/GenericBeanFactoryPropertyDependencyTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/GenericBeanFactoryPropertyDependencyTestCase.java	2008-03-18 16:22:42 UTC (rev 70951)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/GenericBeanFactoryPropertyDependencyTestCase.java	2008-03-18 16:27:55 UTC (rev 70952)
@@ -22,7 +22,6 @@
 package org.jboss.test.kernel.dependency.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.AbstractPropertyMetaData;
@@ -31,8 +30,8 @@
 import org.jboss.beans.metadata.spi.BeanMetaData;
 import org.jboss.dependency.spi.ControllerContext;
 import org.jboss.dependency.spi.ControllerState;
-import org.jboss.test.kernel.dependency.support.SimpleBean;
 import org.jboss.test.kernel.dependency.support.SimpleBeanImpl;
+import org.jboss.test.kernel.dependency.support.SimplerBean;
 
 /**
  * Property Dependency Test Case.
@@ -64,12 +63,12 @@
       ControllerContext context1 = assertInstall(0, "Name1");
       ControllerContext context2 = assertInstall(1, "Name2");
       
-      SimpleBean bean1 = (SimpleBean) context1.getTarget();
+      SimplerBean bean1 = (SimplerBean) context1.getTarget();
       assertNotNull(bean1);
       assertEquals("String1", bean1.getString());
       
       GenericBeanFactory factory = (GenericBeanFactory) context2.getTarget(); 
-      SimpleBean bean2 = (SimpleBean) factory.createBean();
+      SimplerBean bean2 = (SimplerBean) factory.createBean();
       assertNotNull(bean2);
       assertEquals("String1", bean2.getString());
    }
@@ -87,12 +86,12 @@
       ControllerContext context1 = assertInstall(0, "Name1");
       assertEquals(ControllerState.INSTALLED, context2.getState());
       
-      SimpleBean bean1 = (SimpleBean) context1.getTarget();
+      SimplerBean bean1 = (SimplerBean) context1.getTarget();
       assertNotNull(bean1);
       assertEquals("String1", bean1.getString());
       
       GenericBeanFactory factory = (GenericBeanFactory) context2.getTarget(); 
-      SimpleBean bean2 = (SimpleBean) factory.createBean();
+      SimplerBean bean2 = (SimplerBean) factory.createBean();
       assertNotNull(bean2);
       assertEquals("String1", bean2.getString());
    }
@@ -109,12 +108,12 @@
       ControllerContext context1 = assertInstall(0, "Name1");
       ControllerContext context2 = assertInstall(1, "Name2");
       
-      SimpleBean bean1 = (SimpleBean) context1.getTarget();
+      SimplerBean bean1 = (SimplerBean) context1.getTarget();
       assertNotNull(bean1);
       assertEquals("String1", bean1.getString());
       
       GenericBeanFactory factory = (GenericBeanFactory) context2.getTarget(); 
-      SimpleBean bean2 = (SimpleBean) factory.createBean();
+      SimplerBean bean2 = (SimplerBean) factory.createBean();
       assertNotNull(bean2);
       assertEquals("String1", bean2.getString());
 
@@ -129,30 +128,30 @@
       context1 = assertInstall(0, "Name1");
       assertEquals(ControllerState.INSTALLED, context2.getState());
 
-      bean1 = (SimpleBean) context1.getTarget();
+      bean1 = (SimplerBean) context1.getTarget();
       assertNotNull(bean1);
       assertEquals("String1", bean1.getString());
       
       factory = (GenericBeanFactory) context2.getTarget(); 
-      bean2 = (SimpleBean) factory.createBean();
+      bean2 = (SimplerBean) factory.createBean();
       assertNotNull(bean2);
       assertEquals("String1", bean2.getString());
       
       assertUninstall("Name2");
       
       context1 = assertContext("Name1");
-      bean1 = (SimpleBean) context1.getTarget();
+      bean1 = (SimplerBean) context1.getTarget();
       assertNotNull(bean1);
       assertEquals("String1", bean1.getString());
       
       context2 = assertInstall(1, "Name2");
       
-      bean1 = (SimpleBean) context1.getTarget();
+      bean1 = (SimplerBean) context1.getTarget();
       assertNotNull(bean1);
       assertEquals("String1", bean1.getString());
       
       factory = (GenericBeanFactory) context2.getTarget(); 
-      bean2 = (SimpleBean) factory.createBean();
+      bean2 = (SimplerBean) factory.createBean();
       assertNotNull(bean2);
       assertEquals("String1", bean2.getString());
    }
@@ -167,9 +166,14 @@
       AbstractBeanMetaData metaData1 = new AbstractBeanMetaData("Name1", SimpleBeanImpl.class.getName());
       metaData1.addProperty(new AbstractPropertyMetaData("string", "String1"));
 
-      GenericBeanFactoryMetaData metaData2 = new GenericBeanFactoryMetaData("Name2", SimpleBeanImpl.class.getName());
+      GenericBeanFactoryMetaData metaData2 = createBeanFactory();
       metaData2.addBeanProperty(new AbstractPropertyMetaData("string", new AbstractDependencyValueMetaData("Name1", "string")));
 
       setBeanMetaDatas(new BeanMetaData[] { metaData1, metaData2 });
    }
+
+   protected GenericBeanFactoryMetaData createBeanFactory()
+   {
+      return new GenericBeanFactoryMetaData("Name2", SimpleBeanImpl.class.getName());
+   }
 }
\ No newline at end of file

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/PropertyDependencyTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/PropertyDependencyTestCase.java	2008-03-18 16:22:42 UTC (rev 70951)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/PropertyDependencyTestCase.java	2008-03-18 16:27:55 UTC (rev 70952)
@@ -32,7 +32,7 @@
 import org.jboss.beans.metadata.spi.PropertyMetaData;
 import org.jboss.dependency.spi.ControllerContext;
 import org.jboss.dependency.spi.ControllerState;
-import org.jboss.test.kernel.dependency.support.SimpleBean;
+import org.jboss.test.kernel.dependency.support.SimplerBean;
 import org.jboss.test.kernel.dependency.support.SimpleBeanImpl;
 
 /**
@@ -65,11 +65,11 @@
       ControllerContext context1 = assertInstall(0, "Name1");
       ControllerContext context2 = assertInstall(1, "Name2");
       
-      SimpleBean bean1 = (SimpleBean) context1.getTarget();
+      SimplerBean bean1 = (SimplerBean) context1.getTarget();
       assertNotNull(bean1);
       assertEquals("String1", bean1.getString());
       
-      SimpleBean bean2 = (SimpleBean) context2.getTarget();
+      SimplerBean bean2 = (SimplerBean) context2.getTarget();
       assertNotNull(bean2);
       assertEquals("String1", bean2.getString());
    }
@@ -87,11 +87,11 @@
       ControllerContext context1 = assertInstall(0, "Name1");
       assertEquals(ControllerState.INSTALLED, context2.getState());
       
-      SimpleBean bean1 = (SimpleBean) context1.getTarget();
+      SimplerBean bean1 = (SimplerBean) context1.getTarget();
       assertNotNull(bean1);
       assertEquals("String1", bean1.getString());
       
-      SimpleBean bean2 = (SimpleBean) context2.getTarget();
+      SimplerBean bean2 = (SimplerBean) context2.getTarget();
       assertNotNull(bean2);
       assertEquals("String1", bean2.getString());
    }
@@ -108,11 +108,11 @@
       ControllerContext context1 = assertInstall(0, "Name1");
       ControllerContext context2 = assertInstall(1, "Name2");
       
-      SimpleBean bean1 = (SimpleBean) context1.getTarget();
+      SimplerBean bean1 = (SimplerBean) context1.getTarget();
       assertNotNull(bean1);
       assertEquals("String1", bean1.getString());
       
-      SimpleBean bean2 = (SimpleBean) context2.getTarget();
+      SimplerBean bean2 = (SimplerBean) context2.getTarget();
       assertNotNull(bean2);
       assertEquals("String1", bean2.getString());
 
@@ -127,28 +127,28 @@
       context1 = assertInstall(0, "Name1");
       assertEquals(ControllerState.INSTALLED, context2.getState());
 
-      bean1 = (SimpleBean) context1.getTarget();
+      bean1 = (SimplerBean) context1.getTarget();
       assertNotNull(bean1);
       assertEquals("String1", bean1.getString());
       
-      bean2 = (SimpleBean) context2.getTarget();
+      bean2 = (SimplerBean) context2.getTarget();
       assertNotNull(bean2);
       assertEquals("String1", bean2.getString());
       
       assertUninstall("Name2");
       
       context1 = assertContext("Name1");
-      bean1 = (SimpleBean) context1.getTarget();
+      bean1 = (SimplerBean) context1.getTarget();
       assertNotNull(bean1);
       assertEquals("String1", bean1.getString());
       
       context2 = assertInstall(1, "Name2");
       
-      bean1 = (SimpleBean) context1.getTarget();
+      bean1 = (SimplerBean) context1.getTarget();
       assertNotNull(bean1);
       assertEquals("String1", bean1.getString());
       
-      bean2 = (SimpleBean) context2.getTarget();
+      bean2 = (SimplerBean) context2.getTarget();
       assertNotNull(bean2);
       assertEquals("String1", bean2.getString());
    }
@@ -160,16 +160,26 @@
 
    protected void buildMetaData()
    {
-      AbstractBeanMetaData metaData1 = new AbstractBeanMetaData("Name1", SimpleBeanImpl.class.getName());
+      AbstractBeanMetaData metaData1 = createName1();
       HashSet<PropertyMetaData> attributes1 = new HashSet<PropertyMetaData>();
       attributes1.add(new AbstractPropertyMetaData("string", "String1"));
       metaData1.setProperties(attributes1);
 
-      AbstractBeanMetaData metaData2 = new AbstractBeanMetaData("Name2", SimpleBeanImpl.class.getName());
+      AbstractBeanMetaData metaData2 = createName2();
       HashSet<PropertyMetaData> attributes2 = new HashSet<PropertyMetaData>();
       attributes2.add(new AbstractPropertyMetaData("string", new AbstractDependencyValueMetaData("Name1", "string")));
       metaData2.setProperties(attributes2);
 
       setBeanMetaDatas(new BeanMetaData[] { metaData1, metaData2 });
    }
+
+   protected AbstractBeanMetaData createName1()
+   {
+      return new AbstractBeanMetaData("Name1", SimpleBeanImpl.class.getName());
+   }
+
+   protected AbstractBeanMetaData createName2()
+   {
+      return new AbstractBeanMetaData("Name2", SimpleBeanImpl.class.getName());
+   }
 }
\ No newline at end of file

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/PropertyField2DependencyTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/PropertyField2DependencyTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/PropertyField2DependencyTestCase.java	2008-03-18 16:27:55 UTC (rev 70952)
@@ -0,0 +1,74 @@
+/*
+* 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.dependency.test;
+
+import junit.framework.Test;
+import org.jboss.beans.info.spi.BeanAccessMode;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.test.kernel.dependency.support.SimplerBeanImpl2;
+import org.jboss.test.AbstractTestDelegate;
+
+/**
+ * Property Field Dependency Test Case.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class PropertyField2DependencyTestCase extends PropertyDependencyTestCase
+{
+   public static Test suite()
+   {
+      return suite(PropertyField2DependencyTestCase.class);
+   }
+
+   public PropertyField2DependencyTestCase(String name) throws Throwable
+   {
+      super(name);
+   }
+
+   protected AbstractBeanMetaData createName1()
+   {
+      AbstractBeanMetaData metaData = new AbstractBeanMetaData("Name1", SimplerBeanImpl2.class.getName());
+      metaData.setAccessMode(BeanAccessMode.ALL);
+      return metaData;
+   }
+
+   protected AbstractBeanMetaData createName2()
+   {
+      AbstractBeanMetaData metaData = new AbstractBeanMetaData("Name2", SimplerBeanImpl2.class.getName());
+      metaData.setAccessMode(BeanAccessMode.ALL);
+      return metaData;
+   }
+
+   /**
+    * Default setup with security manager disabled
+    *
+    * @param clazz the class
+    * @return the delegate
+    * @throws Exception for any error
+    */
+   public static AbstractTestDelegate getDelegate(Class<?> clazz) throws Exception
+   {
+      AbstractTestDelegate delegate = new AbstractTestDelegate(clazz);
+      delegate.enableSecurity = false;
+      return delegate;
+   }
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/PropertyFieldDependencyTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/PropertyFieldDependencyTestCase.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/PropertyFieldDependencyTestCase.java	2008-03-18 16:27:55 UTC (rev 70952)
@@ -0,0 +1,59 @@
+/*
+* 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.dependency.test;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.info.spi.BeanAccessMode;
+import org.jboss.test.kernel.dependency.support.SimplerBeanImpl;
+
+/**
+ * Property Field Dependency Test Case.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class PropertyFieldDependencyTestCase extends PropertyDependencyTestCase
+{
+   public static Test suite()
+   {
+      return suite(PropertyFieldDependencyTestCase.class);
+   }
+
+   public PropertyFieldDependencyTestCase(String name) throws Throwable
+   {
+      super(name);
+   }
+
+   protected AbstractBeanMetaData createName1()
+   {
+      AbstractBeanMetaData metaData = new AbstractBeanMetaData("Name1", SimplerBeanImpl.class.getName());
+      metaData.setAccessMode(BeanAccessMode.FIELDS);
+      return metaData;
+   }
+
+   protected AbstractBeanMetaData createName2()
+   {
+      AbstractBeanMetaData metaData = new AbstractBeanMetaData("Name2", SimplerBeanImpl.class.getName());
+      metaData.setAccessMode(BeanAccessMode.FIELDS);
+      return metaData;
+   }
+}




More information about the jboss-cvs-commits mailing list