[jboss-cvs] JBossAS SVN: r58239 - in trunk: aspects/src/resources/META-INF build system/src/main/org/jboss/system/server testsuite testsuite/imports/sections testsuite/src/main/org/jboss/test/aop testsuite/src/main/org/jboss/test/aop/mcjmx testsuite/src/main/org/jboss/test/aop/test testsuite/src/resources/aop testsuite/src/resources/aop/mcjmx testsuite/src/resources/aop/mcjmx/META-INF

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Nov 9 17:35:13 EST 2006


Author: kabir.khan at jboss.com
Date: 2006-11-09 17:35:02 -0500 (Thu, 09 Nov 2006)
New Revision: 58239

Added:
   trunk/aspects/src/resources/META-INF/aop-mc-int-aspect-beans.xml
   trunk/testsuite/src/main/org/jboss/test/aop/mcjmx/
   trunk/testsuite/src/main/org/jboss/test/aop/mcjmx/AnnotatedBean.java
   trunk/testsuite/src/main/org/jboss/test/aop/mcjmx/BeanInterface.java
   trunk/testsuite/src/main/org/jboss/test/aop/mcjmx/XmlBean.java
   trunk/testsuite/src/main/org/jboss/test/aop/test/MicrocontainerJMXUnitTestCase.java
   trunk/testsuite/src/resources/aop/mcjmx/
   trunk/testsuite/src/resources/aop/mcjmx/META-INF/
   trunk/testsuite/src/resources/aop/mcjmx/META-INF/jboss-beans.xml
Modified:
   trunk/build/build-distr.xml
   trunk/system/src/main/org/jboss/system/server/ServerLoader.java
   trunk/testsuite/.classpath
   trunk/testsuite/imports/sections/aop.xml
Log:
[JBAOP-304] Integrate the jboss aop/mc integration into jboss 5 and add a test for the @JMX aspect 

Added: trunk/aspects/src/resources/META-INF/aop-mc-int-aspect-beans.xml
===================================================================
--- trunk/aspects/src/resources/META-INF/aop-mc-int-aspect-beans.xml	2006-11-09 22:02:35 UTC (rev 58238)
+++ trunk/aspects/src/resources/META-INF/aop-mc-int-aspect-beans.xml	2006-11-09 22:35:02 UTC (rev 58239)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+   <bean name="Repository" class="org.jboss.metadata.plugins.repository.basic.BasicMetaDataRepository"/>
+
+   <bean name="JMXIntroduction" class="org.jboss.aop.microcontainer.beans.IntroductionBinding">
+      <property name="classes">@org.jboss.aop.microcontainer.aspects.jmx.JMX</property>
+      <property name="interfaces">
+         <list elementClass="java.lang.String">
+            <value>org.jboss.kernel.spi.dependency.KernelControllerContextAware</value>
+         </list>
+      </property>
+      <property name="manager"><inject bean="AspectManager" property="aspectManager"/></property>
+   </bean>
+
+   <!--
+   <aop:aspect xmlns:aop="urn:jboss:aop-beans:1.0"
+               name="JMXAdvice"
+               class="org.jboss.aop.microcontainer.aspects.jmx.JMXIntroduction"
+               pointcut="execution(* @org.jboss.aop.microcontainer.aspects.jmx.JMX->$implements{org.jboss.kernel.spi.dependency.KernelControllerContextAware}(..))">
+      <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
+   </aop:aspect>
+   -->
+   
+   <!-- TODO use aop:aspect instead of these. -->
+   <beanfactory name="JMXAdvice" class="org.jboss.aop.microcontainer.aspects.jmx.JMXIntroduction">
+      <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
+   </beanfactory>
+
+   <bean name="JMXAspect" class="org.jboss.aop.microcontainer.beans.Aspect">
+      <property name="advice"><inject bean="JMXAdvice"/></property>
+      <property name="manager"><inject bean="AspectManager" property="aspectManager"/></property>
+   </bean>
+
+   <bean name="JMXBinding" class="org.jboss.aop.microcontainer.beans.AspectBinding">
+      <property name="pointcut">execution(* @org.jboss.aop.microcontainer.aspects.jmx.JMX->$implements{org.jboss.kernel.spi.dependency.KernelControllerContextAware}(..))</property>
+      <property name="aspect"><inject bean="JMXAspect" property="definition"/></property>
+      <property name="manager"><inject bean="AspectManager" property="aspectManager"/></property>
+   </bean>
+</deployment>

Modified: trunk/build/build-distr.xml
===================================================================
--- trunk/build/build-distr.xml	2006-11-09 22:02:35 UTC (rev 58238)
+++ trunk/build/build-distr.xml	2006-11-09 22:35:02 UTC (rev 58239)
@@ -250,6 +250,18 @@
     <unjar src="${_module.output}/lib/${aop.deployer}"
        dest="${install.server}/all/deployers/${aop.deployer}" />
 
