Skip to content

Commit

Permalink
[build] Ensure all tests pass on IBM JDK (11 and 17)
Browse files Browse the repository at this point in the history
Signed-off-by: Grzegorz Grzybek <gr.grzybek@gmail.com>
  • Loading branch information
grgrzybek committed Mar 7, 2024
1 parent 82d96c0 commit 6d9006a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,18 @@ private void checkServer(JvmAgentConfig pConfig, boolean pDoRequest,
ks.load(fis, "1234".toCharArray());
KeyManagerFactory kmf;
if ("IBM Corporation".equals(System.getProperty("java.vendor"))) {
kmf = KeyManagerFactory.getInstance("IBMX509");
// Using IBM Semeru Runtime Open Edition 11.0.22.0 (build 11.0.22+7):
// see https://www.ibm.com/support/pages/semeru-runtimes-security-migration-guide
// - KeyManagerFactory
// - NewSunX509 : sun.security.ssl.KeyManagerFactoryImpl$X509
// aliases: [PKIX]
// - SunX509 : sun.security.ssl.KeyManagerFactoryImpl$SunX509
String runtimeName = System.getProperty("java.runtime.name");
if (runtimeName != null && runtimeName.toLowerCase().contains("semeru")) {
kmf = KeyManagerFactory.getInstance("SunX509");
} else {
kmf = KeyManagerFactory.getInstance("IBMX509");
}
} else {
kmf = KeyManagerFactory.getInstance("SunX509");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,12 @@ public class JmxBridgeTest {
"java.lang:type=GarbageCollector,name=global.LastGcInfo",
"java.lang:type=OperatingSystem.ProcessCpuTimeByNS",
"java.lang:type=OperatingSystem.ProcessPhysicalMemorySize",
"java.lang:type=OperatingSystem.ProcessPrivateMemorySize",
"java.lang:type=OperatingSystem.ProcessVirtualMemorySize",
"java.lang:type=Memory.GCMasterThreadCpuUsed",
"java.lang:type=OperatingSystem.SystemLoadAverage",
"java.lang:type=OperatingSystem.OpenFileDescriptorCount");
"java.lang:type=OperatingSystem.OpenFileDescriptorCount",
"java.lang:type=MemoryPool,name=JIT code cache.Usage");

//Attributes that give runtime exception on some JVM versions and therefore not suitable for brute force tests
private static final Collection<String> UNSAFE_ATTRIBUTES = Set.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,14 @@ public void maxDepthAndPath() throws Exception {
assertTrue(ops.get("gc") instanceof Map);
@SuppressWarnings("unchecked")
Map<String, ?> attrs = (Map<String, ?>) res.get(ATTRIBUTES.getKey());
// Java 7 introduces a new attribute 'ObjectName' here
assertEquals(attrs.size(),attrs.containsKey("ObjectName") ? 5 : 4);
String vendor = System.getProperty("java.vendor");
if (vendor != null && vendor.toUpperCase().contains("IBM")) {
// let's be flexible here... number differs between 11 and 17
assertTrue(attrs.size() > 20);
} else {
// Java 7 introduces a new attribute 'ObjectName' here
assertEquals(attrs.size(), attrs.containsKey("ObjectName") ? 5 : 4);
}
assertTrue(attrs.get("HeapMemoryUsage") instanceof Map);
assertTrue(res.get(DESCRIPTION.getKey()) instanceof String);

Expand Down

0 comments on commit 6d9006a

Please sign in to comment.