[jboss-cvs] JBossAS SVN: r85315 - in projects/webbeans-ri-int/trunk/microcontainer/src/test: java/org/jboss/test/webbeans/deployers/test and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Mar 5 13:28:17 EST 2009


Author: alesj
Date: 2009-03-05 13:28:17 -0500 (Thu, 05 Mar 2009)
New Revision: 85315

Added:
   projects/webbeans-ri-int/trunk/microcontainer/src/test/java/org/jboss/test/webbeans/deployers/support/CheckableBootstrap.java
   projects/webbeans-ri-int/trunk/microcontainer/src/test/java/org/jboss/test/webbeans/deployers/support/MockTransactionServices.java
Modified:
   projects/webbeans-ri-int/trunk/microcontainer/src/test/java/org/jboss/test/webbeans/deployers/support/MockBootDeployer.java
   projects/webbeans-ri-int/trunk/microcontainer/src/test/java/org/jboss/test/webbeans/deployers/support/MockWBBootstrap.java
   projects/webbeans-ri-int/trunk/microcontainer/src/test/java/org/jboss/test/webbeans/deployers/test/BootDeployerTestCase.java
   projects/webbeans-ri-int/trunk/microcontainer/src/test/resources/org/jboss/test/webbeans/deployers/test/BootDeployerTestCase.xml
Log:
Update boot test with TS.

Added: projects/webbeans-ri-int/trunk/microcontainer/src/test/java/org/jboss/test/webbeans/deployers/support/CheckableBootstrap.java
===================================================================
--- projects/webbeans-ri-int/trunk/microcontainer/src/test/java/org/jboss/test/webbeans/deployers/support/CheckableBootstrap.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/microcontainer/src/test/java/org/jboss/test/webbeans/deployers/support/CheckableBootstrap.java	2009-03-05 18:28:17 UTC (rev 85315)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.webbeans.deployers.support;
+
+import org.jboss.webbeans.bootstrap.api.Bootstrap;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public interface CheckableBootstrap extends Bootstrap
+{
+   boolean isInit();
+
+   boolean isBoot();
+
+   boolean isShutdown();
+}

Modified: projects/webbeans-ri-int/trunk/microcontainer/src/test/java/org/jboss/test/webbeans/deployers/support/MockBootDeployer.java
===================================================================
--- projects/webbeans-ri-int/trunk/microcontainer/src/test/java/org/jboss/test/webbeans/deployers/support/MockBootDeployer.java	2009-03-05 18:16:10 UTC (rev 85314)
+++ projects/webbeans-ri-int/trunk/microcontainer/src/test/java/org/jboss/test/webbeans/deployers/support/MockBootDeployer.java	2009-03-05 18:28:17 UTC (rev 85315)
@@ -33,6 +33,8 @@
 import org.jboss.webbeans.integration.microcontainer.deployer.env.WebBeanDiscoveryEnvironment;
 
 /**
+ * Mock wb boot deployer.
+ * 
  * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
  */
 public class MockBootDeployer extends AbstractSimpleRealDeployer<WebBeanDiscoveryEnvironment>
@@ -59,10 +61,12 @@
       bootstrap.addPropertyMetaData("webBeanDiscovery", bootstrap.createInject(envName));
       bootstrap.addPropertyMetaData("ejbDiscovery", createEjbConnector("JBossEjbDiscovery", "org.jboss.test.webbeans.deployers.support.MockEjbDiscovery", unit));
       bootstrap.addPropertyMetaData("ejbResolver", createEjbConnector("JBossEjbResolver", "org.jboss.test.webbeans.deployers.support.MockEjbResolver", unit));
+      bootstrap.addPropertyMetaData("transactionServices", bootstrap.createInject("JBossTransactionServices"));
       bootstrap.addPropertyMetaData("applicationContext", createBeanStore());
       bootstrap.setCreate("initialize");
       bootstrap.setStart("boot");
       bootstrap.setDestroy("shutdown");
+      bootstrap.addDependency("RealTransactionManager"); // so we know TM is present in JBossTransactionServices
       unit.addAttachment(bootstrapName + "_" + BeanMetaData.class.getSimpleName(), bootstrap.getBeanMetaData());
    }
 

