This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new fc1c1a3 Add test cases with # in the parameters for URLTest (#7767)
fc1c1a3 is described below
commit fc1c1a3ee2088f232fce16aeec6e6a88db684254
Author: xiaoheng1 <[email protected]>
AuthorDate: Sat May 15 20:32:43 2021 +0800
Add test cases with # in the parameters for URLTest (#7767)
---
.../test/java/org/apache/dubbo/common/URLTest.java | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/URLTest.java
b/dubbo-common/src/test/java/org/apache/dubbo/common/URLTest.java
index 86ebb91..57bf319 100644
--- a/dubbo-common/src/test/java/org/apache/dubbo/common/URLTest.java
+++ b/dubbo-common/src/test/java/org/apache/dubbo/common/URLTest.java
@@ -678,7 +678,9 @@ public class URLTest {
@Test
public void test_windowAbsolutePathBeginWithSlashIsValid() throws
Exception {
final String osProperty =
System.getProperties().getProperty("os.name");
- if (!osProperty.toLowerCase().contains("windows")) return;
+ if (!osProperty.toLowerCase().contains("windows")) {
+ return;
+ }
System.out.println("Test Windows valid path string.");
@@ -697,7 +699,8 @@ public class URLTest {
@Test
public void test_javaNetUrl() throws Exception {
- java.net.URL url = new
java.net.URL("http://admin:[email protected]:20880/context/path?version=1.0.0&application=morgan#anchor1");
+ java.net.URL url =
+ new
java.net.URL("http://admin:[email protected]:20880/context/path?version=1.0.0&application=morgan#anchor1");
assertEquals("http", url.getProtocol());
assertEquals("admin:hello1234", url.getUserInfo());
@@ -779,7 +782,8 @@ public class URLTest {
@Test
public void testIpV6Address() {
// Test username or password contains "@"
- URL url =
URL.valueOf("ad@min111:haha@1234@2001:0db8:85a3:08d3:1319:8a2e:0370:7344:20880/context/path?version=1.0.0&application=morgan");
+ URL url = URL.valueOf(
+
"ad@min111:haha@1234@2001:0db8:85a3:08d3:1319:8a2e:0370:7344:20880/context/path?version=1.0.0&application=morgan");
assertURLStrDecoder(url);
assertNull(url.getProtocol());
assertEquals("ad@min111", url.getUsername());
@@ -823,7 +827,8 @@ public class URLTest {
assertURLStrDecoder(url2);
Assertions.assertEquals("org.apache.dubbo.test.interfaceName",
url2.getServiceKey());
- URL url3 =
URL.valueOf("10.20.130.230:20880/org.apache.dubbo.test.interfaceName?interface=org.apache.dubbo.test.interfaceName&group=group1&version=1.0.0");
+ URL url3 = URL.valueOf(
+
"10.20.130.230:20880/org.apache.dubbo.test.interfaceName?interface=org.apache.dubbo.test.interfaceName&group=group1&version=1.0.0");
assertURLStrDecoder(url3);
Assertions.assertEquals("group1/org.apache.dubbo.test.interfaceName:1.0.0",
url3.getServiceKey());
@@ -1001,4 +1006,12 @@ public class URLTest {
assertFalse(actual1);
assertTrue(actual2);
}
+
+ @Test
+ public void testParameterContainPound() {
+ URL url = URL.valueOf(
+
"dubbo://ad@min:hello@[email protected]:20880/context/path?version=1.0.0&application=morgan£=abcd#efg&protocol=registry");
+ Assertions.assertEquals("abcd#efg", url.getParameter("pound"));
+ Assertions.assertEquals("registry", url.getParameter("protocol"));
+ }
}