Skip to content

Commit 8c5c516

Browse files
committed
add some javadoc
1 parent d11f5a8 commit 8c5c516

File tree

2 files changed

+80
-1
lines changed

2 files changed

+80
-1
lines changed

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

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,38 @@ public JmxScraperContainer(String otlpEndpoint, String baseImage) {
5252
this.extraJars = new ArrayList<>();
5353
}
5454

55+
/**
56+
* Adds a target system
57+
*
58+
* @param targetSystem target system
59+
* @return this
60+
*/
5561
@CanIgnoreReturnValue
5662
public JmxScraperContainer withTargetSystem(String targetSystem) {
5763
targetSystems.add(targetSystem);
5864
return this;
5965
}
6066

67+
/**
68+
* Set connection to a standard JMX service URL
69+
*
70+
* @param host JMX host
71+
* @param port JMX port
72+
* @return this
73+
*/
6174
@CanIgnoreReturnValue
6275
public JmxScraperContainer withRmiServiceUrl(String host, int port) {
63-
// TODO: adding a way to provide 'host:port' syntax would make this easier for end users
6476
return withServiceUrl(
6577
String.format(
6678
Locale.getDefault(), "service:jmx:rmi:///jndi/rmi://%s:%d/jmxrmi", host, port));
6779
}
6880

81+
/**
82+
* Set connection to a JMX service URL
83+
*
84+
* @param serviceUrl service URL
85+
* @return this
86+
*/
6987
@CanIgnoreReturnValue
7088
public JmxScraperContainer withServiceUrl(String serviceUrl) {
7189
this.serviceUrl = serviceUrl;
@@ -114,26 +132,50 @@ public JmxScraperContainer withCustomYaml(String yamlPath) {
114132
return this;
115133
}
116134

135+
/**
136+
* Configure the scraper JVM to only test connection with the JMX endpoint
137+
*
138+
* @return this
139+
*/
117140
@CanIgnoreReturnValue
118141
public JmxScraperContainer withTestJmx() {
119142
this.testJmx = true;
120143
return this;
121144
}
122145

146+
/**
147+
* Configure key store for the scraper JVM
148+
*
149+
* @param keyStore path to key store
150+
* @param password key store password
151+
* @return this
152+
*/
123153
@CanIgnoreReturnValue
124154
public JmxScraperContainer withKeyStore(Path keyStore, String password) {
125155
this.keyStore = keyStore;
126156
this.keyStorePassword = password;
127157
return this;
128158
}
129159

160+
/**
161+
* Configure trust store for the scraper JVM
162+
*
163+
* @param trustStore path to trust store
164+
* @param password trust store password
165+
* @return this
166+
*/
130167
@CanIgnoreReturnValue
131168
public JmxScraperContainer withTrustStore(Path trustStore, String password) {
132169
this.trustStore = trustStore;
133170
this.trustStorePassword = password;
134171
return this;
135172
}
136173

174+
/**
175+
* Enables connection to an SSL-protected RMI registry
176+
*
177+
* @return this
178+
*/
137179
@CanIgnoreReturnValue
138180
public JmxScraperContainer withSslRmiRegistry() {
139181
this.sslRmiRegistry = true;

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

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,39 +63,76 @@ public TestAppContainer withJmxPort(int port) {
6363
return this;
6464
}
6565

66+
/**
67+
* Enables and configure JMX login/pwd authentication
68+
*
69+
* @param login user login
70+
* @param pwd user password
71+
* @return this
72+
*/
6673
@CanIgnoreReturnValue
6774
public TestAppContainer withUserAuth(String login, String pwd) {
6875
this.login = login;
6976
this.pwd = pwd;
7077
return this;
7178
}
7279

80+
/**
81+
* Enables SSL for JMX endpoint, will require JMX client to trust remote JVM certificate
82+
*
83+
* @return this
84+
*/
7385
@CanIgnoreReturnValue
7486
public TestAppContainer withJmxSsl() {
7587
this.jmxSsl = true;
7688
return this;
7789
}
7890

91+
/**
92+
* Enables SSL-protected RMI registry, which requires a distinct port from JMX
93+
*
94+
* @param registryPort registry port
95+
* @return this
96+
*/
7997
@CanIgnoreReturnValue
8098
public TestAppContainer withSslRmiRegistry(int registryPort) {
8199
this.jmxSslRegistry = true;
82100
this.jmxRmiPort = registryPort;
83101
return this;
84102
}
85103

104+
/**
105+
* Enables client certificate verification by the remote JVM
106+
*
107+
* @return this
108+
*/
86109
@CanIgnoreReturnValue
87110
public TestAppContainer withClientSslCertificate() {
88111
this.clientCertificate = true;
89112
return this;
90113
}
91114

115+
/**
116+
* Configure key store for the remote JVM
117+
*
118+
* @param keyStore path to key store
119+
* @param password key store password
120+
* @return this
121+
*/
92122
@CanIgnoreReturnValue
93123
public TestAppContainer withKeyStore(Path keyStore, String password) {
94124
this.keyStore = keyStore;
95125
this.keyStorePassword = password;
96126
return this;
97127
}
98128

129+
/**
130+
* Configure trust store for the remote JVM
131+
*
132+
* @param trustStore path to trust store
133+
* @param password trust store password
134+
* @return this
135+
*/
99136
@CanIgnoreReturnValue
100137
public TestAppContainer withTrustStore(Path trustStore, String password) {
101138
this.trustStore = trustStore;

0 commit comments

Comments
 (0)