Skip to content

Commit 3759efe

Browse files
committed
test end-to-end with/without ssl rmi registry
1 parent e2fd2f2 commit 3759efe

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

jmx-scraper/src/integrationTest/java/io/opentelemetry/contrib/jmxscraper/JmxConnectionTest.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ void userPassword() {
7777

7878
@Test
7979
void serverSsl(@TempDir Path tempDir) {
80+
testServerSsl(tempDir, /* sslRmiRegistry= */ false);
81+
}
82+
83+
@Test
84+
void serverSslWithSslRmiRegistry(@TempDir Path tempDir) {
85+
testServerSsl(tempDir, /* sslRmiRegistry= */ true);
86+
}
87+
88+
private static void testServerSsl(Path tempDir, boolean sslRmiRegistry) {
8089
// two keystores:
8190
// server keystore with public/private key pair
8291
// client trust store with certificate from server
@@ -93,11 +102,15 @@ void serverSsl(@TempDir Path tempDir) {
93102
addTrustedCertificate(clientKeystore, clientPassword, serverCertificate);
94103

95104
connectionTest(
96-
app -> app.withJmxPort(JMX_PORT).withJmxSsl().withKeyStore(serverKeystore, serverPassword),
105+
app -> (sslRmiRegistry ? app.withSslRmiRegistry(4242) : app)
106+
.withJmxPort(JMX_PORT)
107+
.withJmxSsl()
108+
.withKeyStore(serverKeystore, serverPassword),
97109
scraper ->
98-
scraper
110+
(sslRmiRegistry ? scraper.withSslRmiRegistry() : scraper)
99111
.withRmiServiceUrl(APP_HOST, JMX_PORT)
100-
.withTrustStore(clientKeystore, clientPassword));
112+
.withTrustStore(clientKeystore, clientPassword)
113+
);
101114
}
102115

103116
private static void connectionTest(

0 commit comments

Comments
 (0)