TUCJVXCB commented on code in PR #11638:
URL: https://github.com/apache/camel/pull/11638#discussion_r1360775906


##########
core/camel-support/src/test/java/org/apache/camel/support/RestConsumerContextPathMatcherTest.java:
##########
@@ -83,19 +83,38 @@ public void testRestConsumerContextPathMatcherSuccess() {
     @Test
     public void testRestConsumerContextPathMatcherWithWildcard() {
         List<RestConsumerContextPathMatcher.ConsumerPath<MockConsumerPath>> 
consumerPaths = new ArrayList<>();
-        consumerPaths.add(new MockConsumerPath("GET", "/camel/*"));
+        consumerPaths.add(new MockConsumerPath("GET", "/camel/myapp/info"));
+        consumerPaths.add(new MockConsumerPath("GET", "/camel/myapp/{id}"));
+        consumerPaths.add(new MockConsumerPath("GET", "/camel/myapp/order/*"));
 
         RestConsumerContextPathMatcher.ConsumerPath<?> path1 = 
RestConsumerContextPathMatcher.matchBestPath("GET",
-                "/camel", consumerPaths);
+                "/camel/myapp/info", consumerPaths);
 
         RestConsumerContextPathMatcher.ConsumerPath<?> path2 = 
RestConsumerContextPathMatcher.matchBestPath("GET",
-                "/camel/foo", consumerPaths);
+                "/camel/myapp/1", consumerPaths);
 
         RestConsumerContextPathMatcher.ConsumerPath<?> path3 = 
RestConsumerContextPathMatcher.matchBestPath("GET",
+                "/camel/myapp/order/foo", consumerPaths);
+
+        assertEquals(path1.getConsumerPath(), "/camel/myapp/info");
+        assertEquals(path2.getConsumerPath(), "/camel/myapp/{id}");
+        assertEquals(path3.getConsumerPath(), "/camel/myapp/order/*");
+    }
+
+    @Test
+    public void testRestConsumerContextPathMatcherOrder() {
+        List<RestConsumerContextPathMatcher.ConsumerPath<MockConsumerPath>> 
consumerPaths = new ArrayList<>();
+        consumerPaths.add(new MockConsumerPath("GET", "/camel/*"));
+        consumerPaths.add(new MockConsumerPath("GET", "/camel/foo"));
+        consumerPaths.add(new MockConsumerPath("GET", "/camel/foo/{id}"));
+
+        RestConsumerContextPathMatcher.ConsumerPath<?> path1 = 
RestConsumerContextPathMatcher.matchBestPath("GET",
+                "/camel/foo", consumerPaths);
+
+        RestConsumerContextPathMatcher.ConsumerPath<?> path2 = 
RestConsumerContextPathMatcher.matchBestPath("GET",
                 "/camel/foo/bar", consumerPaths);
 
-        assertEquals(path1.getConsumerPath(), "/camel/*");
+        assertEquals(path1.getConsumerPath(), "/camel/foo");
         assertEquals(path2.getConsumerPath(), "/camel/*");

Review Comment:
   The priority of wildcard is now higher than uri template . The correct order 
of priority is direct > URI template > wildcard, right?"



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to