[jboss-cvs] JBossAS SVN: r58296 - in trunk/testsuite/src: main/org/jboss/test/aop/mcjmx main/org/jboss/test/aop/test resources/aop/mcjmx/META-INF
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Nov 13 08:47:17 EST 2006
Author: kabir.khan at jboss.com
Date: 2006-11-13 08:47:12 -0500 (Mon, 13 Nov 2006)
New Revision: 58296
Added:
trunk/testsuite/src/main/org/jboss/test/aop/mcjmx/BaseClass.java
trunk/testsuite/src/main/org/jboss/test/aop/mcjmx/SubClassBeanWithMethodCallInCtor.java
Modified:
trunk/testsuite/src/main/org/jboss/test/aop/test/MicrocontainerJMXUnitTestCase.java
trunk/testsuite/src/resources/aop/mcjmx/META-INF/jboss-beans.xml
Log:
[JBAOP-306] Testsuite test for: Fix NPE for ctors calling methods causes NPE when using AOP/MC proxies
Added: trunk/testsuite/src/main/org/jboss/test/aop/mcjmx/BaseClass.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/mcjmx/BaseClass.java 2006-11-13 13:38:21 UTC (rev 58295)
+++ trunk/testsuite/src/main/org/jboss/test/aop/mcjmx/BaseClass.java 2006-11-13 13:47:12 UTC (rev 58296)
@@ -0,0 +1,37 @@
+/*
+* 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 BaseClass
+{
+ int property;
+
+ public void setProperty(int i)
+ {
+ property = i;
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/aop/mcjmx/SubClassBeanWithMethodCallInCtor.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/mcjmx/SubClassBeanWithMethodCallInCtor.java 2006-11-13 13:38:21 UTC (rev 58295)
+++ trunk/testsuite/src/main/org/jboss/test/aop/mcjmx/SubClassBeanWithMethodCallInCtor.java 2006-11-13 13:47:12 UTC (rev 58296)
@@ -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 SubClassBeanWithMethodCallInCtor extends BaseClass implements BeanInterface
+{
+ public SubClassBeanWithMethodCallInCtor()
+ {
+ super();
+ setProperty(42);
+ }
+
+ public int getProperty()
+ {
+ return property;
+ }
+
+
+ public String someAction()
+ {
+ return "JMX" + property;
+ }
+}
Modified: trunk/testsuite/src/main/org/jboss/test/aop/test/MicrocontainerJMXUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/aop/test/MicrocontainerJMXUnitTestCase.java 2006-11-13 13:38:21 UTC (rev 58295)
+++ trunk/testsuite/src/main/org/jboss/test/aop/test/MicrocontainerJMXUnitTestCase.java 2006-11-13 13:47:12 UTC (rev 58296)
@@ -24,8 +24,10 @@
import javax.management.Attribute;
import javax.management.InstanceNotFoundException;
import javax.management.MBeanServerConnection;
+import javax.management.MBeanInfo;
import javax.management.ObjectName;
+
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -62,18 +64,28 @@
testBean(testerName);
}
+ public void testBeanWithCtorMethodCall() throws Exception
+ {
+ MBeanServerConnection server = getServer();
+ ObjectName testerName = new ObjectName("jboss.aop:name=BeanWithCtorMethodCall");
+ MBeanInfo info = server.getMBeanInfo(testerName);
+ assertNotNull(info);
+ server.setAttribute(testerName, new Attribute("Property", 42));
+ assertEquals(42, server.getAttribute(testerName, "Property"));
+ }
+
public void testBeanWithDependencyFromAspect() throws Exception
{
//Do this twice since there was a problem with redeployment
doTestDeployDependencies();
}
-
+
public void testRedeployedBeanWithDependencyFromAspect() throws Exception
{
//Do this twice since there was a problem with redeployment
doTestDeployDependencies();
}
-
+
private void doTestDeployDependencies() throws Exception
{
deploy("aop-mc-jmxtest-has-dependency.jar");
@@ -89,7 +101,7 @@
catch (InstanceNotFoundException expected)
{
}
-
+
deploy("aop-mc-jmxtest-dependency.jar");
try
{
@@ -124,12 +136,12 @@
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();
Modified: trunk/testsuite/src/resources/aop/mcjmx/META-INF/jboss-beans.xml
===================================================================
--- trunk/testsuite/src/resources/aop/mcjmx/META-INF/jboss-beans.xml 2006-11-13 13:38:21 UTC (rev 58295)
+++ trunk/testsuite/src/resources/aop/mcjmx/META-INF/jboss-beans.xml 2006-11-13 13:47:12 UTC (rev 58296)
@@ -5,4 +5,7 @@
<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>
+ <bean name="BeanWithCtorMethodCall" class="org.jboss.test.aop.mcjmx.SubClassBeanWithMethodCallInCtor">
+ <annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss.aop:name=BeanWithCtorMethodCall", exposedInterface=org.jboss.test.aop.mcjmx.BeanInterface.class)</annotation>
+ </bean>
</deployment>
More information about the jboss-cvs-commits
mailing list