forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixes quarkusio#18250 - Remove UserInfo portion of HTTP URL, if present (cherry picked from commit b4b7f84)
- Loading branch information
1 parent
aee7a90
commit 1f71024
Showing
2 changed files
with
93 additions
and
1 deletion.
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
83 changes: 83 additions & 0 deletions
83
.../src/test/java/io/quarkus/opentelemetry/runtime/tracing/restclient/HttpUrlFilterTest.java
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 |
---|---|---|
@@ -0,0 +1,83 @@ | ||
package io.quarkus.opentelemetry.runtime.tracing.restclient; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class HttpUrlFilterTest { | ||
@Test | ||
void testUrl() { | ||
ClientTracingFilter filter = new ClientTracingFilter(null); | ||
|
||
String url = "https://quarkus.io"; | ||
String result = filter.filterUserInfo(url); | ||
|
||
Assertions.assertNotNull(result); | ||
Assertions.assertEquals(url, result); | ||
} | ||
|
||
@Test | ||
void testUrlWithPort() { | ||
ClientTracingFilter filter = new ClientTracingFilter(null); | ||
|
||
String url = "https://quarkus.io:9091"; | ||
String result = filter.filterUserInfo(url); | ||
|
||
Assertions.assertNotNull(result); | ||
Assertions.assertEquals(url, result); | ||
} | ||
|
||
@Test | ||
void testUrlWithPath() { | ||
ClientTracingFilter filter = new ClientTracingFilter(null); | ||
|
||
String url = "https://quarkus.io/guides/"; | ||
String result = filter.filterUserInfo(url); | ||
|
||
Assertions.assertNotNull(result); | ||
Assertions.assertEquals(url, result); | ||
} | ||
|
||
@Test | ||
void testUserWithEmptyPassword() { | ||
ClientTracingFilter filter = new ClientTracingFilter(null); | ||
|
||
String url = "https://username:@quarkus.io"; | ||
String result = filter.filterUserInfo(url); | ||
|
||
Assertions.assertNotNull(result); | ||
Assertions.assertEquals("https://quarkus.io", result); | ||
} | ||
|
||
@Test | ||
void testUserWithEmptyPasswordAndPort() { | ||
ClientTracingFilter filter = new ClientTracingFilter(null); | ||
|
||
String url = "https://username:@quarkus.io:9212"; | ||
String result = filter.filterUserInfo(url); | ||
|
||
Assertions.assertNotNull(result); | ||
Assertions.assertEquals("https://quarkus.io:9212", result); | ||
} | ||
|
||
@Test | ||
void testUserWithPassword() { | ||
ClientTracingFilter filter = new ClientTracingFilter(null); | ||
|
||
String url = "https://username:[email protected]"; | ||
String result = filter.filterUserInfo(url); | ||
|
||
Assertions.assertNotNull(result); | ||
Assertions.assertEquals("https://quarkus.io", result); | ||
} | ||
|
||
@Test | ||
void testUserWithPasswordAndPort() { | ||
ClientTracingFilter filter = new ClientTracingFilter(null); | ||
|
||
String url = "https://username:[email protected]:9000"; | ||
String result = filter.filterUserInfo(url); | ||
|
||
Assertions.assertNotNull(result); | ||
Assertions.assertEquals("https://quarkus.io:9000", result); | ||
} | ||
} |