[Jboss-cvs] JBossAS SVN: r55826 - in branches/MC_VDF_WORK/system-jmx/src: resources/tests/org/jboss/test/system/controller/integration/test tests/org/jboss/test/system/controller/integration/support tests/org/jboss/test/system/controller/integration/test

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Aug 11 12:34:38 EDT 2006


Author: adrian at jboss.org
Date: 2006-08-11 12:34:29 -0400 (Fri, 11 Aug 2006)
New Revision: 55826

Added:
   branches/MC_VDF_WORK/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/JMXDependsMCUnitTestCase-mc.xml
   branches/MC_VDF_WORK/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/JMXDependsMCUnitTestCase.xml
   branches/MC_VDF_WORK/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/MCDependsJMXUnitTestCase-mc.xml
   branches/MC_VDF_WORK/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/MCDependsJMXUnitTestCase.xml
   branches/MC_VDF_WORK/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/JMXDependsMCUnitTestCase.java
   branches/MC_VDF_WORK/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/MCDependsJMXUnitTestCase.java
Modified:
   branches/MC_VDF_WORK/system-jmx/src/tests/org/jboss/test/system/controller/integration/support/SimpleBean.java
   branches/MC_VDF_WORK/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/IntegrationTestDelegate.java
   branches/MC_VDF_WORK/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/IntegrationTestSuite.java
Log:
[JBAS-1841] - Tests for plain <depends> between JMX and MC.

Added: branches/MC_VDF_WORK/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/JMXDependsMCUnitTestCase-mc.xml
===================================================================
--- branches/MC_VDF_WORK/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/JMXDependsMCUnitTestCase-mc.xml	2006-08-11 16:33:16 UTC (rev 55825)
+++ branches/MC_VDF_WORK/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/JMXDependsMCUnitTestCase-mc.xml	2006-08-11 16:34:29 UTC (rev 55826)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+   <bean name="Test" class="org.jboss.test.system.controller.integration.support.SimpleBean"/>
+</deployment>

Added: branches/MC_VDF_WORK/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/JMXDependsMCUnitTestCase.xml
===================================================================
--- branches/MC_VDF_WORK/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/JMXDependsMCUnitTestCase.xml	2006-08-11 16:33:16 UTC (rev 55825)
+++ branches/MC_VDF_WORK/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/JMXDependsMCUnitTestCase.xml	2006-08-11 16:34:29 UTC (rev 55826)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<server>
+   <mbean name="jboss.test:type=test" code="org.jboss.test.system.controller.support.Simple">
+      <depends>Test</depends>
+   </mbean>
+</server>
\ No newline at end of file

Added: branches/MC_VDF_WORK/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/MCDependsJMXUnitTestCase-mc.xml
===================================================================
--- branches/MC_VDF_WORK/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/MCDependsJMXUnitTestCase-mc.xml	2006-08-11 16:33:16 UTC (rev 55825)
+++ branches/MC_VDF_WORK/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/MCDependsJMXUnitTestCase-mc.xml	2006-08-11 16:34:29 UTC (rev 55826)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+   <bean name="Test" class="org.jboss.test.system.controller.integration.support.SimpleBean">
+      <depends>jboss.test:type=test</depends>
+   </bean>
+</deployment>

Added: branches/MC_VDF_WORK/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/MCDependsJMXUnitTestCase.xml
===================================================================
--- branches/MC_VDF_WORK/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/MCDependsJMXUnitTestCase.xml	2006-08-11 16:33:16 UTC (rev 55825)
+++ branches/MC_VDF_WORK/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/MCDependsJMXUnitTestCase.xml	2006-08-11 16:34:29 UTC (rev 55826)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<server>
+   <mbean name="jboss.test:type=test" code="org.jboss.test.system.controller.support.Simple"/>
+</server>
\ No newline at end of file

Modified: branches/MC_VDF_WORK/system-jmx/src/tests/org/jboss/test/system/controller/integration/support/SimpleBean.java
===================================================================
--- branches/MC_VDF_WORK/system-jmx/src/tests/org/jboss/test/system/controller/integration/support/SimpleBean.java	2006-08-11 16:33:16 UTC (rev 55825)
+++ branches/MC_VDF_WORK/system-jmx/src/tests/org/jboss/test/system/controller/integration/support/SimpleBean.java	2006-08-11 16:34:29 UTC (rev 55826)
@@ -21,6 +21,7 @@
 */
 package org.jboss.test.system.controller.integration.support;
 
+import org.jboss.test.system.controller.support.Order;
 import org.jboss.test.system.controller.support.Simple;
 
 /**
@@ -33,6 +34,11 @@
 {
    /** Injection */
    private Simple simple;