+    <copy todir="${install.server}/all/deployers" filtering="no">
+      <fileset dir="${project.root}/${_module.name}/src/resources/META-INF">
+        <include name="aop-mc-int-aspect-beans.xml"/>
+      </fileset>
+    </copy>
+
+    <copy todir="${install.server}/all/deployers/${aop.deployer}" filtering="no">
+      <fileset dir="${jboss.microcontainer.lib}">
+        <include name="jboss-aop-mc-int-deployer.jar"/>
+      </fileset>
+   </copy>
+   
    <!-- Copy across client jars -->
     <mkdir dir="${install.client}"/>
     <copy todir="${install.client}" filtering="no">
@@ -1747,6 +1759,7 @@
         <include name="jboss-xml-binding.jar"/>
       </fileset>
       <fileset dir="${jboss.microcontainer.lib}">
+        <include name="jboss-aop-mc-int-boot.jar"/>
         <include name="jboss-container.jar"/>
         <include name="jboss-dependency.jar"/>
         <include name="jboss-microcontainer.jar"/>

Modified: trunk/system/src/main/org/jboss/system/server/ServerLoader.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/ServerLoader.java	2006-11-09 22:02:35 UTC (rev 58238)
+++ trunk/system/src/main/org/jboss/system/server/ServerLoader.java	2006-11-09 22:35:02 UTC (rev 58239)
@@ -78,7 +78,7 @@
     * TODO: use vfs to list the root directory
     */
    public static final String DEFAULT_BOOT_LIBRARY_LIST =
-      "log4j-boot.jar,jboss-common-core.jar,jboss-logging-spi.jar,jboss-logging-log4j.jar,jboss-logging-jdk.jar,jboss-system.jar,jboss-xml-binding.jar,jboss-container.jar,jboss-dependency.jar,jboss-microcontainer.jar,jboss-deployers.jar,dom4j.jar,jboss-j2se.jar,jboss-mbeans.jar,jboss-jmx.jar,jboss-system-jmx.jar";
+      "log4j-boot.jar,jboss-common-core.jar,jboss-logging-spi.jar,jboss-logging-log4j.jar,jboss-logging-jdk.jar,jboss-system.jar,jboss-xml-binding.jar,jboss-aop-mc-int-boot.jar,jboss-container.jar,jboss-dependency.jar,jboss-microcontainer.jar,jboss-deployers.jar,dom4j.jar,jboss-j2se.jar,jboss-mbeans.jar,jboss-jmx.jar,jboss-system-jmx.jar";
 
    /** The default server type. */
    public static final String DEFAULT_SERVER_TYPE = "org.jboss.system.server.profileservice.ServerImpl";

Modified: trunk/testsuite/.classpath
===================================================================
--- trunk/testsuite/.classpath	2006-11-09 22:02:35 UTC (rev 58238)
+++ trunk/testsuite/.classpath	2006-11-09 22:35:02 UTC (rev 58239)
@@ -75,5 +75,6 @@
 	<classpathentry kind="lib" path="/thirdparty/jboss/aop/lib/jboss-aop-jdk50.jar"/>
 	<classpathentry kind="lib" path="/thirdparty/jboss/aop/lib/pluggable-instrumentor.jar"/>
 	<classpathentry combineaccessrules="false" kind="src" path="/jbossmq"/>
+	<classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-aop-mc-int.jar" sourcepath="C:/cygwin/home/Kabir/sourcecontrol/microcontainer/aop-mc-int/src/main"/>
 	<classpathentry kind="output" path="output/eclipse-classes"/>
 </classpath>

Modified: trunk/testsuite/imports/sections/aop.xml
===================================================================
--- trunk/testsuite/imports/sections/aop.xml	2006-11-09 22:02:35 UTC (rev 58238)
+++ trunk/testsuite/imports/sections/aop.xml	2006-11-09 22:35:02 UTC (rev 58239)
@@ -215,6 +215,15 @@
 			</fileset>
 		</jar>
 
+		<!-- Create jar for the aop-mc-integration test-->
+		<jar destfile="${build.lib}/aop-mc-jmxtest.jar">
+			<fileset dir="${build.classes}">
+				<include name="org/jboss/test/aop/mcjmx/*.class"/>
+			</fileset>
+         <fileset dir="${build.resources}/aop/mcjmx">
+				<include name="META-INF/jboss-beans.xml"/>
+			</fileset>
+		</jar>
 
       <!-- jars for scoped test -->
       <jar destfile="${build.lib}/aop-scopedtest1.aop">