Copied: projects/webbeans-ri-int/trunk/microcontainer/src/test/java/org/jboss/test/webbeans/deployers/support/MockTransactionServices.java (from rev 85285, projects/webbeans-ri-int/trunk/microcontainer/src/test/java/org/jboss/test/webbeans/deployers/support/MockEjbDiscovery.java)
===================================================================
--- projects/webbeans-ri-int/trunk/microcontainer/src/test/java/org/jboss/test/webbeans/deployers/support/MockTransactionServices.java	                        (rev 0)
+++ projects/webbeans-ri-int/trunk/microcontainer/src/test/java/org/jboss/test/webbeans/deployers/support/MockTransactionServices.java	2009-03-05 18:28:17 UTC (rev 85315)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.webbeans.deployers.support;
+
+import org.jboss.webbeans.transaction.spi.TransactionServices;
+
+/**
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class MockTransactionServices implements TransactionServices
+{
+   public void executeBeforeTransactionCompletion(Runnable task)
+   {
+   }
+
+   public void executeAfterTransactionCompletion(Runnable task)
+   {
+   }
+
+   public void executeAfterTransactionCompletion(Runnable task, Status desiredStatus)
+   {
+   }
+
+   public boolean isTransactionActive()
+   {
+      return false;
+   }
+}
\ No newline at end of file

Modified: projects/webbeans-ri-int/trunk/microcontainer/src/test/java/org/jboss/test/webbeans/deployers/support/MockWBBootstrap.java
===================================================================
--- projects/webbeans-ri-int/trunk/microcontainer/src/test/java/org/jboss/test/webbeans/deployers/support/MockWBBootstrap.java	2009-03-05 18:16:10 UTC (rev 85314)
+++ projects/webbeans-ri-int/trunk/microcontainer/src/test/java/org/jboss/test/webbeans/deployers/support/MockWBBootstrap.java	2009-03-05 18:28:17 UTC (rev 85315)
@@ -27,14 +27,19 @@
 /**
  * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
  */
-public class MockWBBootstrap extends AbstractBootstrap
+public class MockWBBootstrap extends AbstractBootstrap implements CheckableBootstrap
 {
+   private boolean init;
+   private boolean boot;
+   private boolean shutdown;
+
    public MockWBBootstrap()
    {
    }
 
    public void initialize()
    {
+      init = true;
    }
 
    public WebBeansManager getManager()
@@ -44,9 +49,26 @@
 
    public void boot()
    {
+      boot = true;
    }
 
    public void shutdown()
    {
+      shutdown = true;
    }
+
+   public boolean isInit()
+   {
+      return init;
+   }
+
+   public boolean isBoot()
+   {
+      return boot;
+   }
+
+   public boolean isShutdown()
+   {
+      return shutdown;
+   }
 }
\ No newline at end of file

Modified: projects/webbeans-ri-int/trunk/microcontainer/src/test/java/org/jboss/test/webbeans/deployers/test/BootDeployerTestCase.java
===================================================================
--- projects/webbeans-ri-int/trunk/microcontainer/src/test/java/org/jboss/test/webbeans/deployers/test/BootDeployerTestCase.java	2009-03-05 18:16:10 UTC (rev 85314)
+++ projects/webbeans-ri-int/trunk/microcontainer/src/test/java/org/jboss/test/webbeans/deployers/test/BootDeployerTestCase.java	2009-03-05 18:28:17 UTC (rev 85315)
@@ -23,8 +23,8 @@
 
 import junit.framework.Test;
 import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.test.webbeans.deployers.support.CheckableBootstrap;
 import org.jboss.virtual.VirtualFile;
-import org.jboss.webbeans.bootstrap.api.Bootstrap;
 
 /**
  * Test boot deployer.
@@ -45,6 +45,7 @@
 
    public void testEar() throws Exception
    {
+      CheckableBootstrap bootstrap;
       VirtualFile ear = createBasicEar();
       DeploymentUnit earDU = assertDeploy(ear);
       try
@@ -52,11 +53,15 @@
          String earName = earDU.getName();
          String bootName = earName + "_WebBeansBootstrap";
          Object boot = getBean(bootName);
-         assertInstanceOf(boot, Bootstrap.class, false);
+         bootstrap = assertInstanceOf(boot, CheckableBootstrap.class, false);
+         assertTrue(bootstrap.isInit());
+         assertTrue(bootstrap.isBoot());
+         assertFalse(bootstrap.isShutdown());         
       }
       finally
       {
          undeploy(earDU);
       }
+      assertTrue(bootstrap.isShutdown());
    }
 }
\ No newline at end of file

Modified: projects/webbeans-ri-int/trunk/microcontainer/src/test/resources/org/jboss/test/webbeans/deployers/test/BootDeployerTestCase.xml
===================================================================
--- projects/webbeans-ri-int/trunk/microcontainer/src/test/resources/org/jboss/test/webbeans/deployers/test/BootDeployerTestCase.xml	2009-03-05 18:16:10 UTC (rev 85314)
+++ projects/webbeans-ri-int/trunk/microcontainer/src/test/resources/org/jboss/test/webbeans/deployers/test/BootDeployerTestCase.xml	2009-03-05 18:28:17 UTC (rev 85315)
@@ -15,4 +15,8 @@
 
   <beanfactory name="JBossEjbDiscovery" class="org.jboss.test.webbeans.deployers.support.MockEjbDiscovery"/>
 
+  <bean name="JBossTransactionServices" class="org.jboss.test.webbeans.deployers.support.MockTransactionServices"/>
+
+  <bean name="RealTransactionManager" class="java.lang.Object"/>
+
 </deployment>




More information about the jboss-cvs-commits mailing list