Skip to content

Commit 4662ee7

Browse files
committed
Fixed config property and test
1 parent f62acd9 commit 4662ee7

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

client/src/main/java/io/split/client/SplitClientConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ public String proxyPassword() {
314314
return _proxyPassword;
315315
}
316316

317-
public ProxyRuntimeProvider proxyRuntimeStorage() {
317+
public ProxyRuntimeProvider proxyRuntimeProvider() {
318318
return _proxyRuntimeProvider;
319319
}
320320

@@ -816,7 +816,7 @@ public Builder proxyPassword(String proxyPassword) {
816816
* @param proxyRuntimeProvider
817817
* @return this builder
818818
*/
819-
public Builder proxyRuntimeStorage(ProxyRuntimeProvider proxyRuntimeProvider) {
819+
public Builder proxyRuntimeProvider(ProxyRuntimeProvider proxyRuntimeProvider) {
820820
_proxyRuntimeProvider = proxyRuntimeProvider;
821821
return this;
822822
}

client/src/main/java/io/split/client/SplitFactoryImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,9 +634,9 @@ private static HttpClientBuilder setupProxy(HttpClientBuilder httpClientbuilder,
634634
httpClientbuilder.setDefaultCredentialsProvider(credsProvider);
635635
}
636636

637-
if (config.proxyRuntimeStorage() != null) {
637+
if (config.proxyRuntimeProvider() != null) {
638638
_log.debug("Proxy setup using token");
639-
httpClientbuilder.setDefaultCredentialsProvider(new HttpClientDynamicCredentials(config.proxyRuntimeStorage()));
639+
httpClientbuilder.setDefaultCredentialsProvider(new HttpClientDynamicCredentials(config.proxyRuntimeProvider()));
640640
}
641641

642642
return httpClientbuilder;

client/src/test/java/io/split/client/SplitClientConfigTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,9 @@ public String getJwtToken() {
283283
config = SplitClientConfig.builder()
284284
.proxyHost("proxy-host")
285285
.proxyPort(8888)
286-
.proxyRuntimeStorage(proxyRuntimeProvider)
286+
.proxyRuntimeProvider(proxyRuntimeProvider)
287287
.build();
288-
Assert.assertEquals(proxyRuntimeProvider, config.proxyRuntimeStorage());
288+
Assert.assertEquals(proxyRuntimeProvider, config.proxyRuntimeProvider());
289289

290290
config = SplitClientConfig.builder()
291291
.proxyHost("proxy-host")
@@ -319,7 +319,7 @@ public String getJwtToken() {
319319
.proxyPort(8888)
320320
.proxyUsername("user")
321321
.proxyPassword("pass")
322-
.proxyRuntimeStorage(proxyRuntimeProvider)
322+
.proxyRuntimeProvider(proxyRuntimeProvider)
323323
.build();
324324
}
325325

@@ -346,7 +346,7 @@ public String getJwtToken() {
346346
SplitClientConfig.builder()
347347
.proxyHost("proxy-host")
348348
.proxyPort(8888)
349-
.proxyRuntimeStorage(proxyRuntimeProvider)
349+
.proxyRuntimeProvider(proxyRuntimeProvider)
350350
.proxyMtlsAuth(new ProxyMTLSAuth.Builder().proxyP12File("path/to/file").proxyP12FilePassKey("pass-key").build())
351351
.build();
352352
}

client/src/test/java/io/split/client/SplitFactoryImplTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,10 @@ public void testFactoryInstantiationWithProxyCredentials() throws Exception {
151151

152152
splitFactory.destroy();
153153
}
154-
/*
154+
155155
@Test
156156
public void testFactoryInstantiationWithProxyToken() throws Exception {
157-
class MyProxyRuntimeStorage implements ProxyRuntimeStorage {
157+
class MyProxyRuntimeProvider implements ProxyRuntimeProvider {
158158
@Override
159159
public String getJwtToken() {
160160
return "123456789";
@@ -170,7 +170,7 @@ public String getJwtToken() {
170170
.authServiceURL(AUTH_SERVICE)
171171
.setBlockUntilReadyTimeout(1000)
172172
.proxyPort(6060)
173-
.proxyRuntimeStorage(new MyProxyRuntimeStorage())
173+
.proxyRuntimeProvider(new MyProxyRuntimeProvider())
174174
.proxyHost(ENDPOINT)
175175
.build();
176176
SplitFactoryImpl splitFactory2 = new SplitFactoryImpl(API_KEY, splitClientConfig);
@@ -187,17 +187,17 @@ public String getJwtToken() {
187187

188188
Field credentialsProviderField2 = InternalHttp2.getDeclaredField("credentialsProvider");
189189
credentialsProviderField2.setAccessible(true);
190-
BasicCredentialsProvider credentialsProvider2 = (BasicCredentialsProvider) credentialsProviderField2.get(InternalHttp2.cast(httpClientField2.get(client2)));
190+
HttpClientDynamicCredentials credentialsProvider2 = (HttpClientDynamicCredentials) credentialsProviderField2.get(InternalHttp2.cast(httpClientField2.get(client2)));
191191

192-
Field credMapField2 = BasicCredentialsProvider.class.getDeclaredField("credMap");
193-
credMapField2.setAccessible(true);
194-
ConcurrentHashMap<AuthScope, BearerToken> credMap2 = (ConcurrentHashMap) credMapField2.get(credentialsProvider2);
192+
Field proxyRuntimeField = HttpClientDynamicCredentials.class.getDeclaredField("_proxyRuntimeProvider");
193+
proxyRuntimeField.setAccessible(true);
194+
MyProxyRuntimeProvider proxyRuntime = (MyProxyRuntimeProvider) proxyRuntimeField.get(credentialsProvider2);
195195

196-
Assert.assertEquals("123456789", credMap2.entrySet().stream().iterator().next().getValue().getToken());
196+
assertNotNull("123456789", proxyRuntime.getJwtToken());
197197

198198
splitFactory2.destroy();
199199
}
200-
*/
200+
201201
@Test
202202
public void testFactoryInstantiationWithProxyMtls() throws Exception {
203203
SplitClientConfig splitClientConfig = SplitClientConfig.builder()

0 commit comments

Comments
 (0)