diff --git a/spring-context/src/test/java/org/springframework/jmx/AbstractMBeanServerTests.java b/spring-context/src/test/java/org/springframework/jmx/AbstractMBeanServerTests.java index 9a36d73d9be..524f9b07aee 100644 --- a/spring-context/src/test/java/org/springframework/jmx/AbstractMBeanServerTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/AbstractMBeanServerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,20 +27,11 @@ import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.support.GenericApplicationContext; import org.springframework.jmx.export.MBeanExporter; -import org.springframework.tests.TestGroup; import org.springframework.util.MBeanTestUtils; import static org.junit.Assert.*; /** - * Note: certain tests throughout this hierarchy require the presence of - * the {@code jmxremote_optional.jar} in your classpath. For this reason, these tests are - * run only if {@link TestGroup#JMXMP} is enabled. - * - *
If you wish to run these tests, follow the instructions in the TestGroup class to - * enable JMXMP tests (i.e., set the following Java system property: - * {@code -DtestGroups=jmxmp}). - * *
If you run into the "Unsupported protocol: jmxmp" error, you will need to * download the JMX * Remote API 1.0.1_04 Reference Implementation from Oracle and extract @@ -49,7 +40,6 @@ import static org.junit.Assert.*; * *
See also: *
diff --git a/spring-context/src/test/java/org/springframework/jmx/access/MBeanClientInterceptorTests.java b/spring-context/src/test/java/org/springframework/jmx/access/MBeanClientInterceptorTests.java index cf839755174..7fe92ec2161 100644 --- a/spring-context/src/test/java/org/springframework/jmx/access/MBeanClientInterceptorTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/access/MBeanClientInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,17 +36,12 @@ import org.springframework.jmx.JmxException; import org.springframework.jmx.JmxTestBean; import org.springframework.jmx.export.MBeanExporter; import org.springframework.jmx.export.assembler.AbstractReflectiveMBeanInfoAssembler; -import org.springframework.tests.Assume; -import org.springframework.tests.TestGroup; import org.springframework.util.SocketUtils; import static org.junit.Assert.*; import static org.junit.Assume.*; /** - * To run the tests in the class, set the following Java system property: - * {@code -DtestGroups=jmxmp}. - * * @author Rob Harrop * @author Juergen Hoeller * @author Sam Brannen @@ -175,7 +170,6 @@ public class MBeanClientInterceptorTests extends AbstractMBeanServerTests { @Test public void testTestLazyConnectionToRemote() throws Exception { assumeTrue(runTests); - Assume.group(TestGroup.JMXMP); final int port = SocketUtils.findAvailableTcpPort(); diff --git a/spring-context/src/test/java/org/springframework/jmx/access/RemoteMBeanClientInterceptorTests.java b/spring-context/src/test/java/org/springframework/jmx/access/RemoteMBeanClientInterceptorTests.java index ab6cf60debd..628aac0b096 100644 --- a/spring-context/src/test/java/org/springframework/jmx/access/RemoteMBeanClientInterceptorTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/access/RemoteMBeanClientInterceptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,14 +27,9 @@ import javax.management.remote.JMXServiceURL; import org.junit.After; -import org.springframework.tests.Assume; -import org.springframework.tests.TestGroup; import org.springframework.util.SocketUtils; /** - * To run the tests in the class, set the following Java system property: - * {@code -DtestGroups=jmxmp}. - * * @author Rob Harrop * @author Chris Beams * @author Sam Brannen @@ -58,9 +53,6 @@ public class RemoteMBeanClientInterceptorTests extends MBeanClientInterceptorTes @Override public void onSetUp() throws Exception { - runTests = false; - Assume.group(TestGroup.JMXMP); - runTests = true; super.onSetUp(); this.connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(getServiceUrl(), null, getServer()); try { diff --git a/spring-context/src/test/java/org/springframework/jmx/support/ConnectorServerFactoryBeanTests.java b/spring-context/src/test/java/org/springframework/jmx/support/ConnectorServerFactoryBeanTests.java index 9dd45e0f239..8177b792a23 100644 --- a/spring-context/src/test/java/org/springframework/jmx/support/ConnectorServerFactoryBeanTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/support/ConnectorServerFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,19 +27,13 @@ import javax.management.remote.JMXConnector; import javax.management.remote.JMXConnectorFactory; import javax.management.remote.JMXServiceURL; -import org.junit.After; import org.junit.Test; import org.springframework.jmx.AbstractMBeanServerTests; -import org.springframework.tests.Assume; -import org.springframework.tests.TestGroup; import static org.junit.Assert.*; /** - * To run the tests in the class, set the following Java system property: - * {@code -DtestGroups=jmxmp}. - * * @author Rob Harrop * @author Chris Beams * @author Sam Brannen @@ -49,18 +43,6 @@ public class ConnectorServerFactoryBeanTests extends AbstractMBeanServerTests { private static final String OBJECT_NAME = "spring:type=connector,name=test"; - @Override - protected void onSetUp() throws Exception { - Assume.group(TestGroup.JMXMP); - } - - @After - @Override - public void tearDown() throws Exception { - Assume.group(TestGroup.JMXMP, () -> super.tearDown()); - } - - @Test public void startupWithLocatedServer() throws Exception { ConnectorServerFactoryBean bean = new ConnectorServerFactoryBean(); diff --git a/spring-context/src/test/java/org/springframework/jmx/support/MBeanServerConnectionFactoryBeanTests.java b/spring-context/src/test/java/org/springframework/jmx/support/MBeanServerConnectionFactoryBeanTests.java index 1656b3b1b00..a6a9e6f56bf 100644 --- a/spring-context/src/test/java/org/springframework/jmx/support/MBeanServerConnectionFactoryBeanTests.java +++ b/spring-context/src/test/java/org/springframework/jmx/support/MBeanServerConnectionFactoryBeanTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,28 +26,19 @@ import org.junit.Test; import org.springframework.aop.support.AopUtils; import org.springframework.jmx.AbstractMBeanServerTests; -import org.springframework.tests.Assume; -import org.springframework.tests.TestGroup; import org.springframework.util.SocketUtils; import static org.junit.Assert.*; /** - * To run the tests in the class, set the following Java system property: - * {@code -DtestGroups=jmxmp}. - * * @author Rob Harrop * @author Juergen Hoeller * @author Sam Brannen */ public class MBeanServerConnectionFactoryBeanTests extends AbstractMBeanServerTests { - private final String serviceUrl; + private final String serviceUrl = "service:jmx:jmxmp://localhost:" + SocketUtils.findAvailableTcpPort(9800, 9900); - { - int port = SocketUtils.findAvailableTcpPort(9800, 9900); - this.serviceUrl = "service:jmx:jmxmp://localhost:" + port; - } private JMXServiceURL getJMXServiceUrl() throws MalformedURLException { return new JMXServiceURL(serviceUrl); @@ -59,7 +50,6 @@ public class MBeanServerConnectionFactoryBeanTests extends AbstractMBeanServerTe @Test public void testTestValidConnection() throws Exception { - Assume.group(TestGroup.JMXMP); JMXConnectorServer connectorServer = getConnectorServer(); connectorServer.start(); @@ -92,7 +82,6 @@ public class MBeanServerConnectionFactoryBeanTests extends AbstractMBeanServerTe @Test public void testTestWithLazyConnection() throws Exception { - Assume.group(TestGroup.JMXMP); MBeanServerConnectionFactoryBean bean = new MBeanServerConnectionFactoryBean(); bean.setServiceUrl(serviceUrl); bean.setConnectOnStartup(false); diff --git a/spring-core/src/test/java/org/springframework/tests/AssumeTests.java b/spring-core/src/test/java/org/springframework/tests/AssumeTests.java index 09401c073e8..76f6e59ffab 100644 --- a/spring-core/src/test/java/org/springframework/tests/AssumeTests.java +++ b/spring-core/src/test/java/org/springframework/tests/AssumeTests.java @@ -58,22 +58,22 @@ public class AssumeTests { @Test public void assumeGroupWithNoActiveTestGroups() { setTestGroups(""); - Assume.group(JMXMP); + Assume.group(LONG_RUNNING); fail("assumption should have failed"); } @Test public void assumeGroupWithNoMatchingActiveTestGroup() { setTestGroups(PERFORMANCE, CI); - Assume.group(JMXMP); + Assume.group(LONG_RUNNING); fail("assumption should have failed"); } @Test public void assumeGroupWithMatchingActiveTestGroup() { - setTestGroups(JMXMP); + setTestGroups(LONG_RUNNING); try { - Assume.group(JMXMP); + Assume.group(LONG_RUNNING); } catch (AssumptionViolatedException ex) { fail("assumption should NOT have failed"); @@ -99,7 +99,7 @@ public class AssumeTests { setTestGroups(testGroups); try { - Assume.group(JMXMP); + Assume.group(LONG_RUNNING); fail("assumption should have failed"); } catch (IllegalStateException ex) { @@ -109,7 +109,7 @@ public class AssumeTests { assertThat(ex.getCause(), instanceOf(IllegalArgumentException.class)); assertThat(ex.getCause().getMessage(), equalTo("Unable to find test group 'bogus' when parsing testGroups value: '" + testGroups - + "'. Available groups include: [LONG_RUNNING,PERFORMANCE,JMXMP,CI]")); + + "'. Available groups include: [LONG_RUNNING,PERFORMANCE,CI]")); } } diff --git a/spring-core/src/test/java/org/springframework/tests/TestGroup.java b/spring-core/src/test/java/org/springframework/tests/TestGroup.java index 61ce88b064a..d1dbdbe76f0 100644 --- a/spring-core/src/test/java/org/springframework/tests/TestGroup.java +++ b/spring-core/src/test/java/org/springframework/tests/TestGroup.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,12 +50,6 @@ public enum TestGroup { */ PERFORMANCE, - /** - * Tests requiring the presence of jmxremote_optional.jar in jre/lib/ext in order to - * avoid "Unsupported protocol: jmxmp" errors. - */ - JMXMP, - /** * Tests that should only be run on the continuous integration server. */ diff --git a/spring-core/src/test/java/org/springframework/tests/TestGroupTests.java b/spring-core/src/test/java/org/springframework/tests/TestGroupTests.java index 286ba284a32..54a2fe1e1e3 100644 --- a/spring-core/src/test/java/org/springframework/tests/TestGroupTests.java +++ b/spring-core/src/test/java/org/springframework/tests/TestGroupTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -71,7 +71,7 @@ public class TestGroupTests { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Unable to find test group 'missing' when parsing " + "testGroups value: 'performance, missing'. Available groups include: " + - "[LONG_RUNNING,PERFORMANCE,JMXMP,CI]"); + "[LONG_RUNNING,PERFORMANCE,CI]"); TestGroup.parse("performance, missing"); } @@ -92,7 +92,7 @@ public class TestGroupTests { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("Unable to find test group 'missing' when parsing " + "testGroups value: 'all-missing'. Available groups include: " + - "[LONG_RUNNING,PERFORMANCE,JMXMP,CI]"); + "[LONG_RUNNING,PERFORMANCE,CI]"); TestGroup.parse("all-missing"); }