Skip to content

Commit

Permalink
[WFCORE-7063] Removing useless code related to JDK version detection
Browse files Browse the repository at this point in the history
  • Loading branch information
ropalka committed Nov 21, 2024
1 parent 6f974db commit d78b331
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,6 @@ public void testSslServiceAuth() throws Throwable {

@Test
public void testSslServiceAuthTLS13() throws Throwable {
Assume.assumeTrue("Skipping testSslServiceAuthTLS13, test is not being run on JDK 11+.",
JdkUtils.getJavaSpecVersion() >= 11);
testCommunication("ServerSslContextTLS13", "ClientSslContextTLS13", false, "OU=Elytron,O=Elytron,C=CZ,ST=Elytron,CN=localhost",
"OU=Elytron,O=Elytron,C=UK,ST=Elytron,CN=Firefly", "TLS_AES_256_GCM_SHA384", true);
}
Expand Down Expand Up @@ -453,8 +451,6 @@ public void testSslServiceAuthSSLv2HelloOpenSsl() throws Throwable {

@Test
public void testSslServiceAuthProtocolMismatch() throws Throwable {
Assume.assumeTrue("Skipping testSslServiceAuthProtocolMismatch, test is not being run on JDK 11+.",
JdkUtils.getJavaSpecVersion() >= 11);
try {
testCommunication("ServerSslContextTLS12Only", "ClientSslContextTLS13Only", false, "",
"", "");
Expand All @@ -465,8 +461,6 @@ public void testSslServiceAuthProtocolMismatch() throws Throwable {

@Test
public void testSslServiceAuthCipherSuiteMismatch() throws Throwable {
Assume.assumeTrue("Skipping testSslServiceAuthCipherSuiteMismatch, test is not being run on JDK 11+.",
JdkUtils.getJavaSpecVersion() >= 11);
try {
testCommunication("ServerSslContextTLS13Only", "ClientSslContextTLS13Only", false, "",
"", "");
Expand Down Expand Up @@ -670,7 +664,6 @@ private void testCommunication(String serverContextName, String clientContextNam
}

private void testCommunication(String serverContextName, String clientContextName, boolean defaultClient, String expectedServerPrincipal, String expectedClientPrincipal, String expectedCipherSuite, boolean tls13Test, Map<String, String[]> protocolChecker) throws Throwable{
boolean testSessions = ! (JdkUtils.getJavaSpecVersion() >= 11); // session IDs are essentially obsolete in TLSv1.3
SSLContext serverContext = getSslContext(serverContextName);
SSLContext clientContext = defaultClient ? SSLContext.getDefault() : getSslContext(clientContextName);
ServerSocket listeningSocket;
Expand Down Expand Up @@ -717,9 +710,6 @@ private void testCommunication(String serverContextName, String clientContextNam
try {
Assert.assertArrayEquals(new byte[]{0x12, 0x34}, serverFuture.get());
Assert.assertArrayEquals(new byte[]{0x56, 0x78}, clientFuture.get());
if (testSessions) {
testSessionsReading(serverContextName, clientContextName, expectedServerPrincipal, expectedClientPrincipal);
}
if (expectedCipherSuite != null) {
Assert.assertEquals(expectedCipherSuite, serverSocket.getSession().getCipherSuite());
Assert.assertEquals(expectedCipherSuite, clientSocket.getSession().getCipherSuite());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,7 @@ public void testJDK9Params() {
element.getJvmOptions().addOption("--illegal-access=warn");
List<String> command = new ArrayList<String>();
FACTORY.addOptions(element, command);
if (JvmElement.getJVMMajorVersion() < 9) {
Assert.assertEquals(0, command.size());
} else {
Assert.assertEquals(4, command.size());
}
Assert.assertEquals(4, command.size());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ private RuntimeResourceDefinition() {
@Override
public void registerAttributes(ManagementResourceRegistration registration) {
super.registerAttributes(registration);
if (PlatformMBeanUtil.JVM_MAJOR_VERSION > 6) {
registration.registerReadOnlyAttribute(PlatformMBeanConstants.OBJECT_NAME, RuntimeMXBeanAttributeHandler.INSTANCE);
}
registration.registerReadOnlyAttribute(PlatformMBeanConstants.OBJECT_NAME, RuntimeMXBeanAttributeHandler.INSTANCE);

for (AttributeDefinition attribute : READ_ATTRIBUTES) {
registration.registerReadOnlyAttribute(attribute, RuntimeMXBeanAttributeHandler.INSTANCE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,24 +150,6 @@ public void testRootResource() throws IOException {
Assert.assertTrue(result.isDefined());
}

@Test
public void testBufferPoolMXBean() throws IOException {
if (PlatformMBeanUtil.JVM_MAJOR_VERSION < 7) {
ModelNode op = getOperation(READ_RESOURCE_DESCRIPTION_OPERATION, "buffer-pool", null);
executeOp(op, true);
op = getOperation(READ_RESOURCE_OPERATION, "buffer-pool", null);
executeOp(op, true);
return;
}

// TODO (jrp) - This test is broken.
// Notes from IRC.
// it's reading the parent BufferPoolMXBean resource (which is empty except for children for each of the named BufferPoolMXBean)
// it should be reading one of the children
// DescribedResource describedResource = basicResourceTest("buffer-pool", null);
// TODO validate values
}

@Test
public void testClassLoadingMXBean() throws IOException {
DescribedResource describedResource = basicResourceTest("class-loading", null);
Expand Down

0 comments on commit d78b331

Please sign in to comment.