cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1245070 - in /cxf/trunk/rt/frontend/jaxrs/src: main/java/org/apache/cxf/jaxrs/model/URITemplate.java test/java/org/apache/cxf/jaxrs/model/URITemplateTest.java
Date Thu, 16 Feb 2012 16:31:16 GMT
Author: sergeyb
Date: Thu Feb 16 16:31:15 2012
New Revision: 1245070

URL: http://svn.apache.org/viewvc?rev=1245070&view=rev
Log:
[CXF-4116] Comparing Pattern string representations as the last step

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/URITemplate.java
    cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/URITemplateTest.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/URITemplate.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/URITemplate.java?rev=1245070&r1=1245069&r2=1245070&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/URITemplate.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/URITemplate.java
Thu Feb 16 16:31:15 2012
@@ -98,6 +98,10 @@ public final class URITemplate {
     public String getValue() {
         return template;
     }
+    
+    public String getPatternValue() {
+        return templateRegexPattern.toString();
+    }
 
     /**
      * List of all variables in order of appearance in template.
@@ -341,6 +345,10 @@ public final class URITemplate {
                 return gCustom1 < gCustom2 ? 1 : -1;
             }
         }
+        if (result == 0) {
+            result = t1.getPatternValue().compareTo(t2.getPatternValue());
+        }
+            
         return result;
     }
 

Modified: cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/URITemplateTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/URITemplateTest.java?rev=1245070&r1=1245069&r2=1245070&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/URITemplateTest.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/model/URITemplateTest.java
Thu Feb 16 16:31:15 2012
@@ -40,6 +40,15 @@ public class URITemplateTest extends Ass
     }
 
     @Test
+    public void testCompareRegExTemplates() {
+        URITemplate t1 = new URITemplate("{entitySetName}{optionalParens: (\\(\\))?}");
+        URITemplate t2 = new URITemplate("{entitySetName}{id: \\(.+?\\)}");
+        assertTrue(URITemplate.compareTemplates(t1, t2) < 0);
+        assertTrue(URITemplate.compareTemplates(t2, t1) > 0);
+        assertEquals(0, URITemplate.compareTemplates(t2, t2));
+    }
+    
+    @Test
     public void testPathCharacters() {
         String pathChars = ":@!$&'*+,;=-._~()";
         assertTrue(new URITemplate(pathChars).match(pathChars, 



Mime
View raw message