Added: trunk/testsuite/src/main/org/jboss/test/aop/mcjmx/AnnotatedBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/mcjmx/AnnotatedBean.java	2006-11-09 22:02:35 UTC (rev 58238)
+++ trunk/testsuite/src/main/org/jboss/test/aop/mcjmx/AnnotatedBean.java	2006-11-09 22:35:02 UTC (rev 58239)
@@ -0,0 +1,51 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.aop.mcjmx;
+
+import org.jboss.aop.microcontainer.aspects.jmx.JMX;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at JMX(exposedInterface=BeanInterface.class, name="jboss.aop:name=AnnotatedBean")
+public class AnnotatedBean implements BeanInterface
+{
+   int i;
+   
+   public int getProperty()
+   {
+      return i;
+   }
+
+   public void setProperty(int i)
+   {
+      this.i = i;
+   }
+
+   public String someAction()
+   {
+      return "JMX" + i;
+   }
+
+}

Added: trunk/testsuite/src/main/org/jboss/test/aop/mcjmx/BeanInterface.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/mcjmx/BeanInterface.java	2006-11-09 22:02:35 UTC (rev 58238)
+++ trunk/testsuite/src/main/org/jboss/test/aop/mcjmx/BeanInterface.java	2006-11-09 22:35:02 UTC (rev 58239)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.aop.mcjmx;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public interface BeanInterface
+{
+   void setProperty(int i);
+   int getProperty();
+   
+   String someAction();
+}

Added: trunk/testsuite/src/main/org/jboss/test/aop/mcjmx/XmlBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/mcjmx/XmlBean.java	2006-11-09 22:02:35 UTC (rev 58238)
+++ trunk/testsuite/src/main/org/jboss/test/aop/mcjmx/XmlBean.java	2006-11-09 22:35:02 UTC (rev 58239)
@@ -0,0 +1,47 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, 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.aop.mcjmx;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class XmlBean implements BeanInterface
+{
+   int i;
+   
+   public int getProperty()
+   {
+      return i;
+   }
+
+   public void setProperty(int i)
+   {
+      this.i = i;
+   }
+
+   public String someAction()
+   {
+      return "JMX" + i;
+   }
+}

Added: trunk/testsuite/src/main/org/jboss/test/aop/test/MicrocontainerJMXUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/test/MicrocontainerJMXUnitTestCase.java	2006-11-09 22:02:35 UTC (rev 58238)
+++ trunk/testsuite/src/main/org/jboss/test/aop/test/MicrocontainerJMXUnitTestCase.java	2006-11-09 22:35:02 UTC (rev 58239)
@@ -0,0 +1,83 @@
+/*
+  * 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.aop.test;
+
+import javax.management.Attribute;
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+
+import org.jboss.test.JBossTestCase;
+
+/**
+ * Sample client for the jboss container.
+ *
+ * @author <a href="mailto:bill at burkecentral.com">Bill Burke</a>
+ * @version $Id: JMXUnitTestCase.java 58115 2006-11-04 08:42:14Z scott.stark at jboss.org $
+ */
+
+public class MicrocontainerJMXUnitTestCase
+        extends JBossTestCase
+{
+   static boolean deployed = false;
+   static int test = 0;
+
+   public MicrocontainerJMXUnitTestCase(String name)
+   {
+      super(name);
+   }
+
+   public void testAnnotated() throws Exception
+   {
+      ObjectName testerName = new ObjectName("jboss.aop:name=AnnotatedBean");
+      testBean(testerName);
+   }
+
+   public void testXml() throws Exception
+   {
+      ObjectName testerName = new ObjectName("jboss.aop:name=XmlBean");
+      testBean(testerName);
+   }
+
+   private void testBean(ObjectName on) throws Exception
+   {
+      MBeanServerConnection server = getServer();
+      server.setAttribute(on, new Attribute("Property", 42));
+      assertEquals(42, server.getAttribute(on, "Property"));
+      
+      Object ret = server.invoke(on, "someAction", new Object[0], new String[0]);
+      assertEquals("JMX42", ret);
+   }
+   
+   public static Test suite() throws Exception
+   {
+      TestSuite suite = new TestSuite();
+      suite.addTest(new TestSuite(MicrocontainerJMXUnitTestCase.class));
+
+      AOPTestSetup setup = new AOPTestSetup(suite, "aop-mc-jmxtest.jar");
+      return setup;
+   }
+
+}

Added: trunk/testsuite/src/resources/aop/mcjmx/META-INF/jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/aop/mcjmx/META-INF/jboss-beans.xml	2006-11-09 22:02:35 UTC (rev 58238)
+++ trunk/testsuite/src/resources/aop/mcjmx/META-INF/jboss-beans.xml	2006-11-09 22:35:02 UTC (rev 58239)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+   <bean name="AnnotatedBean" class="org.jboss.test.aop.mcjmx.AnnotatedBean"/>
+   <bean name="XmlBean" class="org.jboss.test.aop.mcjmx.XmlBean">
+      <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.aop:name=XmlBean", exposedInterface=org.jboss.test.aop.mcjmx.BeanInterface.class)</annotation>
+   </bean>
+</deployment>




More information about the jboss-cvs-commits mailing list