Merge branch 'SPR-8089' into 3.2.x

This commit is contained in:
Chris Beams 2013-02-26 16:53:33 +01:00
commit 4f99e4cf3a
23 changed files with 290 additions and 82 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -20,32 +20,38 @@ import javax.management.MBeanServer;
import javax.management.MBeanServerFactory; import javax.management.MBeanServerFactory;
import javax.management.ObjectName; import javax.management.ObjectName;
import junit.framework.TestCase; import org.junit.After;
import org.junit.Before;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.GenericApplicationContext; import org.springframework.context.support.GenericApplicationContext;
import org.springframework.tests.TestGroup;
import org.springframework.util.MBeanTestUtils; import org.springframework.util.MBeanTestUtils;
import static org.junit.Assert.*;
/** /**
* <strong>Note:</strong> the JMX test suite requires the presence of the * <strong>Note:</strong> certain tests throughout this hierarchy require the presence of
* {@code jmxremote_optional.jar} in your classpath. Thus, if you * the {@code jmxremote_optional.jar} in your classpath. For this reason, these tests are
* run into the <em>"Unsupported protocol: jmxmp"</em> error, you will * run only if {@link TestGroup#JMXMP} is enabled. If you wish to run these tests, follow
* need to download the * the instructions in the TestGroup class to enable JMXMP tests. If you run into the
* <a href="http://www.oracle.com/technetwork/java/javase/tech/download-jsp-141676.html">JMX Remote API 1.0.1_04 Reference Implementation</a> * <em>"Unsupported protocol: jmxmp"</em> error, you will need to download the
* from Oracle and extract {@code jmxremote_optional.jar} into your * <a href="http://www.oracle.com/technetwork/java/javase/tech/download-jsp-141676.html">
* classpath, for example in the {@code lib/ext} folder of your JVM. * JMX Remote API 1.0.1_04 Reference Implementation</a> from Oracle and extract
* {@code jmxremote_optional.jar} into your classpath, for example in the {@code lib/ext}
* folder of your JVM.
* See also <a href="https://issuetracker.springsource.com/browse/EBR-349">EBR-349</a>. * See also <a href="https://issuetracker.springsource.com/browse/EBR-349">EBR-349</a>.
* *
* @author Rob Harrop * @author Rob Harrop
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Sam Brannen * @author Sam Brannen
* @author Chris Beams
*/ */
public abstract class AbstractMBeanServerTests extends TestCase { public abstract class AbstractMBeanServerTests {
protected MBeanServer server; protected MBeanServer server;
@Override @Before
public final void setUp() throws Exception { public final void setUp() throws Exception {
this.server = MBeanServerFactory.createMBeanServer(); this.server = MBeanServerFactory.createMBeanServer();
try { try {
@ -64,8 +70,8 @@ public abstract class AbstractMBeanServerTests extends TestCase {
return ctx; return ctx;
} }
@Override @After
protected void tearDown() throws Exception { public void tearDown() throws Exception {
releaseServer(); releaseServer();
onTearDown(); onTearDown();
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not * Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of * use this file except in compliance with the License. You may obtain a copy of
@ -29,18 +29,23 @@ import javax.management.remote.JMXConnectorServer;
import javax.management.remote.JMXConnectorServerFactory; import javax.management.remote.JMXConnectorServerFactory;
import javax.management.remote.JMXServiceURL; import javax.management.remote.JMXServiceURL;
import org.junit.Ignore; import org.junit.Test;
import org.springframework.jmx.AbstractMBeanServerTests; import org.springframework.jmx.AbstractMBeanServerTests;
import org.springframework.jmx.IJmxTestBean; import org.springframework.jmx.IJmxTestBean;
import org.springframework.jmx.JmxException; import org.springframework.jmx.JmxException;
import org.springframework.jmx.JmxTestBean; import org.springframework.jmx.JmxTestBean;
import org.springframework.jmx.export.MBeanExporter; import org.springframework.jmx.export.MBeanExporter;
import org.springframework.jmx.export.assembler.AbstractReflectiveMBeanInfoAssembler; import org.springframework.jmx.export.assembler.AbstractReflectiveMBeanInfoAssembler;
import org.springframework.tests.Assume;
import org.springframework.tests.TestGroup;
import static org.junit.Assert.*;
/** /**
* @author Rob Harrop * @author Rob Harrop
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Sam Brannen * @author Sam Brannen
* @author Chris Beams
*/ */
public class MBeanClientInterceptorTests extends AbstractMBeanServerTests { public class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
@ -78,6 +83,7 @@ public class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
return (IJmxTestBean) factory.getObject(); return (IJmxTestBean) factory.getObject();
} }
@Test
public void testProxyClassIsDifferent() throws Exception { public void testProxyClassIsDifferent() throws Exception {
if (!runTests) if (!runTests)
return; return;
@ -85,6 +91,7 @@ public class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
assertTrue("The proxy class should be different than the base class", (proxy.getClass() != IJmxTestBean.class)); assertTrue("The proxy class should be different than the base class", (proxy.getClass() != IJmxTestBean.class));
} }
@Test
public void testDifferentProxiesSameClass() throws Exception { public void testDifferentProxiesSameClass() throws Exception {
if (!runTests) if (!runTests)
return; return;
@ -95,6 +102,7 @@ public class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
assertSame("The proxy classes should be the same", proxy1.getClass(), proxy2.getClass()); assertSame("The proxy classes should be the same", proxy1.getClass(), proxy2.getClass());
} }
@Test
public void testGetAttributeValue() throws Exception { public void testGetAttributeValue() throws Exception {
if (!runTests) if (!runTests)
return; return;
@ -103,6 +111,7 @@ public class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
assertEquals("The age should be 100", 100, age); assertEquals("The age should be 100", 100, age);
} }
@Test
public void testSetAttributeValue() throws Exception { public void testSetAttributeValue() throws Exception {
if (!runTests) if (!runTests)
return; return;
@ -111,6 +120,7 @@ public class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
assertEquals("The name of the bean should have been updated", "Rob Harrop", target.getName()); assertEquals("The name of the bean should have been updated", "Rob Harrop", target.getName());
} }
@Test
public void testSetAttributeValueWithRuntimeException() throws Exception { public void testSetAttributeValueWithRuntimeException() throws Exception {
if (!runTests) if (!runTests)
return; return;
@ -123,6 +133,7 @@ public class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
} }
} }
@Test
public void testSetAttributeValueWithCheckedException() throws Exception { public void testSetAttributeValueWithCheckedException() throws Exception {
if (!runTests) if (!runTests)
return; return;
@ -135,6 +146,7 @@ public class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
} }
} }
@Test
public void testSetAttributeValueWithIOException() throws Exception { public void testSetAttributeValueWithIOException() throws Exception {
if (!runTests) if (!runTests)
return; return;
@ -147,6 +159,7 @@ public class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
} }
} }
@Test
public void testSetReadOnlyAttribute() throws Exception { public void testSetReadOnlyAttribute() throws Exception {
if (!runTests) if (!runTests)
return; return;
@ -159,6 +172,7 @@ public class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
} }
} }
@Test
public void testInvokeNoArgs() throws Exception { public void testInvokeNoArgs() throws Exception {
if (!runTests) if (!runTests)
return; return;
@ -167,6 +181,7 @@ public class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
assertEquals("The operation should return 1", 1, result); assertEquals("The operation should return 1", 1, result);
} }
@Test
public void testInvokeArgs() throws Exception { public void testInvokeArgs() throws Exception {
if (!runTests) if (!runTests)
return; return;
@ -175,6 +190,7 @@ public class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
assertEquals("The operation should return 3", 3, result); assertEquals("The operation should return 3", 3, result);
} }
@Test
public void testInvokeUnexposedMethodWithException() throws Exception { public void testInvokeUnexposedMethodWithException() throws Exception {
if (!runTests) if (!runTests)
return; return;
@ -187,19 +203,13 @@ public class MBeanClientInterceptorTests extends AbstractMBeanServerTests {
} }
} }
// TODO [SPR-8089] Clean up ignored JMX tests. @Test
// public void testTestLazyConnectionToRemote() throws Exception {
// @Ignore should have no effect for JUnit 3.8 tests; however, it appears
// that tests on the CI server -- as well as those in Eclipse -- do in
// fact get ignored. So we leave @Ignore here so that developers can
// easily search for ignored tests.
//
// Once fixed, renamed to test* instead of ignore*.
@Ignore("Requires jmxremote_optional.jar; see comments in AbstractMBeanServerTests for details.")
public void ignoreTestLazyConnectionToRemote() throws Exception {
if (!runTests) if (!runTests)
return; return;
Assume.group(TestGroup.JMXMP);
JMXServiceURL url = new JMXServiceURL("service:jmx:jmxmp://localhost:9876"); JMXServiceURL url = new JMXServiceURL("service:jmx:jmxmp://localhost:9876");
JMXConnectorServer connector = JMXConnectorServerFactory.newJMXConnectorServer(url, null, getServer()); JMXConnectorServer connector = JMXConnectorServerFactory.newJMXConnectorServer(url, null, getServer());

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not * Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of * use this file except in compliance with the License. You may obtain a copy of
@ -26,19 +26,14 @@ import javax.management.remote.JMXConnectorServer;
import javax.management.remote.JMXConnectorServerFactory; import javax.management.remote.JMXConnectorServerFactory;
import javax.management.remote.JMXServiceURL; import javax.management.remote.JMXServiceURL;
import org.junit.Ignore; import org.springframework.tests.Assume;
import org.springframework.tests.TestGroup;
/** /**
* @author Rob Harrop * @author Rob Harrop
* @author Chris Beams
*/ */
// TODO [SPR-8089] Clean up ignored JMX tests. public class RemoteMBeanClientInterceptorTests extends MBeanClientInterceptorTests {
//
// @Ignore should have no effect for JUnit 3.8 tests; however, it appears
// that tests on the CI server -- as well as those in Eclipse -- do in
// fact get ignored. So we leave @Ignore here so that developers can
// easily search for ignored tests.
@Ignore("Requires jmxremote_optional.jar; see comments in AbstractMBeanServerTests for details.")
public class RemoteMBeanClientInterceptorTestsIgnore extends MBeanClientInterceptorTests {
private static final String SERVICE_URL = "service:jmx:jmxmp://localhost:9876"; private static final String SERVICE_URL = "service:jmx:jmxmp://localhost:9876";
@ -48,6 +43,9 @@ public class RemoteMBeanClientInterceptorTestsIgnore extends MBeanClientIntercep
@Override @Override
public void onSetUp() throws Exception { public void onSetUp() throws Exception {
runTests = false;
Assume.group(TestGroup.JMXMP);
runTests = true;
super.onSetUp(); super.onSetUp();
this.connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(getServiceUrl(), null, getServer()); this.connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(getServiceUrl(), null, getServer());
try { try {
@ -73,8 +71,12 @@ public class RemoteMBeanClientInterceptorTestsIgnore extends MBeanClientIntercep
if (this.connector != null) { if (this.connector != null) {
this.connector.close(); this.connector.close();
} }
this.connectorServer.stop(); if (this.connectorServer != null) {
super.tearDown(); this.connectorServer.stop();
}
if (runTests) {
super.tearDown();
}
} }
} }

View File

@ -22,8 +22,11 @@ import java.util.Date;
import javax.management.ObjectName; import javax.management.ObjectName;
import org.junit.Test;
import org.springframework.jmx.AbstractJmxTests; import org.springframework.jmx.AbstractJmxTests;
import static org.junit.Assert.*;
/** /**
* @author Rob Harrop * @author Rob Harrop
*/ */
@ -36,6 +39,7 @@ public class CustomEditorConfigurerTests extends AbstractJmxTests {
return "org/springframework/jmx/export/customConfigurer.xml"; return "org/springframework/jmx/export/customConfigurer.xml";
} }
@Test
public void testDatesInJmx() throws Exception { public void testDatesInJmx() throws Exception {
// System.out.println(getServer().getClass().getName()); // System.out.println(getServer().getClass().getName());
ObjectName oname = new ObjectName("bean:name=dateRange"); ObjectName oname = new ObjectName("bean:name=dateRange");
@ -47,6 +51,7 @@ public class CustomEditorConfigurerTests extends AbstractJmxTests {
assertEquals("endDate ", getEndDate(), endJmx); assertEquals("endDate ", getEndDate(), endJmx);
} }
@Test
public void testGetDates() throws Exception { public void testGetDates() throws Exception {
DateRange dr = (DateRange) getContext().getBean("dateRange"); DateRange dr = (DateRange) getContext().getBean("dateRange");

View File

@ -28,6 +28,8 @@ import org.springframework.jmx.JmxTestBean;
import org.springframework.jmx.export.naming.ObjectNamingStrategy; import org.springframework.jmx.export.naming.ObjectNamingStrategy;
import org.springframework.jmx.support.ObjectNameManager; import org.springframework.jmx.support.ObjectNameManager;
import static org.junit.Assert.*;
/** /**
* @author Rob Harrop * @author Rob Harrop
* @author Juergen Hoeller * @author Juergen Hoeller

View File

@ -33,6 +33,7 @@ import javax.management.ObjectInstance;
import javax.management.ObjectName; import javax.management.ObjectName;
import javax.management.modelmbean.ModelMBeanInfo; import javax.management.modelmbean.ModelMBeanInfo;
import org.junit.Test;
import org.springframework.aop.framework.ProxyFactory; import org.springframework.aop.framework.ProxyFactory;
import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.DefaultListableBeanFactory;
@ -50,6 +51,8 @@ import org.springframework.jmx.support.RegistrationPolicy;
import org.springframework.tests.aop.interceptor.NopInterceptor; import org.springframework.tests.aop.interceptor.NopInterceptor;
import org.springframework.tests.sample.beans.TestBean; import org.springframework.tests.sample.beans.TestBean;
import static org.junit.Assert.*;
/** /**
* Integration tests for the {@link MBeanExporter} class. * Integration tests for the {@link MBeanExporter} class.
* *
@ -66,6 +69,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
private static final String OBJECT_NAME = "spring:test=jmxMBeanAdaptor"; private static final String OBJECT_NAME = "spring:test=jmxMBeanAdaptor";
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testRegisterNonNotificationListenerType() throws Exception { public void testRegisterNonNotificationListenerType() throws Exception {
Map listeners = new HashMap(); Map listeners = new HashMap();
// put a non-NotificationListener instance in as a value... // put a non-NotificationListener instance in as a value...
@ -80,6 +84,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
} }
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testRegisterNullNotificationListenerType() throws Exception { public void testRegisterNullNotificationListenerType() throws Exception {
Map listeners = new HashMap(); Map listeners = new HashMap();
// put null in as a value... // put null in as a value...
@ -94,6 +99,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
} }
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testRegisterNotificationListenerForNonExistentMBean() throws Exception { public void testRegisterNotificationListenerForNonExistentMBean() throws Exception {
Map listeners = new HashMap(); Map listeners = new HashMap();
NotificationListener dummyListener = new NotificationListener() { NotificationListener dummyListener = new NotificationListener() {
@ -117,6 +123,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
} }
} }
@Test
public void testWithSuppliedMBeanServer() throws Exception { public void testWithSuppliedMBeanServer() throws Exception {
MBeanExporter exporter = new MBeanExporter(); MBeanExporter exporter = new MBeanExporter();
exporter.setBeans(getBeanMap()); exporter.setBeans(getBeanMap());
@ -127,6 +134,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
} }
/** Fails if JVM platform MBean server has been started already /** Fails if JVM platform MBean server has been started already
@Test
public void testWithLocatedMBeanServer() throws Exception { public void testWithLocatedMBeanServer() throws Exception {
MBeanExporter adaptor = new MBeanExporter(); MBeanExporter adaptor = new MBeanExporter();
adaptor.setBeans(getBeanMap()); adaptor.setBeans(getBeanMap());
@ -136,6 +144,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
} }
*/ */
@Test
public void testUserCreatedMBeanRegWithDynamicMBean() throws Exception { public void testUserCreatedMBeanRegWithDynamicMBean() throws Exception {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
map.put("spring:name=dynBean", new TestDynamicMBean()); map.put("spring:name=dynBean", new TestDynamicMBean());
@ -153,6 +162,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
assertFalse("Assembler should not have been invoked", asm.invoked); assertFalse("Assembler should not have been invoked", asm.invoked);
} }
@Test
public void testAutodetectMBeans() throws Exception { public void testAutodetectMBeans() throws Exception {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource("autodetectMBeans.xml", getClass())); new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource("autodetectMBeans.xml", getClass()));
@ -170,6 +180,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
} }
} }
@Test
public void testAutodetectWithExclude() throws Exception { public void testAutodetectWithExclude() throws Exception {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource("autodetectMBeans.xml", getClass())); new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource("autodetectMBeans.xml", getClass()));
@ -189,6 +200,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
} }
} }
@Test
public void testAutodetectLazyMBeans() throws Exception { public void testAutodetectLazyMBeans() throws Exception {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource("autodetectLazyMBeans.xml", getClass())); new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource("autodetectLazyMBeans.xml", getClass()));
@ -210,6 +222,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
} }
} }
@Test
public void testAutodetectNoMBeans() throws Exception { public void testAutodetectNoMBeans() throws Exception {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource("autodetectNoMBeans.xml", getClass())); new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource("autodetectNoMBeans.xml", getClass()));
@ -220,6 +233,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
} }
} }
@Test
public void testWithMBeanExporterListeners() throws Exception { public void testWithMBeanExporterListeners() throws Exception {
MockMBeanExporterListener listener1 = new MockMBeanExporterListener(); MockMBeanExporterListener listener1 = new MockMBeanExporterListener();
MockMBeanExporterListener listener2 = new MockMBeanExporterListener(); MockMBeanExporterListener listener2 = new MockMBeanExporterListener();
@ -235,6 +249,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
assertListener(listener2); assertListener(listener2);
} }
@Test
public void testExportJdkProxy() throws Exception { public void testExportJdkProxy() throws Exception {
JmxTestBean bean = new JmxTestBean(); JmxTestBean bean = new JmxTestBean();
bean.setName("Rob Harrop"); bean.setName("Rob Harrop");
@ -260,6 +275,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
assertEquals("Rob Harrop", nameValue); assertEquals("Rob Harrop", nameValue);
} }
@Test
public void testSelfNaming() throws Exception { public void testSelfNaming() throws Exception {
ObjectName objectName = ObjectNameManager.getInstance(OBJECT_NAME); ObjectName objectName = ObjectNameManager.getInstance(OBJECT_NAME);
SelfNamingTestBean testBean = new SelfNamingTestBean(); SelfNamingTestBean testBean = new SelfNamingTestBean();
@ -278,6 +294,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
assertNotNull(instance); assertNotNull(instance);
} }
@Test
public void testRegisterIgnoreExisting() throws Exception { public void testRegisterIgnoreExisting() throws Exception {
ObjectName objectName = ObjectNameManager.getInstance(OBJECT_NAME); ObjectName objectName = ObjectNameManager.getInstance(OBJECT_NAME);
@ -311,6 +328,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
assertEquals("Rob Harrop", server.getAttribute(objectName, "Name")); assertEquals("Rob Harrop", server.getAttribute(objectName, "Name"));
} }
@Test
public void testRegisterReplaceExisting() throws Exception { public void testRegisterReplaceExisting() throws Exception {
ObjectName objectName = ObjectNameManager.getInstance(OBJECT_NAME); ObjectName objectName = ObjectNameManager.getInstance(OBJECT_NAME);
@ -339,6 +357,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
assertEquals("Sally Greenwood", server.getAttribute(objectName, "Name")); assertEquals("Sally Greenwood", server.getAttribute(objectName, "Name"));
} }
@Test
public void testWithExposeClassLoader() throws Exception { public void testWithExposeClassLoader() throws Exception {
String name = "Rob Harrop"; String name = "Rob Harrop";
String otherName = "Juergen Hoeller"; String otherName = "Juergen Hoeller";
@ -368,6 +387,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
assertEquals("Incorrect updated name.", otherName, bean.getName()); assertEquals("Incorrect updated name.", otherName, bean.getName());
} }
@Test
public void testBonaFideMBeanIsNotExportedWhenAutodetectIsTotallyTurnedOff() throws Exception { public void testBonaFideMBeanIsNotExportedWhenAutodetectIsTotallyTurnedOff() throws Exception {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(Person.class); BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(Person.class);
DefaultListableBeanFactory factory = new DefaultListableBeanFactory(); DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
@ -386,6 +406,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
exporter.afterPropertiesSet(); exporter.afterPropertiesSet();
} }
@Test
public void testOnlyBonaFideMBeanIsExportedWhenAutodetectIsMBeanOnly() throws Exception { public void testOnlyBonaFideMBeanIsExportedWhenAutodetectIsMBeanOnly() throws Exception {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(Person.class); BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(Person.class);
DefaultListableBeanFactory factory = new DefaultListableBeanFactory(); DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
@ -405,6 +426,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
ObjectNameManager.getInstance(exportedBeanName)); ObjectNameManager.getInstance(exportedBeanName));
} }
@Test
public void testBonaFideMBeanAndRegularBeanExporterWithAutodetectAll() throws Exception { public void testBonaFideMBeanAndRegularBeanExporterWithAutodetectAll() throws Exception {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(Person.class); BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(Person.class);
DefaultListableBeanFactory factory = new DefaultListableBeanFactory(); DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
@ -428,6 +450,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
ObjectNameManager.getInstance(notToBeExportedBeanName)); ObjectNameManager.getInstance(notToBeExportedBeanName));
} }
@Test
public void testBonaFideMBeanIsNotExportedWithAutodetectAssembler() throws Exception { public void testBonaFideMBeanIsNotExportedWithAutodetectAssembler() throws Exception {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(Person.class); BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(Person.class);
DefaultListableBeanFactory factory = new DefaultListableBeanFactory(); DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
@ -450,6 +473,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
/** /**
* Want to ensure that said MBean is not exported twice. * Want to ensure that said MBean is not exported twice.
*/ */
@Test
public void testBonaFideMBeanExplicitlyExportedAndAutodetectionIsOn() throws Exception { public void testBonaFideMBeanExplicitlyExportedAndAutodetectionIsOn() throws Exception {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(Person.class); BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(Person.class);
DefaultListableBeanFactory factory = new DefaultListableBeanFactory(); DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
@ -468,6 +492,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
ObjectNameManager.getInstance(OBJECT_NAME)); ObjectNameManager.getInstance(OBJECT_NAME));
} }
@Test
public void testSetAutodetectModeToOutOfRangeNegativeValue() throws Exception { public void testSetAutodetectModeToOutOfRangeNegativeValue() throws Exception {
try { try {
MBeanExporter exporter = new MBeanExporter(); MBeanExporter exporter = new MBeanExporter();
@ -478,6 +503,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
} }
} }
@Test
public void testSetAutodetectModeToOutOfRangePositiveValue() throws Exception { public void testSetAutodetectModeToOutOfRangePositiveValue() throws Exception {
try { try {
MBeanExporter exporter = new MBeanExporter(); MBeanExporter exporter = new MBeanExporter();
@ -488,6 +514,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
} }
} }
@Test
public void testSetAutodetectModeNameToNull() throws Exception { public void testSetAutodetectModeNameToNull() throws Exception {
try { try {
MBeanExporter exporter = new MBeanExporter(); MBeanExporter exporter = new MBeanExporter();
@ -498,6 +525,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
} }
} }
@Test
public void testSetAutodetectModeNameToAnEmptyString() throws Exception { public void testSetAutodetectModeNameToAnEmptyString() throws Exception {
try { try {
MBeanExporter exporter = new MBeanExporter(); MBeanExporter exporter = new MBeanExporter();
@ -508,6 +536,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
} }
} }
@Test
public void testSetAutodetectModeNameToAWhitespacedString() throws Exception { public void testSetAutodetectModeNameToAWhitespacedString() throws Exception {
try { try {
MBeanExporter exporter = new MBeanExporter(); MBeanExporter exporter = new MBeanExporter();
@ -518,6 +547,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
} }
} }
@Test
public void testSetAutodetectModeNameToARubbishValue() throws Exception { public void testSetAutodetectModeNameToARubbishValue() throws Exception {
try { try {
MBeanExporter exporter = new MBeanExporter(); MBeanExporter exporter = new MBeanExporter();
@ -528,6 +558,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
} }
} }
@Test
public void testNotRunningInBeanFactoryAndPassedBeanNameToExport() throws Exception { public void testNotRunningInBeanFactoryAndPassedBeanNameToExport() throws Exception {
try { try {
MBeanExporter exporter = new MBeanExporter(); MBeanExporter exporter = new MBeanExporter();
@ -541,6 +572,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
} }
} }
@Test
public void testNotRunningInBeanFactoryAndAutodetectionIsOn() throws Exception { public void testNotRunningInBeanFactoryAndAutodetectionIsOn() throws Exception {
try { try {
MBeanExporter exporter = new MBeanExporter(); MBeanExporter exporter = new MBeanExporter();
@ -555,6 +587,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
/** /**
* SPR-2158 * SPR-2158
*/ */
@Test
public void testMBeanIsNotUnregisteredSpuriouslyIfSomeExternalProcessHasUnregisteredMBean() throws Exception { public void testMBeanIsNotUnregisteredSpuriouslyIfSomeExternalProcessHasUnregisteredMBean() throws Exception {
MBeanExporter exporter = new MBeanExporter(); MBeanExporter exporter = new MBeanExporter();
exporter.setBeans(getBeanMap()); exporter.setBeans(getBeanMap());
@ -574,6 +607,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
/** /**
* SPR-3302 * SPR-3302
*/ */
@Test
public void testBeanNameCanBeUsedInNotificationListenersMap() throws Exception { public void testBeanNameCanBeUsedInNotificationListenersMap() throws Exception {
String beanName = "charlesDexterWard"; String beanName = "charlesDexterWard";
BeanDefinitionBuilder testBean = BeanDefinitionBuilder.rootBeanDefinition(JmxTestBean.class); BeanDefinitionBuilder testBean = BeanDefinitionBuilder.rootBeanDefinition(JmxTestBean.class);
@ -595,6 +629,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
exporter.afterPropertiesSet(); exporter.afterPropertiesSet();
} }
@Test
public void testWildcardCanBeUsedInNotificationListenersMap() throws Exception { public void testWildcardCanBeUsedInNotificationListenersMap() throws Exception {
String beanName = "charlesDexterWard"; String beanName = "charlesDexterWard";
BeanDefinitionBuilder testBean = BeanDefinitionBuilder.rootBeanDefinition(JmxTestBean.class); BeanDefinitionBuilder testBean = BeanDefinitionBuilder.rootBeanDefinition(JmxTestBean.class);
@ -619,6 +654,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
/* /*
* SPR-3625 * SPR-3625
*/ */
@Test
public void testMBeanIsUnregisteredForRuntimeExceptionDuringInitialization() throws Exception { public void testMBeanIsUnregisteredForRuntimeExceptionDuringInitialization() throws Exception {
BeanDefinitionBuilder builder1 = BeanDefinitionBuilder.rootBeanDefinition(Person.class); BeanDefinitionBuilder builder1 = BeanDefinitionBuilder.rootBeanDefinition(Person.class);
BeanDefinitionBuilder builder2 = BeanDefinitionBuilder BeanDefinitionBuilder builder2 = BeanDefinitionBuilder

View File

@ -26,6 +26,7 @@ import javax.management.NotificationFilter;
import javax.management.NotificationListener; import javax.management.NotificationListener;
import javax.management.ObjectName; import javax.management.ObjectName;
import org.junit.Test;
import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.jmx.AbstractMBeanServerTests; import org.springframework.jmx.AbstractMBeanServerTests;
import org.springframework.jmx.JmxTestBean; import org.springframework.jmx.JmxTestBean;
@ -33,6 +34,8 @@ import org.springframework.jmx.access.NotificationListenerRegistrar;
import org.springframework.jmx.export.naming.SelfNaming; import org.springframework.jmx.export.naming.SelfNaming;
import org.springframework.jmx.support.ObjectNameManager; import org.springframework.jmx.support.ObjectNameManager;
import static org.junit.Assert.*;
/** /**
* @author Rob Harrop * @author Rob Harrop
* @author Mark Fisher * @author Mark Fisher
@ -41,6 +44,7 @@ import org.springframework.jmx.support.ObjectNameManager;
public class NotificationListenerTests extends AbstractMBeanServerTests { public class NotificationListenerTests extends AbstractMBeanServerTests {
@SuppressWarnings({"rawtypes", "unchecked"}) @SuppressWarnings({"rawtypes", "unchecked"})
@Test
public void testRegisterNotificationListenerForMBean() throws Exception { public void testRegisterNotificationListenerForMBean() throws Exception {
ObjectName objectName = ObjectName.getInstance("spring:name=Test"); ObjectName objectName = ObjectName.getInstance("spring:name=Test");
JmxTestBean bean = new JmxTestBean(); JmxTestBean bean = new JmxTestBean();
@ -66,6 +70,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
} }
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testRegisterNotificationListenerWithWildcard() throws Exception { public void testRegisterNotificationListenerWithWildcard() throws Exception {
ObjectName objectName = ObjectName.getInstance("spring:name=Test"); ObjectName objectName = ObjectName.getInstance("spring:name=Test");
JmxTestBean bean = new JmxTestBean(); JmxTestBean bean = new JmxTestBean();
@ -90,6 +95,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
assertEquals("Listener not notified", 1, listener.getCount(attributeName)); assertEquals("Listener not notified", 1, listener.getCount(attributeName));
} }
@Test
public void testRegisterNotificationListenerWithHandback() throws Exception { public void testRegisterNotificationListenerWithHandback() throws Exception {
String objectName = "spring:name=Test"; String objectName = "spring:name=Test";
JmxTestBean bean = new JmxTestBean(); JmxTestBean bean = new JmxTestBean();
@ -120,6 +126,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
assertEquals("Handback object not transmitted correctly", handback, listener.getLastHandback(attributeName)); assertEquals("Handback object not transmitted correctly", handback, listener.getLastHandback(attributeName));
} }
@Test
public void testRegisterNotificationListenerForAllMBeans() throws Exception { public void testRegisterNotificationListenerForAllMBeans() throws Exception {
ObjectName objectName = ObjectName.getInstance("spring:name=Test"); ObjectName objectName = ObjectName.getInstance("spring:name=Test");
JmxTestBean bean = new JmxTestBean(); JmxTestBean bean = new JmxTestBean();
@ -146,6 +153,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
} }
@SuppressWarnings("serial") @SuppressWarnings("serial")
@Test
public void testRegisterNotificationListenerWithFilter() throws Exception { public void testRegisterNotificationListenerWithFilter() throws Exception {
ObjectName objectName = ObjectName.getInstance("spring:name=Test"); ObjectName objectName = ObjectName.getInstance("spring:name=Test");
JmxTestBean bean = new JmxTestBean(); JmxTestBean bean = new JmxTestBean();
@ -186,6 +194,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
assertEquals("Listener incorrectly notified for Age", 0, listener.getCount(ageAttribute)); assertEquals("Listener incorrectly notified for Age", 0, listener.getCount(ageAttribute));
} }
@Test
public void testCreationWithNoNotificationListenerSet() { public void testCreationWithNoNotificationListenerSet() {
try { try {
new NotificationListenerBean().afterPropertiesSet(); new NotificationListenerBean().afterPropertiesSet();
@ -195,6 +204,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
} }
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testRegisterNotificationListenerWithBeanNameAndBeanNameInBeansMap() throws Exception { public void testRegisterNotificationListenerWithBeanNameAndBeanNameInBeansMap() throws Exception {
String beanName = "testBean"; String beanName = "testBean";
ObjectName objectName = ObjectName.getInstance("spring:name=Test"); ObjectName objectName = ObjectName.getInstance("spring:name=Test");
@ -225,6 +235,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
} }
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testRegisterNotificationListenerWithBeanNameAndBeanInstanceInBeansMap() throws Exception { public void testRegisterNotificationListenerWithBeanNameAndBeanInstanceInBeansMap() throws Exception {
String beanName = "testBean"; String beanName = "testBean";
ObjectName objectName = ObjectName.getInstance("spring:name=Test"); ObjectName objectName = ObjectName.getInstance("spring:name=Test");
@ -255,6 +266,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
} }
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testRegisterNotificationListenerWithBeanNameBeforeObjectNameMappedToSameBeanInstance() throws Exception { public void testRegisterNotificationListenerWithBeanNameBeforeObjectNameMappedToSameBeanInstance() throws Exception {
String beanName = "testBean"; String beanName = "testBean";
ObjectName objectName = ObjectName.getInstance("spring:name=Test"); ObjectName objectName = ObjectName.getInstance("spring:name=Test");
@ -286,6 +298,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
} }
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testRegisterNotificationListenerWithObjectNameBeforeBeanNameMappedToSameBeanInstance() throws Exception { public void testRegisterNotificationListenerWithObjectNameBeforeBeanNameMappedToSameBeanInstance() throws Exception {
String beanName = "testBean"; String beanName = "testBean";
ObjectName objectName = ObjectName.getInstance("spring:name=Test"); ObjectName objectName = ObjectName.getInstance("spring:name=Test");
@ -317,6 +330,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
} }
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testRegisterNotificationListenerWithTwoBeanNamesMappedToDifferentBeanInstances() throws Exception { public void testRegisterNotificationListenerWithTwoBeanNamesMappedToDifferentBeanInstances() throws Exception {
String beanName1 = "testBean1"; String beanName1 = "testBean1";
String beanName2 = "testBean2"; String beanName2 = "testBean2";
@ -359,6 +373,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
assertEquals("Listener not notified for testBean2", 2, listener.getCount("Age")); assertEquals("Listener not notified for testBean2", 2, listener.getCount("Age"));
} }
@Test
public void testNotificationListenerRegistrar() throws Exception { public void testNotificationListenerRegistrar() throws Exception {
ObjectName objectName = ObjectName.getInstance("spring:name=Test"); ObjectName objectName = ObjectName.getInstance("spring:name=Test");
JmxTestBean bean = new JmxTestBean(); JmxTestBean bean = new JmxTestBean();
@ -391,6 +406,7 @@ public class NotificationListenerTests extends AbstractMBeanServerTests {
assertEquals("Listener notified after destruction", 1, listener.getCount(attributeName)); assertEquals("Listener notified after destruction", 1, listener.getCount(attributeName));
} }
@Test
public void testNotificationListenerRegistrarWithMultipleNames() throws Exception { public void testNotificationListenerRegistrarWithMultipleNames() throws Exception {
ObjectName objectName = ObjectName.getInstance("spring:name=Test"); ObjectName objectName = ObjectName.getInstance("spring:name=Test");
ObjectName objectName2 = ObjectName.getInstance("spring:name=Test2"); ObjectName objectName2 = ObjectName.getInstance("spring:name=Test2");

View File

@ -32,12 +32,15 @@ import javax.management.NotificationBroadcasterSupport;
import javax.management.NotificationListener; import javax.management.NotificationListener;
import javax.management.ReflectionException; import javax.management.ReflectionException;
import org.junit.Test;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.jmx.AbstractMBeanServerTests; import org.springframework.jmx.AbstractMBeanServerTests;
import org.springframework.jmx.export.notification.NotificationPublisher; import org.springframework.jmx.export.notification.NotificationPublisher;
import org.springframework.jmx.export.notification.NotificationPublisherAware; import org.springframework.jmx.export.notification.NotificationPublisherAware;
import org.springframework.jmx.support.ObjectNameManager; import org.springframework.jmx.support.ObjectNameManager;
import static org.junit.Assert.*;
/** /**
* Integration tests for the Spring JMX {@link NotificationPublisher} functionality. * Integration tests for the Spring JMX {@link NotificationPublisher} functionality.
* *
@ -48,6 +51,7 @@ public class NotificationPublisherTests extends AbstractMBeanServerTests {
private CountingNotificationListener listener = new CountingNotificationListener(); private CountingNotificationListener listener = new CountingNotificationListener();
@Test
public void testSimpleBean() throws Exception { public void testSimpleBean() throws Exception {
// start the MBeanExporter // start the MBeanExporter
ConfigurableApplicationContext ctx = loadContext("org/springframework/jmx/export/notificationPublisherTests.xml"); ConfigurableApplicationContext ctx = loadContext("org/springframework/jmx/export/notificationPublisherTests.xml");
@ -60,6 +64,7 @@ public class NotificationPublisherTests extends AbstractMBeanServerTests {
assertEquals("Notification not sent", 1, listener.count); assertEquals("Notification not sent", 1, listener.count);
} }
@Test
public void testSimpleBeanRegisteredManually() throws Exception { public void testSimpleBeanRegisteredManually() throws Exception {
// start the MBeanExporter // start the MBeanExporter
ConfigurableApplicationContext ctx = loadContext("org/springframework/jmx/export/notificationPublisherTests.xml"); ConfigurableApplicationContext ctx = loadContext("org/springframework/jmx/export/notificationPublisherTests.xml");
@ -74,6 +79,7 @@ public class NotificationPublisherTests extends AbstractMBeanServerTests {
assertEquals("Notification not sent", 1, listener.count); assertEquals("Notification not sent", 1, listener.count);
} }
@Test
public void testMBean() throws Exception { public void testMBean() throws Exception {
// start the MBeanExporter // start the MBeanExporter
ConfigurableApplicationContext ctx = loadContext("org/springframework/jmx/export/notificationPublisherTests.xml"); ConfigurableApplicationContext ctx = loadContext("org/springframework/jmx/export/notificationPublisherTests.xml");
@ -86,6 +92,7 @@ public class NotificationPublisherTests extends AbstractMBeanServerTests {
} }
/* /*
@Test
public void testStandardMBean() throws Exception { public void testStandardMBean() throws Exception {
// start the MBeanExporter // start the MBeanExporter
ApplicationContext ctx = new ClassPathXmlApplicationContext("org/springframework/jmx/export/notificationPublisherTests.xml"); ApplicationContext ctx = new ClassPathXmlApplicationContext("org/springframework/jmx/export/notificationPublisherTests.xml");
@ -97,6 +104,7 @@ public class NotificationPublisherTests extends AbstractMBeanServerTests {
} }
*/ */
@Test
public void testLazyInit() throws Exception { public void testLazyInit() throws Exception {
// start the MBeanExporter // start the MBeanExporter
ConfigurableApplicationContext ctx = loadContext("org/springframework/jmx/export/notificationPublisherLazyTests.xml"); ConfigurableApplicationContext ctx = loadContext("org/springframework/jmx/export/notificationPublisherLazyTests.xml");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not * Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of * use this file except in compliance with the License. You may obtain a copy of
@ -18,11 +18,15 @@ package org.springframework.jmx.export;
import javax.management.ObjectName; import javax.management.ObjectName;
import org.junit.Test;
import org.springframework.jmx.AbstractJmxTests; import org.springframework.jmx.AbstractJmxTests;
import org.springframework.jmx.IJmxTestBean; import org.springframework.jmx.IJmxTestBean;
import static org.junit.Assert.*;
/** /**
* @author Rob Harrop * @author Rob Harrop
* @author Chris Beams
*/ */
public class PropertyPlaceholderConfigurerTests extends AbstractJmxTests { public class PropertyPlaceholderConfigurerTests extends AbstractJmxTests {
@ -31,6 +35,7 @@ public class PropertyPlaceholderConfigurerTests extends AbstractJmxTests {
return "org/springframework/jmx/export/propertyPlaceholderConfigurer.xml"; return "org/springframework/jmx/export/propertyPlaceholderConfigurer.xml";
} }
@Test
public void testPropertiesReplaced() { public void testPropertiesReplaced() {
IJmxTestBean bean = (IJmxTestBean) getContext().getBean("testBean"); IJmxTestBean bean = (IJmxTestBean) getContext().getBean("testBean");
@ -38,6 +43,7 @@ public class PropertyPlaceholderConfigurerTests extends AbstractJmxTests {
assertEquals("Age is incorrect", 100, bean.getAge()); assertEquals("Age is incorrect", 100, bean.getAge());
} }
@Test
public void testPropertiesCorrectInJmx() throws Exception { public void testPropertiesCorrectInJmx() throws Exception {
ObjectName oname = new ObjectName("bean:name=proxyTestBean1"); ObjectName oname = new ObjectName("bean:name=proxyTestBean1");
Object name = getServer().getAttribute(oname, "Name"); Object name = getServer().getAttribute(oname, "Name");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not * Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of * use this file except in compliance with the License. You may obtain a copy of
@ -20,15 +20,22 @@ import javax.management.modelmbean.ModelMBeanInfo;
import javax.management.modelmbean.ModelMBeanAttributeInfo; import javax.management.modelmbean.ModelMBeanAttributeInfo;
import javax.management.modelmbean.ModelMBeanOperationInfo; import javax.management.modelmbean.ModelMBeanOperationInfo;
import org.junit.Test;
import org.springframework.jmx.IJmxTestBean; import org.springframework.jmx.IJmxTestBean;
import org.springframework.jmx.export.assembler.AbstractMetadataAssemblerTests; import org.springframework.jmx.export.assembler.AbstractMetadataAssemblerTests;
import org.springframework.jmx.export.metadata.JmxAttributeSource; import org.springframework.jmx.export.metadata.JmxAttributeSource;
/** @author Rob Harrop */ import static org.junit.Assert.*;
/**
* @author Rob Harrop
* @author Chris Beams
*/
public class AnnotationMetadataAssemblerTests extends AbstractMetadataAssemblerTests { public class AnnotationMetadataAssemblerTests extends AbstractMetadataAssemblerTests {
private static final String OBJECT_NAME = "bean:name=testBean4"; private static final String OBJECT_NAME = "bean:name=testBean4";
@Test
public void testAttributeFromInterface() throws Exception { public void testAttributeFromInterface() throws Exception {
ModelMBeanInfo inf = getMBeanInfoFromAssembler(); ModelMBeanInfo inf = getMBeanInfoFromAssembler();
ModelMBeanAttributeInfo attr = inf.getAttribute("Colour"); ModelMBeanAttributeInfo attr = inf.getAttribute("Colour");
@ -36,12 +43,14 @@ public class AnnotationMetadataAssemblerTests extends AbstractMetadataAssemblerT
assertTrue("The name attribute should be readable", attr.isReadable()); assertTrue("The name attribute should be readable", attr.isReadable());
} }
@Test
public void testOperationFromInterface() throws Exception { public void testOperationFromInterface() throws Exception {
ModelMBeanInfo inf = getMBeanInfoFromAssembler(); ModelMBeanInfo inf = getMBeanInfoFromAssembler();
ModelMBeanOperationInfo op = inf.getOperation("fromInterface"); ModelMBeanOperationInfo op = inf.getOperation("fromInterface");
assertNotNull(op); assertNotNull(op);
} }
@Test
public void testOperationOnGetter() throws Exception { public void testOperationOnGetter() throws Exception {
ModelMBeanInfo inf = getMBeanInfoFromAssembler(); ModelMBeanInfo inf = getMBeanInfoFromAssembler();
ModelMBeanOperationInfo op = inf.getOperation("getExpensiveToCalculate"); ModelMBeanOperationInfo op = inf.getOperation("getExpensiveToCalculate");

View File

@ -28,12 +28,16 @@ import javax.management.modelmbean.ModelMBeanAttributeInfo;
import javax.management.modelmbean.ModelMBeanInfo; import javax.management.modelmbean.ModelMBeanInfo;
import javax.management.modelmbean.ModelMBeanOperationInfo; import javax.management.modelmbean.ModelMBeanOperationInfo;
import org.junit.Test;
import org.springframework.jmx.AbstractJmxTests; import org.springframework.jmx.AbstractJmxTests;
import org.springframework.jmx.IJmxTestBean; import org.springframework.jmx.IJmxTestBean;
import org.springframework.jmx.support.ObjectNameManager; import org.springframework.jmx.support.ObjectNameManager;
import static org.junit.Assert.*;
/** /**
* @author Rob Harrop * @author Rob Harrop
* @author Chris Beams
*/ */
public abstract class AbstractJmxAssemblerTests extends AbstractJmxTests { public abstract class AbstractJmxAssemblerTests extends AbstractJmxTests {
@ -43,12 +47,14 @@ public abstract class AbstractJmxAssemblerTests extends AbstractJmxTests {
protected abstract String getObjectName(); protected abstract String getObjectName();
@Test
public void testMBeanRegistration() throws Exception { public void testMBeanRegistration() throws Exception {
// beans are registered at this point - just grab them from the server // beans are registered at this point - just grab them from the server
ObjectInstance instance = getObjectInstance(); ObjectInstance instance = getObjectInstance();
assertNotNull("Bean should not be null", instance); assertNotNull("Bean should not be null", instance);
} }
@Test
public void testRegisterOperations() throws Exception { public void testRegisterOperations() throws Exception {
IJmxTestBean bean = getBean(); IJmxTestBean bean = getBean();
assertNotNull(bean); assertNotNull(bean);
@ -57,6 +63,7 @@ public abstract class AbstractJmxAssemblerTests extends AbstractJmxTests {
getExpectedOperationCount(), inf.getOperations().length); getExpectedOperationCount(), inf.getOperations().length);
} }
@Test
public void testRegisterAttributes() throws Exception { public void testRegisterAttributes() throws Exception {
IJmxTestBean bean = getBean(); IJmxTestBean bean = getBean();
assertNotNull(bean); assertNotNull(bean);
@ -65,11 +72,13 @@ public abstract class AbstractJmxAssemblerTests extends AbstractJmxTests {
getExpectedAttributeCount(), inf.getAttributes().length); getExpectedAttributeCount(), inf.getAttributes().length);
} }
@Test
public void testGetMBeanInfo() throws Exception { public void testGetMBeanInfo() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler(); ModelMBeanInfo info = getMBeanInfoFromAssembler();
assertNotNull("MBeanInfo should not be null", info); assertNotNull("MBeanInfo should not be null", info);
} }
@Test
public void testGetMBeanAttributeInfo() throws Exception { public void testGetMBeanAttributeInfo() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler(); ModelMBeanInfo info = getMBeanInfoFromAssembler();
MBeanAttributeInfo[] inf = info.getAttributes(); MBeanAttributeInfo[] inf = info.getAttributes();
@ -84,6 +93,7 @@ public abstract class AbstractJmxAssemblerTests extends AbstractJmxTests {
} }
} }
@Test
public void testGetMBeanOperationInfo() throws Exception { public void testGetMBeanOperationInfo() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler(); ModelMBeanInfo info = getMBeanInfoFromAssembler();
MBeanOperationInfo[] inf = info.getOperations(); MBeanOperationInfo[] inf = info.getOperations();
@ -98,6 +108,7 @@ public abstract class AbstractJmxAssemblerTests extends AbstractJmxTests {
} }
} }
@Test
public void testDescriptionNotNull() throws Exception { public void testDescriptionNotNull() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler(); ModelMBeanInfo info = getMBeanInfoFromAssembler();
@ -105,6 +116,7 @@ public abstract class AbstractJmxAssemblerTests extends AbstractJmxTests {
info.getDescription()); info.getDescription());
} }
@Test
public void testSetAttribute() throws Exception { public void testSetAttribute() throws Exception {
ObjectName objectName = ObjectNameManager.getInstance(getObjectName()); ObjectName objectName = ObjectNameManager.getInstance(getObjectName());
getServer().setAttribute(objectName, new Attribute(NAME_ATTRIBUTE, "Rob Harrop")); getServer().setAttribute(objectName, new Attribute(NAME_ATTRIBUTE, "Rob Harrop"));
@ -112,6 +124,7 @@ public abstract class AbstractJmxAssemblerTests extends AbstractJmxTests {
assertEquals("Rob Harrop", bean.getName()); assertEquals("Rob Harrop", bean.getName());
} }
@Test
public void testGetAttribute() throws Exception { public void testGetAttribute() throws Exception {
ObjectName objectName = ObjectNameManager.getInstance(getObjectName()); ObjectName objectName = ObjectNameManager.getInstance(getObjectName());
getBean().setName("John Smith"); getBean().setName("John Smith");
@ -119,6 +132,7 @@ public abstract class AbstractJmxAssemblerTests extends AbstractJmxTests {
assertEquals("Incorrect result", "John Smith", val); assertEquals("Incorrect result", "John Smith", val);
} }
@Test
public void testOperationInvocation() throws Exception{ public void testOperationInvocation() throws Exception{
ObjectName objectName = ObjectNameManager.getInstance(getObjectName()); ObjectName objectName = ObjectNameManager.getInstance(getObjectName());
Object result = getServer().invoke(objectName, "add", Object result = getServer().invoke(objectName, "add",
@ -126,6 +140,7 @@ public abstract class AbstractJmxAssemblerTests extends AbstractJmxTests {
assertEquals("Incorrect result", new Integer(50), result); assertEquals("Incorrect result", new Integer(50), result);
} }
@Test
public void testAttributeInfoHasDescriptors() throws Exception { public void testAttributeInfoHasDescriptors() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler(); ModelMBeanInfo info = getMBeanInfoFromAssembler();
@ -141,6 +156,7 @@ public abstract class AbstractJmxAssemblerTests extends AbstractJmxTests {
desc.getFieldValue("setMethod")); desc.getFieldValue("setMethod"));
} }
@Test
public void testAttributeHasCorrespondingOperations() throws Exception { public void testAttributeHasCorrespondingOperations() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler(); ModelMBeanInfo info = getMBeanInfoFromAssembler();
@ -159,6 +175,7 @@ public abstract class AbstractJmxAssemblerTests extends AbstractJmxTests {
assertEquals("set operation should have role \"setter\"", "setter", set.getDescriptor().getFieldValue("role")); assertEquals("set operation should have role \"setter\"", "setter", set.getDescriptor().getFieldValue("role"));
} }
@Test
public void testNotificationMetadata() throws Exception { public void testNotificationMetadata() throws Exception {
ModelMBeanInfo info = (ModelMBeanInfo) getMBeanInfo(); ModelMBeanInfo info = (ModelMBeanInfo) getMBeanInfo();
MBeanNotificationInfo[] notifications = info.getNotifications(); MBeanNotificationInfo[] notifications = info.getNotifications();

View File

@ -26,6 +26,7 @@ import javax.management.modelmbean.ModelMBeanAttributeInfo;
import javax.management.modelmbean.ModelMBeanInfo; import javax.management.modelmbean.ModelMBeanInfo;
import javax.management.modelmbean.ModelMBeanOperationInfo; import javax.management.modelmbean.ModelMBeanOperationInfo;
import org.junit.Test;
import org.springframework.aop.framework.ProxyFactory; import org.springframework.aop.framework.ProxyFactory;
import org.springframework.jmx.IJmxTestBean; import org.springframework.jmx.IJmxTestBean;
import org.springframework.jmx.JmxTestBean; import org.springframework.jmx.JmxTestBean;
@ -34,6 +35,8 @@ import org.springframework.jmx.export.metadata.JmxAttributeSource;
import org.springframework.jmx.support.ObjectNameManager; import org.springframework.jmx.support.ObjectNameManager;
import org.springframework.tests.aop.interceptor.NopInterceptor; import org.springframework.tests.aop.interceptor.NopInterceptor;
import static org.junit.Assert.*;
/** /**
* @author Rob Harrop * @author Rob Harrop
* @author Chris Beams * @author Chris Beams
@ -44,12 +47,14 @@ public abstract class AbstractMetadataAssemblerTests extends AbstractJmxAssemble
protected static final String CACHE_ENTRIES_METRIC = "CacheEntries"; protected static final String CACHE_ENTRIES_METRIC = "CacheEntries";
@Test
public void testDescription() throws Exception { public void testDescription() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler(); ModelMBeanInfo info = getMBeanInfoFromAssembler();
assertEquals("The descriptions are not the same", "My Managed Bean", assertEquals("The descriptions are not the same", "My Managed Bean",
info.getDescription()); info.getDescription());
} }
@Test
public void testAttributeDescriptionOnSetter() throws Exception { public void testAttributeDescriptionOnSetter() throws Exception {
ModelMBeanInfo inf = getMBeanInfoFromAssembler(); ModelMBeanInfo inf = getMBeanInfoFromAssembler();
ModelMBeanAttributeInfo attr = inf.getAttribute(AGE_ATTRIBUTE); ModelMBeanAttributeInfo attr = inf.getAttribute(AGE_ATTRIBUTE);
@ -57,6 +62,7 @@ public abstract class AbstractMetadataAssemblerTests extends AbstractJmxAssemble
"The Age Attribute", attr.getDescription()); "The Age Attribute", attr.getDescription());
} }
@Test
public void testAttributeDescriptionOnGetter() throws Exception { public void testAttributeDescriptionOnGetter() throws Exception {
ModelMBeanInfo inf = getMBeanInfoFromAssembler(); ModelMBeanInfo inf = getMBeanInfoFromAssembler();
ModelMBeanAttributeInfo attr = inf.getAttribute(NAME_ATTRIBUTE); ModelMBeanAttributeInfo attr = inf.getAttribute(NAME_ATTRIBUTE);
@ -67,12 +73,14 @@ public abstract class AbstractMetadataAssemblerTests extends AbstractJmxAssemble
/** /**
* Tests the situation where the attribute is only defined on the getter. * Tests the situation where the attribute is only defined on the getter.
*/ */
@Test
public void testReadOnlyAttribute() throws Exception { public void testReadOnlyAttribute() throws Exception {
ModelMBeanInfo inf = getMBeanInfoFromAssembler(); ModelMBeanInfo inf = getMBeanInfoFromAssembler();
ModelMBeanAttributeInfo attr = inf.getAttribute(AGE_ATTRIBUTE); ModelMBeanAttributeInfo attr = inf.getAttribute(AGE_ATTRIBUTE);
assertFalse("The age attribute should not be writable", attr.isWritable()); assertFalse("The age attribute should not be writable", attr.isWritable());
} }
@Test
public void testReadWriteAttribute() throws Exception { public void testReadWriteAttribute() throws Exception {
ModelMBeanInfo inf = getMBeanInfoFromAssembler(); ModelMBeanInfo inf = getMBeanInfoFromAssembler();
ModelMBeanAttributeInfo attr = inf.getAttribute(NAME_ATTRIBUTE); ModelMBeanAttributeInfo attr = inf.getAttribute(NAME_ATTRIBUTE);
@ -83,6 +91,7 @@ public abstract class AbstractMetadataAssemblerTests extends AbstractJmxAssemble
/** /**
* Tests the situation where the property only has a getter. * Tests the situation where the property only has a getter.
*/ */
@Test
public void testWithOnlySetter() throws Exception { public void testWithOnlySetter() throws Exception {
ModelMBeanInfo inf = getMBeanInfoFromAssembler(); ModelMBeanInfo inf = getMBeanInfoFromAssembler();
ModelMBeanAttributeInfo attr = inf.getAttribute("NickName"); ModelMBeanAttributeInfo attr = inf.getAttribute("NickName");
@ -92,12 +101,14 @@ public abstract class AbstractMetadataAssemblerTests extends AbstractJmxAssemble
/** /**
* Tests the situation where the property only has a setter. * Tests the situation where the property only has a setter.
*/ */
@Test
public void testWithOnlyGetter() throws Exception { public void testWithOnlyGetter() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler(); ModelMBeanInfo info = getMBeanInfoFromAssembler();
ModelMBeanAttributeInfo attr = info.getAttribute("Superman"); ModelMBeanAttributeInfo attr = info.getAttribute("Superman");
assertNotNull("Attribute should not be null", attr); assertNotNull("Attribute should not be null", attr);
} }
@Test
public void testManagedResourceDescriptor() throws Exception { public void testManagedResourceDescriptor() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler(); ModelMBeanInfo info = getMBeanInfoFromAssembler();
Descriptor desc = info.getMBeanDescriptor(); Descriptor desc = info.getMBeanDescriptor();
@ -111,6 +122,7 @@ public abstract class AbstractMetadataAssemblerTests extends AbstractJmxAssemble
assertEquals("Persist Name should be bar", "bar.jmx", desc.getFieldValue("persistName")); assertEquals("Persist Name should be bar", "bar.jmx", desc.getFieldValue("persistName"));
} }
@Test
public void testAttributeDescriptor() throws Exception { public void testAttributeDescriptor() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler(); ModelMBeanInfo info = getMBeanInfoFromAssembler();
Descriptor desc = info.getAttribute(NAME_ATTRIBUTE).getDescriptor(); Descriptor desc = info.getAttribute(NAME_ATTRIBUTE).getDescriptor();
@ -121,6 +133,7 @@ public abstract class AbstractMetadataAssemblerTests extends AbstractJmxAssemble
assertEquals("Persist Period should be 300", "300", desc.getFieldValue("persistPeriod")); assertEquals("Persist Period should be 300", "300", desc.getFieldValue("persistPeriod"));
} }
@Test
public void testOperationDescriptor() throws Exception { public void testOperationDescriptor() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler(); ModelMBeanInfo info = getMBeanInfoFromAssembler();
Descriptor desc = info.getOperation("myOperation").getDescriptor(); Descriptor desc = info.getOperation("myOperation").getDescriptor();
@ -129,6 +142,7 @@ public abstract class AbstractMetadataAssemblerTests extends AbstractJmxAssemble
assertEquals("Role should be \"operation\"", "operation", desc.getFieldValue("role")); assertEquals("Role should be \"operation\"", "operation", desc.getFieldValue("role"));
} }
@Test
public void testOperationParameterMetadata() throws Exception { public void testOperationParameterMetadata() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler(); ModelMBeanInfo info = getMBeanInfoFromAssembler();
ModelMBeanOperationInfo oper = info.getOperation("add"); ModelMBeanOperationInfo oper = info.getOperation("add");
@ -142,6 +156,7 @@ public abstract class AbstractMetadataAssemblerTests extends AbstractJmxAssemble
assertEquals("Incorrect type for y param", int.class.getName(), params[1].getType()); assertEquals("Incorrect type for y param", int.class.getName(), params[1].getType());
} }
@Test
public void testWithCglibProxy() throws Exception { public void testWithCglibProxy() throws Exception {
IJmxTestBean tb = createJmxTestBean(); IJmxTestBean tb = createJmxTestBean();
ProxyFactory pf = new ProxyFactory(); ProxyFactory pf = new ProxyFactory();
@ -169,6 +184,7 @@ public abstract class AbstractMetadataAssemblerTests extends AbstractJmxAssemble
assertTrue("Not included in autodetection", assembler.includeBean(proxy.getClass(), "some bean name")); assertTrue("Not included in autodetection", assembler.includeBean(proxy.getClass(), "some bean name"));
} }
@Test
public void testMetricDescription() throws Exception { public void testMetricDescription() throws Exception {
ModelMBeanInfo inf = getMBeanInfoFromAssembler(); ModelMBeanInfo inf = getMBeanInfoFromAssembler();
ModelMBeanAttributeInfo metric = inf.getAttribute(QUEUE_SIZE_METRIC); ModelMBeanAttributeInfo metric = inf.getAttribute(QUEUE_SIZE_METRIC);
@ -179,6 +195,7 @@ public abstract class AbstractMetadataAssemblerTests extends AbstractJmxAssemble
"The QueueSize metric", operation.getDescription()); "The QueueSize metric", operation.getDescription());
} }
@Test
public void testMetricDescriptor() throws Exception { public void testMetricDescriptor() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler(); ModelMBeanInfo info = getMBeanInfoFromAssembler();
Descriptor desc = info.getAttribute(QUEUE_SIZE_METRIC).getDescriptor(); Descriptor desc = info.getAttribute(QUEUE_SIZE_METRIC).getDescriptor();
@ -191,6 +208,7 @@ public abstract class AbstractMetadataAssemblerTests extends AbstractJmxAssemble
assertEquals("Metric Category should be utilization", "utilization",desc.getFieldValue("metricCategory")); assertEquals("Metric Category should be utilization", "utilization",desc.getFieldValue("metricCategory"));
} }
@Test
public void testMetricDescriptorDefaults() throws Exception { public void testMetricDescriptorDefaults() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler(); ModelMBeanInfo info = getMBeanInfoFromAssembler();
Descriptor desc = info.getAttribute(CACHE_ENTRIES_METRIC).getDescriptor(); Descriptor desc = info.getAttribute(CACHE_ENTRIES_METRIC).getDescriptor();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not * Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of * use this file except in compliance with the License. You may obtain a copy of
@ -19,8 +19,13 @@ package org.springframework.jmx.export.assembler;
import javax.management.modelmbean.ModelMBeanAttributeInfo; import javax.management.modelmbean.ModelMBeanAttributeInfo;
import javax.management.modelmbean.ModelMBeanInfo; import javax.management.modelmbean.ModelMBeanInfo;
import org.junit.Test;
import static org.junit.Assert.*;
/** /**
* @author Rob Harrop * @author Rob Harrop
* @author Chris Beams
*/ */
public class InterfaceBasedMBeanInfoAssemblerCustomTests extends AbstractJmxAssemblerTests { public class InterfaceBasedMBeanInfoAssemblerCustomTests extends AbstractJmxAssemblerTests {
@ -48,6 +53,7 @@ public class InterfaceBasedMBeanInfoAssemblerCustomTests extends AbstractJmxAsse
return assembler; return assembler;
} }
@Test
public void testGetAgeIsReadOnly() throws Exception { public void testGetAgeIsReadOnly() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler(); ModelMBeanInfo info = getMBeanInfoFromAssembler();
ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE); ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE);

View File

@ -22,13 +22,19 @@ import javax.management.MBeanAttributeInfo;
import javax.management.modelmbean.ModelMBeanAttributeInfo; import javax.management.modelmbean.ModelMBeanAttributeInfo;
import javax.management.modelmbean.ModelMBeanInfo; import javax.management.modelmbean.ModelMBeanInfo;
import org.junit.Test;
import static org.junit.Assert.*;
/** /**
* @author Rob Harrop * @author Rob Harrop
* @author Chris Beams
*/ */
public class InterfaceBasedMBeanInfoAssemblerMappedTests extends AbstractJmxAssemblerTests { public class InterfaceBasedMBeanInfoAssemblerMappedTests extends AbstractJmxAssemblerTests {
protected static final String OBJECT_NAME = "bean:name=testBean4"; protected static final String OBJECT_NAME = "bean:name=testBean4";
@Test
public void testGetAgeIsReadOnly() throws Exception { public void testGetAgeIsReadOnly() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler(); ModelMBeanInfo info = getMBeanInfoFromAssembler();
ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE); ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE);
@ -37,6 +43,7 @@ public class InterfaceBasedMBeanInfoAssemblerMappedTests extends AbstractJmxAsse
assertFalse("Age is not writable", attr.isWritable()); assertFalse("Age is not writable", attr.isWritable());
} }
@Test
public void testWithUnknownClass() throws Exception { public void testWithUnknownClass() throws Exception {
try { try {
getWithMapping("com.foo.bar.Unknown"); getWithMapping("com.foo.bar.Unknown");
@ -47,6 +54,7 @@ public class InterfaceBasedMBeanInfoAssemblerMappedTests extends AbstractJmxAsse
} }
} }
@Test
public void testWithNonInterface() throws Exception { public void testWithNonInterface() throws Exception {
try { try {
getWithMapping("JmxTestBean"); getWithMapping("JmxTestBean");
@ -57,7 +65,8 @@ public class InterfaceBasedMBeanInfoAssemblerMappedTests extends AbstractJmxAsse
} }
} }
public void ignoreTestWithFallThrough() throws Exception { @Test
public void testWithFallThrough() throws Exception {
InterfaceBasedMBeanInfoAssembler assembler = InterfaceBasedMBeanInfoAssembler assembler =
getWithMapping("foobar", "org.springframework.jmx.export.assembler.ICustomJmxBean"); getWithMapping("foobar", "org.springframework.jmx.export.assembler.ICustomJmxBean");
assembler.setManagedInterfaces(new Class<?>[] {IAdditionalTestMethods.class}); assembler.setManagedInterfaces(new Class<?>[] {IAdditionalTestMethods.class});
@ -68,6 +77,7 @@ public class InterfaceBasedMBeanInfoAssemblerMappedTests extends AbstractJmxAsse
assertNickName(attr); assertNickName(attr);
} }
@Test
public void testNickNameIsExposed() throws Exception { public void testNickNameIsExposed() throws Exception {
ModelMBeanInfo inf = (ModelMBeanInfo) getMBeanInfo(); ModelMBeanInfo inf = (ModelMBeanInfo) getMBeanInfo();
MBeanAttributeInfo attr = inf.getAttribute("NickName"); MBeanAttributeInfo attr = inf.getAttribute("NickName");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -22,14 +22,20 @@ import javax.management.MBeanAttributeInfo;
import javax.management.modelmbean.ModelMBeanAttributeInfo; import javax.management.modelmbean.ModelMBeanAttributeInfo;
import javax.management.modelmbean.ModelMBeanInfo; import javax.management.modelmbean.ModelMBeanInfo;
import org.junit.Test;
import static org.junit.Assert.*;
/** /**
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Rob Harrop * @author Rob Harrop
* @author Chris Beams
*/ */
public class MethodExclusionMBeanInfoAssemblerComboTests extends AbstractJmxAssemblerTests { public class MethodExclusionMBeanInfoAssemblerComboTests extends AbstractJmxAssemblerTests {
protected static final String OBJECT_NAME = "bean:name=testBean4"; protected static final String OBJECT_NAME = "bean:name=testBean4";
@Test
public void testGetAgeIsReadOnly() throws Exception { public void testGetAgeIsReadOnly() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler(); ModelMBeanInfo info = getMBeanInfoFromAssembler();
ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE); ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE);
@ -37,6 +43,7 @@ public class MethodExclusionMBeanInfoAssemblerComboTests extends AbstractJmxAsse
assertFalse("Age is not writable", attr.isWritable()); assertFalse("Age is not writable", attr.isWritable());
} }
@Test
public void testNickNameIsExposed() throws Exception { public void testNickNameIsExposed() throws Exception {
ModelMBeanInfo inf = (ModelMBeanInfo) getMBeanInfo(); ModelMBeanInfo inf = (ModelMBeanInfo) getMBeanInfo();
MBeanAttributeInfo attr = inf.getAttribute("NickName"); MBeanAttributeInfo attr = inf.getAttribute("NickName");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -22,13 +22,19 @@ import javax.management.MBeanAttributeInfo;
import javax.management.modelmbean.ModelMBeanAttributeInfo; import javax.management.modelmbean.ModelMBeanAttributeInfo;
import javax.management.modelmbean.ModelMBeanInfo; import javax.management.modelmbean.ModelMBeanInfo;
import org.junit.Test;
import static org.junit.Assert.*;
/** /**
* @author Rob Harrop * @author Rob Harrop
* @author Chris Beams
*/ */
public class MethodExclusionMBeanInfoAssemblerMappedTests extends AbstractJmxAssemblerTests { public class MethodExclusionMBeanInfoAssemblerMappedTests extends AbstractJmxAssemblerTests {
protected static final String OBJECT_NAME = "bean:name=testBean4"; protected static final String OBJECT_NAME = "bean:name=testBean4";
@Test
public void testGetAgeIsReadOnly() throws Exception { public void testGetAgeIsReadOnly() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler(); ModelMBeanInfo info = getMBeanInfoFromAssembler();
ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE); ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE);
@ -36,6 +42,7 @@ public class MethodExclusionMBeanInfoAssemblerMappedTests extends AbstractJmxAss
assertFalse("Age is not writable", attr.isWritable()); assertFalse("Age is not writable", attr.isWritable());
} }
@Test
public void testNickNameIsExposed() throws Exception { public void testNickNameIsExposed() throws Exception {
ModelMBeanInfo inf = (ModelMBeanInfo) getMBeanInfo(); ModelMBeanInfo inf = (ModelMBeanInfo) getMBeanInfo();
MBeanAttributeInfo attr = inf.getAttribute("NickName"); MBeanAttributeInfo attr = inf.getAttribute("NickName");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -22,14 +22,20 @@ import javax.management.MBeanAttributeInfo;
import javax.management.modelmbean.ModelMBeanAttributeInfo; import javax.management.modelmbean.ModelMBeanAttributeInfo;
import javax.management.modelmbean.ModelMBeanInfo; import javax.management.modelmbean.ModelMBeanInfo;
import org.junit.Test;
import static org.junit.Assert.*;
/** /**
* @author Juergen Hoeller * @author Juergen Hoeller
* @author Rob Harrop * @author Rob Harrop
* @author Chris Beams
*/ */
public class MethodExclusionMBeanInfoAssemblerNotMappedTests extends AbstractJmxAssemblerTests { public class MethodExclusionMBeanInfoAssemblerNotMappedTests extends AbstractJmxAssemblerTests {
protected static final String OBJECT_NAME = "bean:name=testBean4"; protected static final String OBJECT_NAME = "bean:name=testBean4";
@Test
public void testGetAgeIsReadOnly() throws Exception { public void testGetAgeIsReadOnly() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler(); ModelMBeanInfo info = getMBeanInfoFromAssembler();
ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE); ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE);
@ -37,6 +43,7 @@ public class MethodExclusionMBeanInfoAssemblerNotMappedTests extends AbstractJmx
assertTrue("Age is not writable", attr.isWritable()); assertTrue("Age is not writable", attr.isWritable());
} }
@Test
public void testNickNameIsExposed() throws Exception { public void testNickNameIsExposed() throws Exception {
ModelMBeanInfo inf = (ModelMBeanInfo) getMBeanInfo(); ModelMBeanInfo inf = (ModelMBeanInfo) getMBeanInfo();
MBeanAttributeInfo attr = inf.getAttribute("NickName"); MBeanAttributeInfo attr = inf.getAttribute("NickName");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -22,11 +22,15 @@ import java.util.Properties;
import javax.management.modelmbean.ModelMBeanAttributeInfo; import javax.management.modelmbean.ModelMBeanAttributeInfo;
import javax.management.modelmbean.ModelMBeanInfo; import javax.management.modelmbean.ModelMBeanInfo;
import org.junit.Test;
import org.springframework.jmx.JmxTestBean; import org.springframework.jmx.JmxTestBean;
import static org.junit.Assert.*;
/** /**
* @author Rob Harrop * @author Rob Harrop
* @author Rick Evans * @author Rick Evans
* @author Chris Beams
*/ */
public class MethodExclusionMBeanInfoAssemblerTests extends AbstractJmxAssemblerTests { public class MethodExclusionMBeanInfoAssemblerTests extends AbstractJmxAssemblerTests {
@ -60,6 +64,7 @@ public class MethodExclusionMBeanInfoAssemblerTests extends AbstractJmxAssembler
return assembler; return assembler;
} }
@Test
public void testSupermanIsReadOnly() throws Exception { public void testSupermanIsReadOnly() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler(); ModelMBeanInfo info = getMBeanInfoFromAssembler();
ModelMBeanAttributeInfo attr = info.getAttribute("Superman"); ModelMBeanAttributeInfo attr = info.getAttribute("Superman");
@ -71,6 +76,7 @@ public class MethodExclusionMBeanInfoAssemblerTests extends AbstractJmxAssembler
/* /*
* http://opensource.atlassian.com/projects/spring/browse/SPR-2754 * http://opensource.atlassian.com/projects/spring/browse/SPR-2754
*/ */
@Test
public void testIsNotIgnoredDoesntIgnoreUnspecifiedBeanMethods() throws Exception { public void testIsNotIgnoredDoesntIgnoreUnspecifiedBeanMethods() throws Exception {
final String beanKey = "myTestBean"; final String beanKey = "myTestBean";
MethodExclusionMBeanInfoAssembler assembler = new MethodExclusionMBeanInfoAssembler(); MethodExclusionMBeanInfoAssembler assembler = new MethodExclusionMBeanInfoAssembler();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not * Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of * use this file except in compliance with the License. You may obtain a copy of
@ -16,18 +16,25 @@
package org.springframework.jmx.export.assembler; package org.springframework.jmx.export.assembler;
import java.util.Properties;
import javax.management.MBeanAttributeInfo; import javax.management.MBeanAttributeInfo;
import javax.management.modelmbean.ModelMBeanAttributeInfo; import javax.management.modelmbean.ModelMBeanAttributeInfo;
import javax.management.modelmbean.ModelMBeanInfo; import javax.management.modelmbean.ModelMBeanInfo;
import java.util.Properties;
import org.junit.Test;
import static org.junit.Assert.*;
/** /**
* @author Rob Harrop * @author Rob Harrop
* @author Chris Beams
*/ */
public class MethodNameBasedMBeanInfoAssemblerMappedTests extends AbstractJmxAssemblerTests { public class MethodNameBasedMBeanInfoAssemblerMappedTests extends AbstractJmxAssemblerTests {
protected static final String OBJECT_NAME = "bean:name=testBean4"; protected static final String OBJECT_NAME = "bean:name=testBean4";
@Test
public void testGetAgeIsReadOnly() throws Exception { public void testGetAgeIsReadOnly() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler(); ModelMBeanInfo info = getMBeanInfoFromAssembler();
ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE); ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE);
@ -36,6 +43,7 @@ public class MethodNameBasedMBeanInfoAssemblerMappedTests extends AbstractJmxAss
assertFalse("Age is not writable", attr.isWritable()); assertFalse("Age is not writable", attr.isWritable());
} }
@Test
public void testWithFallThrough() throws Exception { public void testWithFallThrough() throws Exception {
MethodNameBasedMBeanInfoAssembler assembler = MethodNameBasedMBeanInfoAssembler assembler =
getWithMapping("foobar", "add,myOperation,getName,setName,getAge"); getWithMapping("foobar", "add,myOperation,getName,setName,getAge");
@ -47,6 +55,7 @@ public class MethodNameBasedMBeanInfoAssemblerMappedTests extends AbstractJmxAss
assertNickName(attr); assertNickName(attr);
} }
@Test
public void testNickNameIsExposed() throws Exception { public void testNickNameIsExposed() throws Exception {
ModelMBeanInfo inf = (ModelMBeanInfo) getMBeanInfo(); ModelMBeanInfo inf = (ModelMBeanInfo) getMBeanInfo();
MBeanAttributeInfo attr = inf.getAttribute("NickName"); MBeanAttributeInfo attr = inf.getAttribute("NickName");

View File

@ -20,9 +20,14 @@ import javax.management.MBeanOperationInfo;
import javax.management.modelmbean.ModelMBeanAttributeInfo; import javax.management.modelmbean.ModelMBeanAttributeInfo;
import javax.management.modelmbean.ModelMBeanInfo; import javax.management.modelmbean.ModelMBeanInfo;
import org.junit.Test;
import static org.junit.Assert.*;
/** /**
* @author Rob Harrop * @author Rob Harrop
* @author David Boden * @author David Boden
* @author Chris Beams
*/ */
public class MethodNameBasedMBeanInfoAssemblerTests extends AbstractJmxAssemblerTests { public class MethodNameBasedMBeanInfoAssemblerTests extends AbstractJmxAssemblerTests {
@ -50,6 +55,7 @@ public class MethodNameBasedMBeanInfoAssemblerTests extends AbstractJmxAssembler
return assembler; return assembler;
} }
@Test
public void testGetAgeIsReadOnly() throws Exception { public void testGetAgeIsReadOnly() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler(); ModelMBeanInfo info = getMBeanInfoFromAssembler();
ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE); ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE);
@ -58,6 +64,7 @@ public class MethodNameBasedMBeanInfoAssemblerTests extends AbstractJmxAssembler
assertFalse(attr.isWritable()); assertFalse(attr.isWritable());
} }
@Test
public void testSetNameParameterIsNamed() throws Exception { public void testSetNameParameterIsNamed() throws Exception {
ModelMBeanInfo info = getMBeanInfoFromAssembler(); ModelMBeanInfo info = getMBeanInfoFromAssembler();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2011 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not * Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of * use this file except in compliance with the License. You may obtain a copy of
@ -28,23 +28,36 @@ import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory; import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL; import javax.management.remote.JMXServiceURL;
import org.junit.Ignore; import org.junit.Test;
import org.springframework.jmx.AbstractMBeanServerTests; import org.springframework.jmx.AbstractMBeanServerTests;
import org.springframework.tests.Assume;
import org.springframework.tests.TestGroup;
import static org.junit.Assert.*;
/** /**
* @author Rob Harrop * @author Rob Harrop
* @author Chris Beams
*/ */
// TODO [SPR-8089] Clean up ignored JMX tests. public class ConnectorServerFactoryBeanTests extends AbstractMBeanServerTests {
//
// @Ignore should have no effect for JUnit 3.8 tests; however, it appears
// that tests on the CI server -- as well as those in Eclipse -- do in
// fact get ignored. So we leave @Ignore here so that developers can
// easily search for ignored tests.
@Ignore("Requires jmxremote_optional.jar; see comments in AbstractMBeanServerTests for details.")
public class ConnectorServerFactoryBeanTestsIgnore extends AbstractMBeanServerTests {
private static final String OBJECT_NAME = "spring:type=connector,name=test"; private static final String OBJECT_NAME = "spring:type=connector,name=test";
private boolean runTests = false;
@Override
protected void onSetUp() throws Exception {
Assume.group(TestGroup.JMXMP);
runTests = true;
}
@Override
public void tearDown() throws Exception {
if (runTests) {
super.tearDown();
}
}
@Test
public void testStartupWithLocatedServer() throws Exception { public void testStartupWithLocatedServer() throws Exception {
ConnectorServerFactoryBean bean = new ConnectorServerFactoryBean(); ConnectorServerFactoryBean bean = new ConnectorServerFactoryBean();
bean.afterPropertiesSet(); bean.afterPropertiesSet();
@ -56,6 +69,7 @@ public class ConnectorServerFactoryBeanTestsIgnore extends AbstractMBeanServerTe
} }
} }
@Test
public void testStartupWithSuppliedServer() throws Exception { public void testStartupWithSuppliedServer() throws Exception {
//Added a brief snooze here - seems to fix occasional //Added a brief snooze here - seems to fix occasional
//java.net.BindException: Address already in use errors //java.net.BindException: Address already in use errors
@ -72,6 +86,7 @@ public class ConnectorServerFactoryBeanTestsIgnore extends AbstractMBeanServerTe
} }
} }
@Test
public void testRegisterWithMBeanServer() throws Exception { public void testRegisterWithMBeanServer() throws Exception {
//Added a brief snooze here - seems to fix occasional //Added a brief snooze here - seems to fix occasional
//java.net.BindException: Address already in use errors //java.net.BindException: Address already in use errors
@ -89,6 +104,7 @@ public class ConnectorServerFactoryBeanTestsIgnore extends AbstractMBeanServerTe
} }
} }
@Test
public void testNoRegisterWithMBeanServer() throws Exception { public void testNoRegisterWithMBeanServer() throws Exception {
ConnectorServerFactoryBean bean = new ConnectorServerFactoryBean(); ConnectorServerFactoryBean bean = new ConnectorServerFactoryBean();
bean.afterPropertiesSet(); bean.afterPropertiesSet();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -23,9 +23,13 @@ import javax.management.remote.JMXConnectorServer;
import javax.management.remote.JMXConnectorServerFactory; import javax.management.remote.JMXConnectorServerFactory;
import javax.management.remote.JMXServiceURL; import javax.management.remote.JMXServiceURL;
import org.junit.Ignore; import org.junit.Test;
import org.springframework.aop.support.AopUtils; import org.springframework.aop.support.AopUtils;
import org.springframework.jmx.AbstractMBeanServerTests; import org.springframework.jmx.AbstractMBeanServerTests;
import org.springframework.tests.Assume;
import org.springframework.tests.TestGroup;
import static org.junit.Assert.*;
/** /**
* @author Rob Harrop * @author Rob Harrop
@ -43,16 +47,9 @@ public class MBeanServerConnectionFactoryBeanTests extends AbstractMBeanServerTe
return JMXConnectorServerFactory.newJMXConnectorServer(getServiceUrl(), null, getServer()); return JMXConnectorServerFactory.newJMXConnectorServer(getServiceUrl(), null, getServer());
} }
// TODO [SPR-8089] Clean up ignored JMX tests. @Test
// public void testTestValidConnection() throws Exception {
// @Ignore should have no effect for JUnit 3.8 tests; however, it appears Assume.group(TestGroup.JMXMP);
// that tests on the CI server -- as well as those in Eclipse -- do in
// fact get ignored. So we leave @Ignore here so that developers can
// easily search for ignored tests.
//
// Once fixed, renamed to test* instead of ignore*.
@Ignore("Requires jmxremote_optional.jar; see comments in AbstractMBeanServerTests for details.")
public void ignoreTestValidConnection() throws Exception {
JMXConnectorServer connectorServer = getConnectorServer(); JMXConnectorServer connectorServer = getConnectorServer();
connectorServer.start(); connectorServer.start();
@ -75,6 +72,7 @@ public class MBeanServerConnectionFactoryBeanTests extends AbstractMBeanServerTe
} }
} }
@Test
public void testWithNoServiceUrl() throws Exception { public void testWithNoServiceUrl() throws Exception {
MBeanServerConnectionFactoryBean bean = new MBeanServerConnectionFactoryBean(); MBeanServerConnectionFactoryBean bean = new MBeanServerConnectionFactoryBean();
try { try {
@ -85,16 +83,9 @@ public class MBeanServerConnectionFactoryBeanTests extends AbstractMBeanServerTe
} }
} }
// TODO [SPR-8089] Clean up ignored JMX tests. @Test
// public void testTestWithLazyConnection() throws Exception {
// @Ignore should have no effect for JUnit 3.8 tests; however, it appears Assume.group(TestGroup.JMXMP);
// that tests on the CI server -- as well as those in Eclipse -- do in
// fact get ignored. So we leave @Ignore here so that developers can
// easily search for ignored tests.
//
// Once fixed, renamed to test* instead of ignore*.
@Ignore("Requires jmxremote_optional.jar; see comments in AbstractMBeanServerTests for details.")
public void ignoreTestWithLazyConnection() throws Exception {
MBeanServerConnectionFactoryBean bean = new MBeanServerConnectionFactoryBean(); MBeanServerConnectionFactoryBean bean = new MBeanServerConnectionFactoryBean();
bean.setServiceUrl(SERVICE_URL); bean.setServiceUrl(SERVICE_URL);
bean.setConnectOnStartup(false); bean.setConnectOnStartup(false);
@ -116,6 +107,7 @@ public class MBeanServerConnectionFactoryBeanTests extends AbstractMBeanServerTe
} }
} }
@Test
public void testWithLazyConnectionAndNoAccess() throws Exception { public void testWithLazyConnectionAndNoAccess() throws Exception {
MBeanServerConnectionFactoryBean bean = new MBeanServerConnectionFactoryBean(); MBeanServerConnectionFactoryBean bean = new MBeanServerConnectionFactoryBean();
bean.setServiceUrl(SERVICE_URL); bean.setServiceUrl(SERVICE_URL);

View File

@ -48,7 +48,13 @@ public enum TestGroup {
* {@code StopWatch}, etc. should be considered a candidate as their successful * {@code StopWatch}, etc. should be considered a candidate as their successful
* execution is likely to be based on events occurring within a given time window. * execution is likely to be based on events occurring within a given time window.
*/ */
PERFORMANCE; PERFORMANCE,
/**
* Tests requiring the presence of jmxremote_optional.jar in jre/lib/ext in order to
* avoid "Unsupported protocol: jmxmp" errors.
*/
JMXMP;
/** /**