|
17 | 17 | package org.apache.dubbo.common;
|
18 | 18 |
|
19 | 19 | import org.apache.dubbo.common.utils.CollectionUtils;
|
20 |
| - |
21 | 20 | import org.apache.dubbo.common.utils.StringUtils;
|
| 21 | + |
22 | 22 | import org.junit.jupiter.api.Assertions;
|
23 | 23 | import org.junit.jupiter.api.Test;
|
24 | 24 |
|
|
33 | 33 | import static org.hamcrest.CoreMatchers.equalTo;
|
34 | 34 | import static org.hamcrest.MatcherAssert.assertThat;
|
35 | 35 | import static org.junit.jupiter.api.Assertions.assertEquals;
|
| 36 | +import static org.junit.jupiter.api.Assertions.assertFalse; |
36 | 37 | import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
37 | 38 | import static org.junit.jupiter.api.Assertions.assertNull;
|
38 | 39 | import static org.junit.jupiter.api.Assertions.assertSame;
|
39 | 40 | import static org.junit.jupiter.api.Assertions.assertTrue;
|
40 |
| -import static org.junit.jupiter.api.Assertions.assertFalse; |
41 | 41 | import static org.junit.jupiter.api.Assertions.fail;
|
42 | 42 |
|
43 | 43 | public class URLTest {
|
@@ -339,6 +339,34 @@ public void test_valueOf_Exception_noProtocol() throws Exception {
|
339 | 339 | }
|
340 | 340 | }
|
341 | 341 |
|
| 342 | + @Test |
| 343 | + public void test_ignore_pond() { |
| 344 | + URL url = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path#index?version=1.0.0&id=org.apache.dubbo.config.RegistryConfig#0"); |
| 345 | + URL urlFromDecoder = URLStrParser.parseDecodedStr("dubbo://admin:hello1234@10.20.130.230:20880/context/path#index?version=1.0.0&id=org.apache.dubbo.config.RegistryConfig#0"); |
| 346 | + |
| 347 | + assertURLStrDecoder(url); |
| 348 | + |
| 349 | + assertEquals("dubbo", url.getProtocol()); |
| 350 | + assertEquals("admin", url.getUsername()); |
| 351 | + assertEquals("hello1234", url.getPassword()); |
| 352 | + assertEquals("10.20.130.230", url.getHost()); |
| 353 | + assertEquals("10.20.130.230:20880", url.getAddress()); |
| 354 | + assertEquals(20880, url.getPort()); |
| 355 | + assertEquals("context/path", url.getPath()); |
| 356 | + assertEquals(2, url.getParameters().size()); |
| 357 | + assertEquals("org.apache.dubbo.config.RegistryConfig#0", url.getParameter("id")); |
| 358 | + |
| 359 | + assertEquals("dubbo", urlFromDecoder.getProtocol()); |
| 360 | + assertEquals("admin", urlFromDecoder.getUsername()); |
| 361 | + assertEquals("hello1234", urlFromDecoder.getPassword()); |
| 362 | + assertEquals("10.20.130.230", urlFromDecoder.getHost()); |
| 363 | + assertEquals("10.20.130.230:20880", urlFromDecoder.getAddress()); |
| 364 | + assertEquals(20880, urlFromDecoder.getPort()); |
| 365 | + assertEquals("context/path", urlFromDecoder.getPath()); |
| 366 | + assertEquals(2, urlFromDecoder.getParameters().size()); |
| 367 | + assertEquals("org.apache.dubbo.config.RegistryConfig#0", urlFromDecoder.getParameter("id")); |
| 368 | + } |
| 369 | + |
342 | 370 | @Test
|
343 | 371 | public void test_getAddress() throws Exception {
|
344 | 372 | URL url1 = URL.valueOf("dubbo://admin:hello1234@10.20.130.230:20880/context/path?version=1.0.0&application=morgan");
|
|
0 commit comments