[jboss-cvs] JBossAS SVN: r71025 - in projects/microcontainer/trunk/kernel/src: tests/org/jboss/test/kernel/dependency/test and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Mar 19 15:39:27 EDT 2008


Author: scott.stark at jboss.org
Date: 2008-03-19 15:39:26 -0400 (Wed, 19 Mar 2008)
New Revision: 71025

Added:
   projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/PooledBeanFactoryTestCase.xml
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/Bean1Type.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/Bean2Type.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/BeanContainer.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/BeanUser.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/TestPooledBeanFactory.java
Modified:
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/GenericBeanFactoryFieldPropertyDependencyTestCase.java
Log:
Add beanfactory work test classes

Added: projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/PooledBeanFactoryTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/PooledBeanFactoryTestCase.xml	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/PooledBeanFactoryTestCase.xml	2008-03-19 19:39:26 UTC (rev 71025)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+   <beanfactory name="PooledFactoryType1"
+      factoryClass="org.jboss.test.kernel.deployment.support.container.TestPooledBeanFactory"
+      class="org.jboss.test.kernel.deployment.support.container.BeanType1">
+      <property name="prop1">prop1DefaultValue</property>
+   </beanfactory>
+   <bean name="BeanContainerType1" class="org.jboss.test.kernel.deployment.support.container.BeanContainer">
+      <property name="factory"><inject bean="PooledFactoryType1"/></property>
+   </bean>
+
+   <beanfactory name="PooledFactoryType2"
+      factoryClass="org.jboss.test.kernel.deployment.support.container.TestPooledBeanFactory"
+      class="org.jboss.test.kernel.deployment.support.container.BeanType2">
+      <property name="bean1"><inject bean="BeanContainerType1" property="bean"/></property>
+   </beanfactory>
+   <bean name="BeanContainerType2" class="org.jboss.test.kernel.deployment.support.container.BeanContainer">
+      <property name="factory"><inject bean="PooledFactoryType2"/></property>
+   </bean>
+
+   <bean name="BeanUser#1" class="org.jboss.test.kernel.deployment.support.container.BeanUser">
+      <property name="bean1"><inject bean="BeanContainerType1" property="bean"/></property>
+      <property name="bean2"><inject bean="BeanContainerType2" property="bean"/></property>
+   </bean>
+   <bean name="BeanUser#2" class="org.jboss.test.kernel.deployment.support.container.BeanUser">
+      <property name="bean1"><inject bean="BeanContainerType1" property="bean"/></property>
+      <property name="bean2"><inject bean="BeanContainerType2" property="bean"/></property>
+   </bean>
+</deployment>


Property changes on: projects/microcontainer/trunk/kernel/src/resources/tests/org/jboss/test/kernel/deployment/test/PooledBeanFactoryTestCase.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Modified: 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	2008-03-19 18:40:55 UTC (rev 71024)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/dependency/test/GenericBeanFactoryFieldPropertyDependencyTestCase.java	2008-03-19 19:39:26 UTC (rev 71025)
@@ -44,6 +44,7 @@
       super(name);
    }
 
+   @SuppressWarnings("deprecation")
    protected GenericBeanFactoryMetaData createBeanFactory()
    {
       GenericBeanFactoryMetaData beanFactoryMetaData = new GenericBeanFactoryMetaData("Name2", SimplerBeanImpl.class.getName());

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/Bean1Type.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/Bean1Type.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/Bean1Type.java	2008-03-19 19:39:26 UTC (rev 71025)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * 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.support.container;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class Bean1Type
+{
+   private String prop1;
+
+   public String getProp1()
+   {
+      return prop1;
+   }
+   public void setProp1(String prop1)
+   {
+      this.prop1 = prop1;
+   }
+}


Property changes on: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/Bean1Type.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/Bean2Type.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/Bean2Type.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/Bean2Type.java	2008-03-19 19:39:26 UTC (rev 71025)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * 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.support.container;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class Bean2Type
+{
+   private Bean1Type bean1;
+
+   public Bean1Type getBean1()
+   {
+      return bean1;
+   }
+
+   public void setBean1(Bean1Type bean1)
+   {
+      this.bean1 = bean1;
+   }
+}


Property changes on: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/Bean2Type.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/BeanContainer.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/BeanContainer.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/BeanContainer.java	2008-03-19 19:39:26 UTC (rev 71025)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * 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.support.container;
+
+import org.jboss.beans.metadata.spi.factory.BeanFactory;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class BeanContainer<T>
+{
+   private BeanFactory factory;
+
+   
+   public BeanFactory getFactory()
+   {
+      return factory;
+   }
+
+
+   public void setFactory(BeanFactory factory)
+   {
+      this.factory = factory;
+   }
+
+
+   public T getBean()
+      throws Throwable
+   {
+      T bean = (T) factory.createBean();
+      return bean;
+   }
+}


Property changes on: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/BeanContainer.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/BeanUser.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/BeanUser.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/BeanUser.java	2008-03-19 19:39:26 UTC (rev 71025)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * 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.support.container;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class BeanUser
+{
+   private Bean1Type bean1;
+   private Bean2Type bean2;
+
+   public Bean1Type getBean1()
+   {
+      return bean1;
+   }
+   public void setBean1(Bean1Type bean1)
+   {
+      this.bean1 = bean1;
+   }
+   public Bean2Type getBean2()
+   {
+      return bean2;
+   }
+   public void setBean2(Bean2Type bean2)
+   {
+      this.bean2 = bean2;
+   }
+
+   
+}


Property changes on: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/BeanUser.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/TestPooledBeanFactory.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/TestPooledBeanFactory.java	                        (rev 0)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/TestPooledBeanFactory.java	2008-03-19 19:39:26 UTC (rev 71025)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * 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.support.container;
+
+import java.util.concurrent.ArrayBlockingQueue;
+
+import org.jboss.beans.metadata.plugins.factory.GenericBeanFactory;
+import org.jboss.kernel.spi.config.KernelConfigurator;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class TestPooledBeanFactory extends GenericBeanFactory
+{
+   /** The pooling policy */
+   private ArrayBlockingQueue pool;
+
+   public TestPooledBeanFactory(KernelConfigurator configurator, int size)
+   {
+      super(configurator);
+      pool = new ArrayBlockingQueue(size);
+   }
+
+   @Override
+   public synchronized Object createBean()
+      throws Throwable
+   {
+      if(pool.size() == 0)
+      {
+         // Fill the pool
+         for(int n = 0; n < pool.size(); n ++)
+            pool.put(super.createBean());
+      }
+      return pool.take();
+   }
+   public void destroyBean(Object bean)
+      throws Exception
+   {
+      pool.put(bean);
+   }
+}


Property changes on: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/deployment/support/container/TestPooledBeanFactory.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native




More information about the jboss-cvs-commits mailing list