[jboss-cvs] JBossAS SVN: r99407 - in projects/jbossmx/trunk: mbeanserver/src/test/org/jboss/test/jmx/compliance/server and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jan 14 09:06:23 EST 2010
Author: adrian at jboss.org
Date: 2010-01-14 09:06:22 -0500 (Thu, 14 Jan 2010)
New Revision: 99407
Removed:
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/MBeanServerInvocationHandlerTestCase.java
projects/jbossmx/trunk/mbeanserver/src/test/org/jboss/test/jmx/compliance/server/MBeanServerInvocationHandlerTestCase.java
Modified:
projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/ServerSUITE.java
projects/jbossmx/trunk/mbeanserver/src/test/org/jboss/test/jmx/compliance/server/ServerSUITE.java
Log:
There's little point testing a JDK class, we can't fix it anyway. Its behaviour has changed in JDK6 wrt toString(), hashCode() and equals() so the tests are broken.
Deleted: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/MBeanServerInvocationHandlerTestCase.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/MBeanServerInvocationHandlerTestCase.java 2010-01-14 11:57:06 UTC (rev 99406)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/MBeanServerInvocationHandlerTestCase.java 2010-01-14 14:06:22 UTC (rev 99407)
@@ -1,399 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.jmx.compliance.server;
-
-import java.util.ArrayList;
-
-import javax.management.MBeanNotificationInfo;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.MBeanServerInvocationHandler;
-import javax.management.Notification;
-import javax.management.NotificationEmitter;
-import javax.management.NotificationFilterSupport;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
-
-import junit.framework.Test;
-
-import org.jboss.test.jmx.compliance.server.support.EmitterInvocationHandlerTest;
-import org.jboss.test.jmx.compliance.server.support.InvocationHandlerTest;
-import org.jboss.test.jmx.compliance.server.support.InvocationHandlerTestMBean;
-import org.jboss.test.jmx.compliance.server.support.ObjectInvocationHandlerTest;
-
-import test.JBossMXTest;
-
-/**
- * Tests the MBeanServerInvocationHandler
- *
- * @author <a href="mailto:Adrian.Brock at HappeningTimes.com">Adrian Brock</a>.
- */
-public class MBeanServerInvocationHandlerTestCase
- extends JBossMXTest
- implements NotificationListener
-{
- public static Test suite()
- {
- return suite(MBeanServerInvocationHandlerTestCase.class);
- }
-
- private ObjectName invocationHandlerTestName;
-
- private ArrayList<Notification> messages = new ArrayList<Notification>();
-
- // Constructor ---------------------------------------------------------------
-
- public MBeanServerInvocationHandlerTestCase(String s)
- {
- super(s);
-
- try
- {
- invocationHandlerTestName = new ObjectName("MBeanServerInvocationHandlerTestCase:type=InvocationHandlerTest");
- }
- catch (Exception e)
- {
- throw new RuntimeException(e.toString());
- }
- }
-
- // Tests ---------------------------------------------------------------------
-
- public void testConstructor()
- throws Exception
- {
- MBeanServerFactory.newMBeanServer();
- }
-
- public void testGetter()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
-
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, false);
- assertEquals("Attribute", proxy.getAttribute());
- }
-
- public void testSetter()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, false);
-
- proxy.setAttribute("Changed");
- assertEquals("Changed", test.getAttribute());
- }
-
- public void testGetterPrimitiveBoolean()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
-
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, false);
-
- assertEquals(false, test.isIsPrimitive());
- test.setIsPrimitive(true);
-
- assertEquals(true, proxy.isIsPrimitive());
- }
-
- public void testSetterPrimitiveBoolean()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, false);
-
- assertEquals(false, test.isIsPrimitive());
- proxy.setIsPrimitive(true);
-
- assertEquals(true, test.isIsPrimitive());
- }
-
- public void testGetterTypeBoolean()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
-
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, false);
-
- assertEquals(null, test.getType());
- test.setType(new Boolean(true));
-
- assertEquals(true, proxy.getType().booleanValue());
- }
-
- public void testSetterTypeBoolean()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, false);
-
- assertEquals(null, test.getType());
- proxy.setType(new Boolean(true));
-
- assertEquals(true, test.getType().booleanValue());
- }
-
- public void testInvokeNoArgsNoReturn()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, false);
-
- proxy.invokeNoArgsNoReturn();
- assertTrue(test.invokeNoArgsNoReturnInvoked);
- }
-
- public void testInvokeNoArgs()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, false);
-
- assertEquals("invokeNoArgs", proxy.invokeNoArgs());
- }
-
- public void testInvoke()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, false);
-
- assertEquals("parameter", proxy.invoke("parameter"));
- }
-
- public void testInvokeMixedParameters()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, false);
-
- Integer parameter = new Integer(20);
- assertEquals(parameter, proxy.invokeMixedParameters("parameter", 10, parameter));
- }
-
- public void testNotificationEmitterAdd()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- EmitterInvocationHandlerTest test = new EmitterInvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- NotificationEmitter proxy = (NotificationEmitter) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, true);
-
- proxy.addNotificationListener(this, null, null);
-
- messages.clear();
- test.sendNotification();
- assertTrue(messages.size() == 1);
- }
-
- public void testNotificationEmitterRemove()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- EmitterInvocationHandlerTest test = new EmitterInvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- NotificationEmitter proxy = (NotificationEmitter) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, true);
-
- proxy.addNotificationListener(this, null, null);
-
- messages.clear();
- test.sendNotification();
- assertTrue(messages.size() == 1);
-
- proxy.removeNotificationListener(this);
-
- messages.clear();
- test.sendNotification();
- assertTrue(messages.size() == 0);
- }
-
- public void testNotificationEmitterRemoveTriplet()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- EmitterInvocationHandlerTest test = new EmitterInvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- NotificationEmitter proxy = (NotificationEmitter) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, true);
-
- NotificationFilterSupport filter = new NotificationFilterSupport();
- filter.enableType("test");
- Object handback = new Object();
- proxy.addNotificationListener(this, filter, handback);
-
- messages.clear();
- test.sendNotification();
- assertTrue(messages.size() == 1);
-
- proxy.removeNotificationListener(this, filter, handback);
-
- messages.clear();
- test.sendNotification();
- assertTrue(messages.size() == 0);
- }
-
- public void testGetNotificationInfo()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- EmitterInvocationHandlerTest test = new EmitterInvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- NotificationEmitter proxy = (NotificationEmitter) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, true);
-
- MBeanNotificationInfo[] info = proxy.getNotificationInfo();
- assertEquals("test", info[0].getNotifTypes()[0]);
- }
-
- public void testToString()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- ObjectInvocationHandlerTest test = new ObjectInvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, true);
-
- assertEquals("TOSTRING", proxy.toString());
- }
-
- public void testToStringFailsWhenNotExposed()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, true);
-
- try
- {
- proxy.toString();
- fail("toString() should not work when it is not exposed for management");
- }
- catch (Exception ignored)
- {
- }
- }
-
- public void testEquals()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- ObjectInvocationHandlerTest test = new ObjectInvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, true);
-
- assertTrue(proxy.equals(new Object()));
- }
-
- public void testEqualsFailsWhenNotExposed()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, true);
-
- try
- {
- proxy.equals(new Object());
- fail("equals(Object) should not work when it is not exposed for management");
- }
- catch (Exception ignored)
- {
- }
- }
-
- public void testHashCode()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- ObjectInvocationHandlerTest test = new ObjectInvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, true);
-
- assertEquals(1234, proxy.hashCode());
- }
-
- public void testHashCodeFailsWhenNotExposed()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, true);
-
- try
- {
- proxy.hashCode();
- fail("hashCode() should not work when it is not exposed for management");
- }
- catch (Exception ignored)
- {
- }
- }
-
- // Notification Listener -----------------------------------------------------
-
- public void handleNotification(Notification notification, Object handback)
- {
- messages.add(notification);
- }
-}
Modified: projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/ServerSUITE.java
===================================================================
--- projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/ServerSUITE.java 2010-01-14 11:57:06 UTC (rev 99406)
+++ projects/jbossmx/trunk/jmx/src/test/org/jboss/test/jmx/compliance/server/ServerSUITE.java 2010-01-14 14:06:22 UTC (rev 99407)
@@ -40,7 +40,6 @@
suite.addTest(MBeanDelegateTEST.suite());
suite.addTest(DefaultDomainTestCase.suite());
suite.addTest(MBeanServerBuilderTestCase.suite());
- suite.addTest(MBeanServerInvocationHandlerTestCase.suite());
return suite;
}
Deleted: projects/jbossmx/trunk/mbeanserver/src/test/org/jboss/test/jmx/compliance/server/MBeanServerInvocationHandlerTestCase.java
===================================================================
--- projects/jbossmx/trunk/mbeanserver/src/test/org/jboss/test/jmx/compliance/server/MBeanServerInvocationHandlerTestCase.java 2010-01-14 11:57:06 UTC (rev 99406)
+++ projects/jbossmx/trunk/mbeanserver/src/test/org/jboss/test/jmx/compliance/server/MBeanServerInvocationHandlerTestCase.java 2010-01-14 14:06:22 UTC (rev 99407)
@@ -1,399 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.jmx.compliance.server;
-
-import java.util.ArrayList;
-
-import javax.management.MBeanNotificationInfo;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.MBeanServerInvocationHandler;
-import javax.management.Notification;
-import javax.management.NotificationEmitter;
-import javax.management.NotificationFilterSupport;
-import javax.management.NotificationListener;
-import javax.management.ObjectName;
-
-import junit.framework.Test;
-
-import org.jboss.test.jmx.JBossJMXTest;
-import org.jboss.test.jmx.compliance.server.support.EmitterInvocationHandlerTest;
-import org.jboss.test.jmx.compliance.server.support.InvocationHandlerTest;
-import org.jboss.test.jmx.compliance.server.support.InvocationHandlerTestMBean;
-import org.jboss.test.jmx.compliance.server.support.ObjectInvocationHandlerTest;
-
-
-/**
- * Tests the MBeanServerInvocationHandler
- *
- * @author <a href="mailto:Adrian.Brock at HappeningTimes.com">Adrian Brock</a>.
- */
-public class MBeanServerInvocationHandlerTestCase
- extends JBossJMXTest
- implements NotificationListener
-{
- public static Test suite()
- {
- return suite(MBeanServerInvocationHandlerTestCase.class);
- }
-
- private ObjectName invocationHandlerTestName;
-
- private ArrayList<Notification> messages = new ArrayList<Notification>();
-
- // Constructor ---------------------------------------------------------------
-
- public MBeanServerInvocationHandlerTestCase(String s)
- {
- super(s);
-
- try
- {
- invocationHandlerTestName = new ObjectName("MBeanServerInvocationHandlerTestCase:type=InvocationHandlerTest");
- }
- catch (Exception e)
- {
- throw new RuntimeException(e.toString());
- }
- }
-
- // Tests ---------------------------------------------------------------------
-
- public void testConstructor()
- throws Exception
- {
- MBeanServerFactory.newMBeanServer();
- }
-
- public void testGetter()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
-
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, false);
- assertEquals("Attribute", proxy.getAttribute());
- }
-
- public void testSetter()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, false);
-
- proxy.setAttribute("Changed");
- assertEquals("Changed", test.getAttribute());
- }
-
- public void testGetterPrimitiveBoolean()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
-
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, false);
-
- assertEquals(false, test.isIsPrimitive());
- test.setIsPrimitive(true);
-
- assertEquals(true, proxy.isIsPrimitive());
- }
-
- public void testSetterPrimitiveBoolean()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, false);
-
- assertEquals(false, test.isIsPrimitive());
- proxy.setIsPrimitive(true);
-
- assertEquals(true, test.isIsPrimitive());
- }
-
- public void testGetterTypeBoolean()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
-
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, false);
-
- assertEquals(null, test.getType());
- test.setType(new Boolean(true));
-
- assertEquals(true, proxy.getType().booleanValue());
- }
-
- public void testSetterTypeBoolean()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, false);
-
- assertEquals(null, test.getType());
- proxy.setType(new Boolean(true));
-
- assertEquals(true, test.getType().booleanValue());
- }
-
- public void testInvokeNoArgsNoReturn()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, false);
-
- proxy.invokeNoArgsNoReturn();
- assertTrue(test.invokeNoArgsNoReturnInvoked);
- }
-
- public void testInvokeNoArgs()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, false);
-
- assertEquals("invokeNoArgs", proxy.invokeNoArgs());
- }
-
- public void testInvoke()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, false);
-
- assertEquals("parameter", proxy.invoke("parameter"));
- }
-
- public void testInvokeMixedParameters()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, false);
-
- Integer parameter = new Integer(20);
- assertEquals(parameter, proxy.invokeMixedParameters("parameter", 10, parameter));
- }
-
- public void testNotificationEmitterAdd()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- EmitterInvocationHandlerTest test = new EmitterInvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- NotificationEmitter proxy = (NotificationEmitter) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, true);
-
- proxy.addNotificationListener(this, null, null);
-
- messages.clear();
- test.sendNotification();
- assertTrue(messages.size() == 1);
- }
-
- public void testNotificationEmitterRemove()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- EmitterInvocationHandlerTest test = new EmitterInvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- NotificationEmitter proxy = (NotificationEmitter) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, true);
-
- proxy.addNotificationListener(this, null, null);
-
- messages.clear();
- test.sendNotification();
- assertTrue(messages.size() == 1);
-
- proxy.removeNotificationListener(this);
-
- messages.clear();
- test.sendNotification();
- assertTrue(messages.size() == 0);
- }
-
- public void testNotificationEmitterRemoveTriplet()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- EmitterInvocationHandlerTest test = new EmitterInvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- NotificationEmitter proxy = (NotificationEmitter) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, true);
-
- NotificationFilterSupport filter = new NotificationFilterSupport();
- filter.enableType("test");
- Object handback = new Object();
- proxy.addNotificationListener(this, filter, handback);
-
- messages.clear();
- test.sendNotification();
- assertTrue(messages.size() == 1);
-
- proxy.removeNotificationListener(this, filter, handback);
-
- messages.clear();
- test.sendNotification();
- assertTrue(messages.size() == 0);
- }
-
- public void testGetNotificationInfo()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- EmitterInvocationHandlerTest test = new EmitterInvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- NotificationEmitter proxy = (NotificationEmitter) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, true);
-
- MBeanNotificationInfo[] info = proxy.getNotificationInfo();
- assertEquals("test", info[0].getNotifTypes()[0]);
- }
-
- public void testToString()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- ObjectInvocationHandlerTest test = new ObjectInvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, true);
-
- assertEquals("TOSTRING", proxy.toString());
- }
-
- public void testToStringFailsWhenNotExposed()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, true);
-
- try
- {
- proxy.toString();
- fail("toString() should not work when it is not exposed for management");
- }
- catch (Exception ignored)
- {
- }
- }
-
- public void testEquals()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- ObjectInvocationHandlerTest test = new ObjectInvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, true);
-
- assertTrue(proxy.equals(new Object()));
- }
-
- public void testEqualsFailsWhenNotExposed()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, true);
-
- try
- {
- proxy.equals(new Object());
- fail("equals(Object) should not work when it is not exposed for management");
- }
- catch (Exception ignored)
- {
- }
- }
-
- public void testHashCode()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- ObjectInvocationHandlerTest test = new ObjectInvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, true);
-
- assertEquals(1234, proxy.hashCode());
- }
-
- public void testHashCodeFailsWhenNotExposed()
- throws Exception
- {
- MBeanServer server = MBeanServerFactory.newMBeanServer();
- InvocationHandlerTest test = new InvocationHandlerTest();
- server.registerMBean(test, invocationHandlerTestName);
- InvocationHandlerTestMBean proxy = (InvocationHandlerTestMBean) MBeanServerInvocationHandler.newProxyInstance(
- server, invocationHandlerTestName, InvocationHandlerTestMBean.class, true);
-
- try
- {
- proxy.hashCode();
- fail("hashCode() should not work when it is not exposed for management");
- }
- catch (Exception ignored)
- {
- }
- }
-
- // Notification Listener -----------------------------------------------------
-
- public void handleNotification(Notification notification, Object handback)
- {
- messages.add(notification);
- }
-}
Modified: projects/jbossmx/trunk/mbeanserver/src/test/org/jboss/test/jmx/compliance/server/ServerSUITE.java
===================================================================
--- projects/jbossmx/trunk/mbeanserver/src/test/org/jboss/test/jmx/compliance/server/ServerSUITE.java 2010-01-14 11:57:06 UTC (rev 99406)
+++ projects/jbossmx/trunk/mbeanserver/src/test/org/jboss/test/jmx/compliance/server/ServerSUITE.java 2010-01-14 14:06:22 UTC (rev 99407)
@@ -40,7 +40,6 @@
suite.addTest(MBeanDelegateTEST.suite());
suite.addTest(DefaultDomainTestCase.suite());
suite.addTest(MBeanServerBuilderTestCase.suite());
- suite.addTest(MBeanServerInvocationHandlerTestCase.suite());
return suite;
}
More information about the jboss-cvs-commits
mailing list