[jboss-cvs] JBoss Messaging SVN: r4619 - in trunk: tests/config and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jun 27 13:12:38 EDT 2008


Author: ataylor
Date: 2008-06-27 13:12:38 -0400 (Fri, 27 Jun 2008)
New Revision: 4619

Added:
   trunk/tests/config/beans1.xml
   trunk/tests/src/org/jboss/messaging/tests/unit/microcontainer/
   trunk/tests/src/org/jboss/messaging/tests/unit/microcontainer/DummyBean.java
   trunk/tests/src/org/jboss/messaging/tests/unit/microcontainer/JBMBootstrapServerTest.java
Modified:
   trunk/build-messaging.xml
Log:
MC test

Modified: trunk/build-messaging.xml
===================================================================
--- trunk/build-messaging.xml	2008-06-27 17:10:47 UTC (rev 4618)
+++ trunk/build-messaging.xml	2008-06-27 17:12:38 UTC (rev 4619)
@@ -220,6 +220,12 @@
       <path refid="slf4j.api.classpath"/>
       <path refid="slf4j.log4j.classpath"/>
    	<path refid="cglib.classpath" />
+      <path refid="jboss.common.core.classpath"/>
+      <path refid="jboss.aop.classpath"/>
+      <path refid="trove.trove.classpath"/>
+      <path refid="javassist.classpath"/>
+      <path refid="jboss.jbossxb.classpath"/>
+      <path refid="apache.xerces.classpath"/>
    </path>
 
    <path id="jms.test.execution.classpath">

Added: trunk/tests/config/beans1.xml
===================================================================
--- trunk/tests/config/beans1.xml	                        (rev 0)
+++ trunk/tests/config/beans1.xml	2008-06-27 17:12:38 UTC (rev 4619)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+   <bean name="bean" class="org.jboss.messaging.tests.unit.microcontainer.DummyBean"/>
+</deployment>
\ No newline at end of file

Added: trunk/tests/src/org/jboss/messaging/tests/unit/microcontainer/DummyBean.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/microcontainer/DummyBean.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/microcontainer/DummyBean.java	2008-06-27 17:12:38 UTC (rev 4619)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-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.messaging.tests.unit.microcontainer;
+
+/**
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class DummyBean
+{
+   public static boolean started = false;
+   public void start()
+   {
+      started = true;
+   }
+
+   public void stop()
+   {
+      started = false;
+   }
+}

Added: trunk/tests/src/org/jboss/messaging/tests/unit/microcontainer/JBMBootstrapServerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/microcontainer/JBMBootstrapServerTest.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/microcontainer/JBMBootstrapServerTest.java	2008-06-27 17:12:38 UTC (rev 4619)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-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.messaging.tests.unit.microcontainer;
+
+import org.jboss.kernel.plugins.config.property.PropertyKernelConfig;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.jboss.messaging.microcontainer.JBMBootstrapServer;
+import org.jboss.messaging.tests.util.UnitTestCase;
+
+import java.util.Properties;
+
+/**
+ * @author <a href="ataylor at redhat.com">Andy Taylor</a>
+ */
+public class JBMBootstrapServerTest extends UnitTestCase
+{
+   private static  String beans1 = "beans1.xml";
+
+   private static String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+           "\n" +
+           "<deployment xmlns=\"urn:jboss:bean-deployer:2.0\">\n" +
+           "   <bean name=\"bean\" class=\"org.jboss.messaging.tests.unit.microcontainer.DummyBean\"/>\n" +
+           "</deployment>";
+
+   public void testMain() throws Exception
+   {
+      JBMBootstrapServer.main(new String[]{beans1});
+      assertTrue(DummyBean.started);
+   }
+   public void testRun() throws Exception
+   {
+      JBMBootstrapServer bootstrap = new JBMBootstrapServer(new String[]{beans1});
+      bootstrap.run();
+      assertTrue(DummyBean.started);
+      bootstrap.shutDown();
+      assertFalse(DummyBean.started);
+   }
+
+   public void testRunWithConfig() throws Exception
+   {
+      Properties properties = new Properties();
+      properties.setProperty("test", "foo");
+      JBMBootstrapServer bootstrap = new JBMBootstrapServer(new String[]{beans1}, new PropertyKernelConfig(properties));
+      bootstrap.run();
+      assertTrue(DummyBean.started);
+      bootstrap.shutDown();
+      assertFalse(DummyBean.started);
+   }
+
+   public void testDeploy() throws Throwable
+   {
+      JBMBootstrapServer bootstrap = new JBMBootstrapServer(new String[]{});
+      bootstrap.run();
+      assertFalse(DummyBean.started);
+      KernelDeployment kernelDeployment = bootstrap.deploy(beans1);
+      assertTrue(DummyBean.started);
+      bootstrap.undeploy(kernelDeployment);
+      assertFalse(DummyBean.started);
+      bootstrap.shutDown();
+   }
+
+   public void testDeployXml() throws Throwable
+   {
+      JBMBootstrapServer bootstrap = new JBMBootstrapServer(new String[]{});
+      bootstrap.run();
+      assertFalse(DummyBean.started);
+      KernelDeployment kernelDeployment = bootstrap.deploy("test", xml);
+      assertTrue(DummyBean.started);
+      bootstrap.undeploy(kernelDeployment);
+      assertFalse(DummyBean.started);
+      bootstrap.shutDown();
+   }
+}




More information about the jboss-cvs-commits mailing list