This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 56b0306  CAMEL-13542: Added unit test
56b0306 is described below

commit 56b030607a3fe7861bac987483c82a00af718735
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu May 16 10:19:11 2019 +0200

    CAMEL-13542: Added unit test
---
 .../org/apache/camel/catalog/CamelCatalogTest.java | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git 
a/catalog/camel-catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
 
b/catalog/camel-catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
index b4aa547..1a84811 100644
--- 
a/catalog/camel-catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
+++ 
b/catalog/camel-catalog/src/test/java/org/apache/camel/catalog/CamelCatalogTest.java
@@ -316,6 +316,25 @@ public class CamelCatalogTest {
     }
 
     @Test
+    public void testAsEndpointUriNettyHttpHostnameWithDash() throws Exception {
+        Map<String, String> map = new LinkedHashMap<>();
+        map.put("protocol", "http");
+        map.put("host", "a-b-c.hostname.tld");
+        map.put("port", "8080");
+        map.put("path", "anything");
+        String uri = catalog.asEndpointUri("netty4-http", map, false);
+        assertEquals("netty4-http:http:a-b-c.hostname.tld:8080/anything", uri);
+
+        map = new LinkedHashMap<>();
+        map.put("protocol", "http");
+        map.put("host", "a-b-c.server.net");
+        map.put("port", "8888");
+        map.put("path", "service/v3");
+        uri = catalog.asEndpointUri("netty4-http", map, true);
+        assertEquals("netty4-http:http:a-b-c.server.net:8888/service/v3", uri);
+    }
+
+    @Test
     public void testEndpointProperties() throws Exception {
         Map<String, String> map = 
catalog.endpointProperties("ftp:someserver:21/foo?connectTimeout=5000");
         assertNotNull(map);
@@ -1192,6 +1211,12 @@ public class CamelCatalogTest {
 
         String resolved = catalog.asEndpointUri("netty4-http", params, false);
         assertEquals("netty4-http:http:10.192.1.10:8080", resolved);
+
+        // another example with dash in hostname
+        uri = "netty4-http:http://a-b-c.hostname.tld:8080/anything";;
+        params = catalog.endpointProperties(uri);
+        resolved = catalog.asEndpointUri("netty4-http", params, false);
+        assertEquals("netty4-http:http:a-b-c.hostname.tld:8080/anything", 
resolved);
     }
 
     @Test

Reply via email to