+   
+   public int createOrder;
+   public int startOrder;
+   public int stopOrder;
+   public int destroyOrder;
 
    /**
     * Create a new SimpleBean.
@@ -71,14 +77,26 @@
       this.simple = simple;
    }
    
+   public void create()
+   {
+      createOrder = Order.getOrder();
+   }
+   
+   public void start()
+   {
+      startOrder = Order.getOrder();
+   }
+   
    public void create(Simple simple)
    {
       this.simple = simple;
+      createOrder = Order.getOrder();
    }
    
    public void start(Simple simple)
    {
       this.simple = simple;
+      startOrder = Order.getOrder();
    }
    
    public void install(Simple simple)

Modified: branches/MC_VDF_WORK/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/IntegrationTestDelegate.java
===================================================================
--- branches/MC_VDF_WORK/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/IntegrationTestDelegate.java	2006-08-11 16:33:16 UTC (rev 55825)
+++ branches/MC_VDF_WORK/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/IntegrationTestDelegate.java	2006-08-11 16:34:29 UTC (rev 55826)
@@ -167,7 +167,7 @@
       KernelController controller = kernel.getController();
       ControllerContext context = controller.getContext(name, state);
       if (context == null)
-         throw new IllegalStateException("Bean not found " + name);
+         throw new IllegalStateException("Context not found: " + name);
       return context;
    }
 

Modified: branches/MC_VDF_WORK/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/IntegrationTestSuite.java
===================================================================
--- branches/MC_VDF_WORK/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/IntegrationTestSuite.java	2006-08-11 16:33:16 UTC (rev 55825)
+++ branches/MC_VDF_WORK/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/IntegrationTestSuite.java	2006-08-11 16:34:29 UTC (rev 55826)
@@ -48,6 +48,8 @@
       suite.addTest(StartMCFromJMXUnitTestCase.suite());
       suite.addTest(InstallMCFromJMXUnitTestCase.suite());
       suite.addTest(ConfigureJMXFromMCUnitTestCase.suite());
+      suite.addTest(MCDependsJMXUnitTestCase.suite());
+      suite.addTest(JMXDependsMCUnitTestCase.suite());
       
       return suite;
    }

Added: branches/MC_VDF_WORK/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/JMXDependsMCUnitTestCase.java
===================================================================
--- branches/MC_VDF_WORK/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/JMXDependsMCUnitTestCase.java	2006-08-11 16:33:16 UTC (rev 55825)
+++ branches/MC_VDF_WORK/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/JMXDependsMCUnitTestCase.java	2006-08-11 16:34:29 UTC (rev 55826)
@@ -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.system.controller.integration.test;
+
+import junit.framework.Test;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.test.system.controller.integration.support.SimpleBean;
+import org.jboss.test.system.controller.support.Simple;
+
+/**
+ * JMXDependsMCUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class JMXDependsMCUnitTestCase extends AbstractIntegrationTest
+{
+   public static Test suite()
+   {
+      return suite(JMXDependsMCUnitTestCase.class);
+   }
+
+   public JMXDependsMCUnitTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public void testMCDependsJMX() throws Throwable
+   {
+      ControllerContext mbeanContext = getControllerContext("jboss.test:type=test");
+      assertNotNull(mbeanContext);
+      Object mbean = mbeanContext.getTarget();
+      assertNotNull(mbean);
+      Simple simple = assertInstanceOf(Simple.class, mbean);
+
+      ControllerContext beanContext = getControllerContext("Test");
+      assertNotNull(beanContext);
+      Object bean = beanContext.getTarget();
+      assertNotNull(bean);
+      SimpleBean simpleBean = assertInstanceOf(SimpleBean.class, bean);
+      
+      assertEquals(2, simple.createOrder);
+      assertEquals(4, simple.startOrder);
+      assertEquals(1, simpleBean.createOrder);
+      assertEquals(3, simpleBean.startOrder);
+   }
+}

Added: branches/MC_VDF_WORK/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/MCDependsJMXUnitTestCase.java
===================================================================
--- branches/MC_VDF_WORK/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/MCDependsJMXUnitTestCase.java	2006-08-11 16:33:16 UTC (rev 55825)
+++ branches/MC_VDF_WORK/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/MCDependsJMXUnitTestCase.java	2006-08-11 16:34:29 UTC (rev 55826)
@@ -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.system.controller.integration.test;
+
+import junit.framework.Test;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.test.system.controller.integration.support.SimpleBean;
+import org.jboss.test.system.controller.support.Simple;
+
+/**
+ * MCDependsJMXUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class MCDependsJMXUnitTestCase extends AbstractIntegrationTest
+{
+   public static Test suite()
+   {
+      return suite(MCDependsJMXUnitTestCase.class);
+   }
+   
+   public MCDependsJMXUnitTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public void testMCDependsJMX() throws Throwable
+   {
+      ControllerContext mbeanContext = getControllerContext("jboss.test:type=test");
+      assertNotNull(mbeanContext);
+      Object mbean = mbeanContext.getTarget();
+      assertNotNull(mbean);
+      Simple simple = assertInstanceOf(Simple.class, mbean);
+
+      ControllerContext beanContext = getControllerContext("Test");
+      assertNotNull(beanContext);
+      Object bean = beanContext.getTarget();
+      assertNotNull(bean);
+      SimpleBean simpleBean = assertInstanceOf(SimpleBean.class, bean);
+      
+      assertEquals(1, simple.createOrder);
+      assertEquals(2, simple.startOrder);
+      assertEquals(3, simpleBean.createOrder);
+      assertEquals(4, simpleBean.startOrder);
+   }
+}




More information about the jboss-cvs-commits mailing list