Skip to content

Commit 5ff301e

Browse files
minor comments and cleaning
1 parent 9d25674 commit 5ff301e

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

substratevm/src/com.oracle.svm.test/src/com/oracle/svm/test/jmx/JmxTest.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public class JmxTest {
8181
static final String TRUSTSTORE_PROPERTY = "javax.net.ssl.trustStore";
8282
static final String TRUSTSTORE_PASSWORD_PROPERTY = "javax.net.ssl.trustStorePassword";
8383
static final String REGISTRY_SSL_PROPERTY = "com.sun.management.jmxremote.registry.ssl";
84+
static final String SOCKET_FACTORY_PROPERTY = "com.sun.jndi.rmi.factory.socket";
8485
static final String TEST_PORT = "12345";
8586
static final String TRUE = "true";
8687
static final String JMX_REMOTE_RESOURCES = "src/com.oracle.svm.test/src/com/oracle/svm/test/jmx/jmxremoteresources";
@@ -96,10 +97,16 @@ public static void checkForJFR() throws IOException {
9697
System.setProperty(CLIENT_AUTH_PROPERTY, TRUE);
9798
System.setProperty(SSL_PROPERTY, TRUE);
9899
System.setProperty(REGISTRY_SSL_PROPERTY, TRUE);
99-
// The following are dummy password access, and SSL files required for testing
100-
// authentication and SSL.
100+
101+
// The following are dummy password and access files required for testing authentication.
101102
System.setProperty(ACCESS_PROPERTY, JMX_REMOTE_RESOURCES + "/jmxremote.access");
102103
System.setProperty(PASSWORD_PROPERTY, JMX_REMOTE_RESOURCES + "/jmxremote.password");
104+
105+
/*
106+
* The following are dummy SSL keystore and truststore files required for testing connection
107+
* using SSL. The clientkeystore was used to create a client certificate
108+
* (jmxremoteresources/client.cer) which was then imported into the servertruststore.
109+
*/
103110
System.setProperty(KEYSTORE_PROPERTY, JMX_REMOTE_RESOURCES + "/clientkeystore");
104111
System.setProperty(KEYSTORE_PASSWORD_PROPERTY, "clientpass");
105112
System.setProperty(TRUSTSTORE_PROPERTY, JMX_REMOTE_RESOURCES + "/servertruststore");
@@ -128,7 +135,7 @@ private static MBeanServerConnection getLocalMBeanServerConnectionStatic() {
128135
String[] credentials = {"myrole", "MYP@SSWORD"}; // dummy password for testing
129136
env.put(JMXConnector.CREDENTIALS, credentials);
130137
// Include below if protecting registry with SSL
131-
env.put("com.sun.jndi.rmi.factory.socket", new SslRMIClientSocketFactory());
138+
env.put(SOCKET_FACTORY_PROPERTY, new SslRMIClientSocketFactory());
132139
JMXConnector connector = JMXConnectorFactory.connect(jmxUrl, env);
133140
return connector.getMBeanServerConnection();
134141
} catch (IOException e) {

0 commit comments

Comments
 (0)