[jboss-cvs] JBossAS SVN: r59660 - in trunk/system-jmx/src: tests/org/jboss/test/system/controller and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jan 15 17:13:45 EST 2007


Author: scott.stark at jboss.org
Date: 2007-01-15 17:13:38 -0500 (Mon, 15 Jan 2007)
New Revision: 59660

Added:
   trunk/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/InstallMCToJMXUnitTestCase-mc.xml
   trunk/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/InstallMCToJMXUnitTestCase.xml
   trunk/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/InstallMCToJMXUnitTestCase.java
Modified:
   trunk/system-jmx/src/tests/org/jboss/test/system/controller/ControllerTestDelegate.java
   trunk/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/InjectMCFromJMXTest.java
   trunk/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/IntegrationTestDelegate.java
Log:
Add a test of injecting an mc bean into a jmx mbean during the mc bean install action.

Added: trunk/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/InstallMCToJMXUnitTestCase-mc.xml
===================================================================
--- trunk/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/InstallMCToJMXUnitTestCase-mc.xml	2007-01-15 21:13:51 UTC (rev 59659)
+++ trunk/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/InstallMCToJMXUnitTestCase-mc.xml	2007-01-15 22:13:38 UTC (rev 59660)
@@ -0,0 +1,9 @@
+<?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">
+      <install bean="jboss.test:type=test" method="setSimpleBean">
+         <parameter><this/></parameter>
+      </install>
+   </bean>
+</deployment>


Property changes on: trunk/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/InstallMCToJMXUnitTestCase-mc.xml
___________________________________________________________________
Name: svn:keywords
   + Id,Revision
Name: svn:eol-style
   + native

Added: trunk/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/InstallMCToJMXUnitTestCase.xml
===================================================================
--- trunk/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/InstallMCToJMXUnitTestCase.xml	2007-01-15 21:13:51 UTC (rev 59659)
+++ trunk/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/InstallMCToJMXUnitTestCase.xml	2007-01-15 22:13:38 UTC (rev 59660)
@@ -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>


Property changes on: trunk/system-jmx/src/resources/tests/org/jboss/test/system/controller/integration/test/InstallMCToJMXUnitTestCase.xml
___________________________________________________________________
Name: svn:keywords
   + Id,Revision
Name: svn:eol-style
   + native

