Skip to content

Commit bd414df

Browse files
committed
Remove JMXMP from TestGroup
Due to the changes in a7425c8, we no longer need to execute tests using the JMXMP protocol in PERFORMANCE builds. This commit removes the JMXMP constant from the TestGroup enum and updates affected tests, thereby effectively including such tests in the standard build from now on. See gh-22757
1 parent fd8fa30 commit bd414df

File tree

8 files changed

+16
-75
lines changed

8 files changed

+16
-75
lines changed

spring-context/src/test/java/org/springframework/jmx/AbstractMBeanServerTests.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,20 +27,11 @@
2727
import org.springframework.context.ConfigurableApplicationContext;
2828
import org.springframework.context.support.GenericApplicationContext;
2929
import org.springframework.jmx.export.MBeanExporter;
30-
import org.springframework.tests.TestGroup;
3130
import org.springframework.util.MBeanTestUtils;
3231

3332
import static org.junit.Assert.*;
3433

3534
/**
36-
* <strong>Note:</strong> certain tests throughout this hierarchy require the presence of
37-
* the {@code jmxremote_optional.jar} in your classpath. For this reason, these tests are
38-
* run only if {@link TestGroup#JMXMP} is enabled.
39-
*
40-
* <p>If you wish to run these tests, follow the instructions in the TestGroup class to
41-
* enable JMXMP tests (i.e., set the following Java system property:
42-
* {@code -DtestGroups=jmxmp}).
43-
*
4435
* <p>If you run into the <em>"Unsupported protocol: jmxmp"</em> error, you will need to
4536
* download the <a href="https://www.oracle.com/technetwork/java/javase/tech/download-jsp-141676.html">JMX
4637
* Remote API 1.0.1_04 Reference Implementation</a> from Oracle and extract
@@ -49,7 +40,6 @@
4940
*
5041
* <p>See also:
5142
* <ul>
52-
* <li>
5343
* <li><a href="https://jira.spring.io/browse/SPR-8093">SPR-8093</a></li>
5444
* <li><a href="https://issuetracker.springsource.com/browse/EBR-349">EBR-349</a></li>
5545
* </ul>

spring-context/src/test/java/org/springframework/jmx/access/MBeanClientInterceptorTests.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -36,17 +36,12 @@
3636
import org.springframework.jmx.JmxTestBean;
3737
import org.springframework.jmx.export.MBeanExporter;
3838
import org.springframework.jmx.export.assembler.AbstractReflectiveMBeanInfoAssembler;
39-
import org.springframework.tests.Assume;
40-
import org.springframework.tests.TestGroup;
4139
import org.springframework.util.SocketUtils;
4240

4341
import static org.junit.Assert.*;
4442
import static org.junit.Assume.*;
4543

4644
/**
47-
* To run the tests in the class, set the following Java system property:
48-
* {@code -DtestGroups=jmxmp}.
49-
*
5045
* @author Rob Harrop
5146
* @author Juergen Hoeller
5247
* @author Sam Brannen
@@ -175,7 +170,6 @@ public void testInvokeUnexposedMethodWithException() throws Exception {
175170
@Test
176171
public void testTestLazyConnectionToRemote() throws Exception {
177172
assumeTrue(runTests);
178-
Assume.group(TestGroup.JMXMP);
179173

180174
final int port = SocketUtils.findAvailableTcpPort();
181175

spring-context/src/test/java/org/springframework/jmx/access/RemoteMBeanClientInterceptorTests.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,14 +27,9 @@
2727

2828
import org.junit.After;
2929

30-
import org.springframework.tests.Assume;
31-
import org.springframework.tests.TestGroup;
3230
import org.springframework.util.SocketUtils;
3331

3432
/**
35-
* To run the tests in the class, set the following Java system property:
36-
* {@code -DtestGroups=jmxmp}.
37-
*
3833
* @author Rob Harrop
3934
* @author Chris Beams
4035
* @author Sam Brannen
@@ -58,9 +53,6 @@ public class RemoteMBeanClientInterceptorTests extends MBeanClientInterceptorTes
5853

5954
@Override
6055
public void onSetUp() throws Exception {
61-
runTests = false;
62-
Assume.group(TestGroup.JMXMP);
63-
runTests = true;
6456
super.onSetUp();
6557
this.connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(getServiceUrl(), null, getServer());
6658
try {

spring-context/src/test/java/org/springframework/jmx/support/ConnectorServerFactoryBeanTests.java

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,19 +27,13 @@
2727
import javax.management.remote.JMXConnectorFactory;
2828
import javax.management.remote.JMXServiceURL;
2929

30-
import org.junit.After;
3130
import org.junit.Test;
3231

3332
import org.springframework.jmx.AbstractMBeanServerTests;
34-
import org.springframework.tests.Assume;
35-
import org.springframework.tests.TestGroup;
3633

3734
import static org.junit.Assert.*;
3835

3936
/**
40-
* To run the tests in the class, set the following Java system property:
41-
* {@code -DtestGroups=jmxmp}.
42-
*
4337
* @author Rob Harrop
4438
* @author Chris Beams
4539
* @author Sam Brannen
@@ -49,18 +43,6 @@ public class ConnectorServerFactoryBeanTests extends AbstractMBeanServerTests {
4943
private static final String OBJECT_NAME = "spring:type=connector,name=test";
5044

5145

52-
@Override
53-
protected void onSetUp() throws Exception {
54-
Assume.group(TestGroup.JMXMP);
55-
}
56-
57-
@After
58-
@Override
59-
public void tearDown() throws Exception {
60-
Assume.group(TestGroup.JMXMP, () -> super.tearDown());
61-
}
62-
63-
6446
@Test
6547
public void startupWithLocatedServer() throws Exception {
6648
ConnectorServerFactoryBean bean = new ConnectorServerFactoryBean();

spring-context/src/test/java/org/springframework/jmx/support/MBeanServerConnectionFactoryBeanTests.java

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,28 +26,19 @@
2626

2727
import org.springframework.aop.support.AopUtils;
2828
import org.springframework.jmx.AbstractMBeanServerTests;
29-
import org.springframework.tests.Assume;
30-
import org.springframework.tests.TestGroup;
3129
import org.springframework.util.SocketUtils;
3230

3331
import static org.junit.Assert.*;
3432

3533
/**
36-
* To run the tests in the class, set the following Java system property:
37-
* {@code -DtestGroups=jmxmp}.
38-
*
3934
* @author Rob Harrop
4035
* @author Juergen Hoeller
4136
* @author Sam Brannen
4237
*/
4338
public class MBeanServerConnectionFactoryBeanTests extends AbstractMBeanServerTests {
4439

45-
private final String serviceUrl;
40+
private final String serviceUrl = "service:jmx:jmxmp://localhost:" + SocketUtils.findAvailableTcpPort(9800, 9900);
4641

47-
{
48-
int port = SocketUtils.findAvailableTcpPort(9800, 9900);
49-
this.serviceUrl = "service:jmx:jmxmp://localhost:" + port;
50-
}
5142

5243
private JMXServiceURL getJMXServiceUrl() throws MalformedURLException {
5344
return new JMXServiceURL(serviceUrl);
@@ -59,7 +50,6 @@ private JMXConnectorServer getConnectorServer() throws Exception {
5950

6051
@Test
6152
public void testTestValidConnection() throws Exception {
62-
Assume.group(TestGroup.JMXMP);
6353
JMXConnectorServer connectorServer = getConnectorServer();
6454
connectorServer.start();
6555

@@ -92,7 +82,6 @@ public void testWithNoServiceUrl() throws Exception {
9282

9383
@Test
9484
public void testTestWithLazyConnection() throws Exception {
95-
Assume.group(TestGroup.JMXMP);
9685
MBeanServerConnectionFactoryBean bean = new MBeanServerConnectionFactoryBean();
9786
bean.setServiceUrl(serviceUrl);
9887
bean.setConnectOnStartup(false);

spring-core/src/test/java/org/springframework/tests/AssumeTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,22 +58,22 @@ public void restoreOriginalTestGroups() {
5858
@Test
5959
public void assumeGroupWithNoActiveTestGroups() {
6060
setTestGroups("");
61-
Assume.group(JMXMP);
61+
Assume.group(LONG_RUNNING);
6262
fail("assumption should have failed");
6363
}
6464

6565
@Test
6666
public void assumeGroupWithNoMatchingActiveTestGroup() {
6767
setTestGroups(PERFORMANCE, CI);
68-
Assume.group(JMXMP);
68+
Assume.group(LONG_RUNNING);
6969
fail("assumption should have failed");
7070
}
7171

7272
@Test
7373
public void assumeGroupWithMatchingActiveTestGroup() {
74-
setTestGroups(JMXMP);
74+
setTestGroups(LONG_RUNNING);
7575
try {
76-
Assume.group(JMXMP);
76+
Assume.group(LONG_RUNNING);
7777
}
7878
catch (AssumptionViolatedException ex) {
7979
fail("assumption should NOT have failed");
@@ -99,7 +99,7 @@ private void assertBogusActiveTestGroupBehavior(String testGroups) {
9999

100100
setTestGroups(testGroups);
101101
try {
102-
Assume.group(JMXMP);
102+
Assume.group(LONG_RUNNING);
103103
fail("assumption should have failed");
104104
}
105105
catch (IllegalStateException ex) {
@@ -109,7 +109,7 @@ private void assertBogusActiveTestGroupBehavior(String testGroups) {
109109
assertThat(ex.getCause(), instanceOf(IllegalArgumentException.class));
110110
assertThat(ex.getCause().getMessage(),
111111
equalTo("Unable to find test group 'bogus' when parsing testGroups value: '" + testGroups
112-
+ "'. Available groups include: [LONG_RUNNING,PERFORMANCE,JMXMP,CI]"));
112+
+ "'. Available groups include: [LONG_RUNNING,PERFORMANCE,CI]"));
113113
}
114114
}
115115

spring-core/src/test/java/org/springframework/tests/TestGroup.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -50,12 +50,6 @@ public enum TestGroup {
5050
*/
5151
PERFORMANCE,
5252

53-
/**
54-
* Tests requiring the presence of jmxremote_optional.jar in jre/lib/ext in order to
55-
* avoid "Unsupported protocol: jmxmp" errors.
56-
*/
57-
JMXMP,
58-
5953
/**
6054
* Tests that should only be run on the continuous integration server.
6155
*/

spring-core/src/test/java/org/springframework/tests/TestGroupTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -71,7 +71,7 @@ public void parseMissing() {
7171
thrown.expect(IllegalArgumentException.class);
7272
thrown.expectMessage("Unable to find test group 'missing' when parsing " +
7373
"testGroups value: 'performance, missing'. Available groups include: " +
74-
"[LONG_RUNNING,PERFORMANCE,JMXMP,CI]");
74+
"[LONG_RUNNING,PERFORMANCE,CI]");
7575
TestGroup.parse("performance, missing");
7676
}
7777

@@ -92,7 +92,7 @@ public void parseAllExceptMissing() {
9292
thrown.expect(IllegalArgumentException.class);
9393
thrown.expectMessage("Unable to find test group 'missing' when parsing " +
9494
"testGroups value: 'all-missing'. Available groups include: " +
95-
"[LONG_RUNNING,PERFORMANCE,JMXMP,CI]");
95+
"[LONG_RUNNING,PERFORMANCE,CI]");
9696
TestGroup.parse("all-missing");
9797
}
9898

0 commit comments

Comments
 (0)