forked from Azure/azure-sdk-for-java
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed servicebus default proxy configuration bug (Azure#31832)
* Fixing servicebus default proxy configuration bug * Updating changelog and tests
- Loading branch information
Showing
3 changed files
with
21 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -234,26 +234,20 @@ void invalidPrefetch() { | |
|
||
@MethodSource("getProxyConfigurations") | ||
@ParameterizedTest | ||
public void testProxyOptionsConfiguration(String proxyConfiguration, boolean expectedClientCreation) { | ||
public void testProxyOptionsConfiguration(String proxyConfiguration) { | ||
Configuration configuration = TestUtils.getGlobalConfiguration().clone(); | ||
configuration | ||
.put(Configuration.PROPERTY_HTTP_PROXY, proxyConfiguration) | ||
.put(JAVA_NET_USER_SYSTEM_PROXIES, "true"); | ||
boolean clientCreated = false; | ||
try { | ||
ServiceBusReceiverClient syncClient = new ServiceBusClientBuilder() | ||
.connectionString(NAMESPACE_CONNECTION_STRING) | ||
.configuration(configuration) | ||
.receiver() | ||
.topicName("baz").subscriptionName("bar") | ||
.receiveMode(ServiceBusReceiveMode.PEEK_LOCK) | ||
.buildClient(); | ||
|
||
clientCreated = true; | ||
} catch (Exception ex) { | ||
} | ||
|
||
Assertions.assertEquals(expectedClientCreation, clientCreated); | ||
// Client creation should not fail with incorrect proxy configuration | ||
ServiceBusReceiverClient syncClient = new ServiceBusClientBuilder() | ||
.connectionString(NAMESPACE_CONNECTION_STRING) | ||
.configuration(configuration) | ||
.receiver() | ||
.topicName("baz").subscriptionName("bar") | ||
.receiveMode(ServiceBusReceiveMode.PEEK_LOCK) | ||
.buildClient(); | ||
} | ||
|
||
@Test | ||
|
@@ -386,16 +380,16 @@ public void testConnectionWithAzureSasCredential() { | |
|
||
private static Stream<Arguments> getProxyConfigurations() { | ||
return Stream.of( | ||
Arguments.of("http://localhost:8080", true), | ||
Arguments.of("localhost:8080", true), | ||
Arguments.of("localhost_8080", false), | ||
Arguments.of("http://example.com:8080", true), | ||
Arguments.of("http://sub.example.com:8080", true), | ||
Arguments.of(":8080", false), | ||
Arguments.of("http://localhost", true), | ||
Arguments.of("sub.example.com:8080", true), | ||
Arguments.of("https://username:[email protected]:8080", true), | ||
Arguments.of("https://username:[email protected]", true) | ||
Arguments.of("http://localhost:8080"), | ||
Arguments.of("localhost:8080"), | ||
Arguments.of("localhost_8080"), | ||
Arguments.of("http://example.com:8080"), | ||
Arguments.of("http://sub.example.com:8080"), | ||
Arguments.of(":8080"), | ||
Arguments.of("http://localhost"), | ||
Arguments.of("sub.example.com:8080"), | ||
Arguments.of("https://username:[email protected]:8080"), | ||
Arguments.of("https://username:[email protected]") | ||
); | ||
|
||
} | ||
|