[jboss-cvs] JBossAS SVN: r74085 - in trunk/testsuite: src/main/org/jboss/test/jmx and 5 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jun 4 06:30:46 EDT 2008


Author: adrian at jboss.org
Date: 2008-06-04 06:30:46 -0400 (Wed, 04 Jun 2008)
New Revision: 74085

Added:
   trunk/testsuite/src/main/org/jboss/test/jmx/annotated/
   trunk/testsuite/src/main/org/jboss/test/jmx/annotated/AnnotatedJMXPojo.java
   trunk/testsuite/src/main/org/jboss/test/jmx/annotated/AnnotatedJMXPojoMBean.java
   trunk/testsuite/src/main/org/jboss/test/jmx/test/AnnotatedJMXUnitTestCase.java
   trunk/testsuite/src/resources/jmx/annotated/
   trunk/testsuite/src/resources/jmx/annotated/META-INF/
   trunk/testsuite/src/resources/jmx/annotated/META-INF/annotated-jmx-beans.xml
Modified:
   trunk/testsuite/imports/sections/jmx.xml
Log:
[JBAS-5578] - Add a test for jmx lifecycle getting invoked when annotating a POJO

Modified: trunk/testsuite/imports/sections/jmx.xml
===================================================================
--- trunk/testsuite/imports/sections/jmx.xml	2008-06-04 10:03:05 UTC (rev 74084)
+++ trunk/testsuite/imports/sections/jmx.xml	2008-06-04 10:30:46 UTC (rev 74085)
@@ -772,5 +772,12 @@
             <include name="org/jboss/test/jmx/mbean/Temp**"/>
          </fileset>
       </jar>
+      
+      <jar destfile="${build.lib}/testannotatedjmxpojo.beans">
+         <metainf dir="${build.resources}/jmx/annotated/META-INF"/>
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/test/jmx/annotated/**"/>
+         </fileset>
+      </jar>
    </target>
 </project>

Added: trunk/testsuite/src/main/org/jboss/test/jmx/annotated/AnnotatedJMXPojo.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jmx/annotated/AnnotatedJMXPojo.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/jmx/annotated/AnnotatedJMXPojo.java	2008-06-04 10:30:46 UTC (rev 74085)
@@ -0,0 +1,95 @@
+/*
+* 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.jmx.annotated;
+
+import org.jboss.aop.microcontainer.aspects.jmx.JMX;
+import org.jboss.system.ServiceMBeanSupport;
+
+/**
+ * AnnotatedJMXPojo.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+ at JMX(name="test:name=AnnotatedJMXPojo", exposedInterface=AnnotatedJMXPojoMBean.class)
+public class AnnotatedJMXPojo extends ServiceMBeanSupport implements AnnotatedJMXPojoMBean
+{
+   private boolean createInvoked;
+   
+   private boolean destroyInvoked;
+   
+   private boolean startInvoked;
+   
+   private boolean stopInvoked;
+
+   public boolean isCreateInvoked()
+   {
+      return createInvoked;
+   }
+
+   public boolean isDestroyInvoked()
+   {
+      return destroyInvoked;
+   }
+
+   public boolean isStartInvoked()
+   {
+      return startInvoked;
+   }
+
+   public boolean isStopInvoked()
+   {
+      return stopInvoked;
+   }
+
+   public void reset()
+   {
+      createInvoked = false;
+      destroyInvoked = false;
+      startInvoked = false;
+      stopInvoked = false;
+   }
+   
+   protected void createService() throws Exception
+   {
+      log.info("create");
+      createInvoked = true;
+   }
+
+   protected void destroyService() throws Exception
+   {
+      log.info("destroy");
+      destroyInvoked = true;
+   }
+
+   protected void startService() throws Exception
+   {
+      log.info("start");
+      startInvoked = true;
+   }
+
+   protected void stopService() throws Exception
+   {
+      log.info("stop");
+      stopInvoked = true;
+   }
+}

Added: trunk/testsuite/src/main/org/jboss/test/jmx/annotated/AnnotatedJMXPojoMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jmx/annotated/AnnotatedJMXPojoMBean.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/jmx/annotated/AnnotatedJMXPojoMBean.java	2008-06-04 10:30:46 UTC (rev 74085)
@@ -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.jmx.annotated;
+
+/**
+ * AnnotatedJMXPojoMBean.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public interface AnnotatedJMXPojoMBean
+{
+   boolean isCreateInvoked();
+
+   boolean isDestroyInvoked();
+
+   boolean isStartInvoked();
+
+   boolean isStopInvoked();
+
+   void reset();
+}
\ No newline at end of file

Added: trunk/testsuite/src/main/org/jboss/test/jmx/test/AnnotatedJMXUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/jmx/test/AnnotatedJMXUnitTestCase.java	                        (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/jmx/test/AnnotatedJMXUnitTestCase.java	2008-06-04 10:30:46 UTC (rev 74085)
@@ -0,0 +1,56 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2005, 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.jmx.test;
+
+import javax.management.ObjectName;
+
+import org.jboss.test.JBossTestCase;
+
+/**
+ * AnnotatedJMXUnitTestCase.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class AnnotatedJMXUnitTestCase extends JBossTestCase
+{
+   public AnnotatedJMXUnitTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public void testAnnotatedJMX() throws Exception
+   {
+      ObjectName name = new ObjectName("test:name=AnnotatedJMXPojo");
+      
+      deploy("testannotatedjmxpojo.beans");
+      try
+      {
+         assertTrue((Boolean) getServer().getAttribute(name, "CreateInvoked"));
+         assertTrue((Boolean) getServer().getAttribute(name, "StartInvoked"));
+      }
+      finally
+      {
+         undeploy("testannotatedjmxpojo.beans");
+      }
+   }
+}

Added: trunk/testsuite/src/resources/jmx/annotated/META-INF/annotated-jmx-beans.xml
===================================================================
--- trunk/testsuite/src/resources/jmx/annotated/META-INF/annotated-jmx-beans.xml	                        (rev 0)
+++ trunk/testsuite/src/resources/jmx/annotated/META-INF/annotated-jmx-beans.xml	2008-06-04 10:30:46 UTC (rev 74085)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <bean name="TestAnnotatedJMXPojo" class="org.jboss.test.jmx.annotated.AnnotatedJMXPojo"/>
+
+</deployment>
\ No newline at end of file




More information about the jboss-cvs-commits mailing list