Modified: trunk/system-jmx/src/tests/org/jboss/test/system/controller/ControllerTestDelegate.java
===================================================================
--- trunk/system-jmx/src/tests/org/jboss/test/system/controller/ControllerTestDelegate.java	2007-01-15 21:13:51 UTC (rev 59659)
+++ trunk/system-jmx/src/tests/org/jboss/test/system/controller/ControllerTestDelegate.java	2007-01-15 22:13:38 UTC (rev 59660)
@@ -47,7 +47,7 @@
  * ControllerTestDelegate.
  * 
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
+ * @version $Revision$
  */
 public abstract class ControllerTestDelegate extends AbstractTestDelegate
 {
@@ -71,7 +71,16 @@
    {
       return serviceController;
    }
-   
+
+   /**
+    * Override to:
+    * Set javax.management.builder.initial to org.jboss.mx.server.MBeanServerBuilderImpl
+    * Create jboss domain MBeanServer
+    * Create and register jboss.system:service=ServiceController mbean
+    * Create SimpleSARDeployer
+    * deploy the test service mbeans
+    * @see #deploy()
+    */
    public void setUp() throws Exception
    {
       super.setUp();
@@ -150,6 +159,14 @@
          throw ide;
    }
    
+   /**
+    * Deploy the beans by looking for an xml descriptor named
+    * clazz.getName().replace('.', '/') + ".xml". If the test
+    * clazz includes a NewUnitTestCase or OldUnitTestCase suffix,
+    * this is removed.
+    * 
+    * @throws Exception for any error
+    */
    protected void deploy() throws Exception
    {
       String testName = clazz.getName();


Property changes on: trunk/system-jmx/src/tests/org/jboss/test/system/controller/ControllerTestDelegate.java
___________________________________________________________________
Name: svn:keywords
   + Id, Revision

Modified: trunk/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/InjectMCFromJMXTest.java
===================================================================
--- trunk/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/InjectMCFromJMXTest.java	2007-01-15 21:13:51 UTC (rev 59659)
+++ trunk/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/InjectMCFromJMXTest.java	2007-01-15 22:13:38 UTC (rev 59660)
@@ -25,10 +25,10 @@
 import org.jboss.test.system.controller.integration.support.SimpleBean;
 
 /**
- * InjectMCFromJMXTest.
+ * InjectMCFromJMXTest base class for validating injection of JMX mbean into an MC bean.
  * 
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
+ * @version $Revision$
  */
 public abstract class InjectMCFromJMXTest extends AbstractIntegrationTest
 {
@@ -36,7 +36,18 @@
    {
       super(name);
    }
-   
+
+   /**
+    * Validate that:
+    * 
+    * jboss.test:type=test mbean context exists
+    * jboss.test:type=test target is not null
+    * Test bean context exists
+    * Test bean target is not null and an instanceof SimpleBean
+    * That the Test.simpleBean property value injected was the jboss.test:type=test instance
+    * 
+    * @throws Throwable
+    */
    public void checkInject() throws Throwable
    {
       ControllerContext mbeanContext = getControllerContext("jboss.test:type=test");


Property changes on: trunk/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/InjectMCFromJMXTest.java
___________________________________________________________________
Name: svn:keywords
   + Id, Revision

Added: trunk/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/InstallMCToJMXUnitTestCase.java
===================================================================
--- trunk/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/InstallMCToJMXUnitTestCase.java	2007-01-15 21:13:51 UTC (rev 59659)
+++ trunk/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/InstallMCToJMXUnitTestCase.java	2007-01-15 22:13:38 UTC (rev 59660)
@@ -0,0 +1,85 @@
+/*
+* 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 org.jboss.dependency.spi.ControllerContext;
+import org.jboss.test.system.controller.integration.support.SimpleBean;
+
+import junit.framework.Test;
+
+/**
+ * InstallMCToJMXUnitTestCase test of injecting an mc bean into a jmx mbean
+ * as part of the mc bean install action.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 1.1 $
+ */
+public class InstallMCToJMXUnitTestCase extends AbstractIntegrationTest
+{
+   public static Test suite()
+   {
+      return suite(InstallMCToJMXUnitTestCase.class);
+   }
+
+   public InstallMCToJMXUnitTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public void testInstallMCToJMX() throws Throwable
+   {
+      checkInject();
+   }
+
+   /**
+    * Validate that:
+    * 
+    * jboss.test:type=test mbean context exists
+    * jboss.test:type=test target is not null
+    * Test bean context exists
+    * Test bean target is not null and an instanceof SimpleBean
+    * That the Test.simpleBean property value injected was the jboss.test:type=test instance
+    * 
+    * @throws Throwable
+    */
+   public void checkInject() throws Throwable
+   {
+      ControllerContext mbeanContext = getControllerContext("jboss.test:type=test");
+      assertNotNull(mbeanContext);
+      Object mbean = mbeanContext.getTarget();
+      assertNotNull(mbean);
+
+      ControllerContext beanContext = getControllerContext("Test");
+      assertNotNull(beanContext);
+      Object bean = beanContext.getTarget();
+      assertNotNull(bean);
+      assertTrue(bean instanceof SimpleBean);
+      
+      SimpleBean simpleBean = (SimpleBean) bean;
+      
+      Object injected = simpleBean.getSimple();
+      
+      assertTrue("MBean was not injected: ", mbean == injected);
+   }
+
+}


Property changes on: trunk/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/InstallMCToJMXUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id,Revision
Name: svn:eol-style
   + native

Modified: trunk/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/IntegrationTestDelegate.java
===================================================================
--- trunk/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/IntegrationTestDelegate.java	2007-01-15 21:13:51 UTC (rev 59659)
+++ trunk/system-jmx/src/tests/org/jboss/test/system/controller/integration/test/IntegrationTestDelegate.java	2007-01-15 22:13:38 UTC (rev 59660)
@@ -53,7 +53,13 @@
    {
       super(clazz);
    }
-   
+
+   /**
+    * Overriden to extend setUp to include creation of a BasicXMLDeployer
+    * that is used to deploy and validate the mc.
+    * @see #deployMC()
+    * @see #validateMC()
+    */
    public void setUp() throws Exception
    {
       super.setUp();
@@ -271,7 +277,8 @@
    }
 
    /**
-    * Deploy the beans
+    * Deploy the beans by looking for an xml descriptor named
+    * clazz.getName().replace('.', '/') + "-mc.xml";
     * 
     * @throws Exception for any error
     */




More information about the jboss-cvs-commits mailing list