cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1468852 - in /cxf/trunk/rt/rs/extensions/search/src: main/java/org/apache/cxf/jaxrs/ext/search/Beanspector.java main/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParser.java test/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParserTest.java
Date Wed, 17 Apr 2013 11:58:34 GMT
Author: sergeyb
Date: Wed Apr 17 11:58:34 2013
New Revision: 1468852

URL: http://svn.apache.org/r1468852
Log:
[CXF-4949] Updating FiqlParser to recognize properties with camel case by default, without
having to map them

Modified:
    cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/Beanspector.java
    cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParser.java
    cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParserTest.java

Modified: cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/Beanspector.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/Beanspector.java?rev=1468852&r1=1468851&r2=1468852&view=diff
==============================================================================
--- cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/Beanspector.java
(original)
+++ cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/Beanspector.java
Wed Apr 17 11:58:34 2013
@@ -95,7 +95,7 @@ public class Beanspector<T> {
     }
 
     public TypeInfo getAccessorTypeInfo(String getterOrSetterName) throws Exception {
-        Method m = getters.get(getterOrSetterName);
+        Method m = getters.get(getterOrSetterName.toLowerCase());
         if (m == null) {
             m = setters.get(getterOrSetterName);
         }
@@ -122,7 +122,7 @@ public class Beanspector<T> {
     }
 
     public Beanspector<T> setValue(String setterName, Object value) throws Throwable
{
-        Method m = setters.get(setterName);
+        Method m = setters.get(setterName.toLowerCase());
         if (m == null) {
             String msg = String.format("Setter '%s' not found, " + "known setters are: %s",
setterName,
                                        setters.keySet());

Modified: cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParser.java?rev=1468852&r1=1468851&r2=1468852&view=diff
==============================================================================
--- cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParser.java
(original)
+++ cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParser.java
Wed Apr 17 11:58:34 2013
@@ -565,7 +565,7 @@ public class FiqlParser<T> implements Se
             if (isPrimitive(cond)) {
                 return new SimpleSearchCondition<T>(ct, cond); 
             } else {
-                return new SimpleSearchCondition<T>(Collections.singletonMap(templateName,
ct),
+                return new SimpleSearchCondition<T>(Collections.singletonMap(templateName.toLowerCase(),
ct),
                                                     Collections.singletonMap(templateName,
name),
                                                     Collections.singletonMap(templateName,
tvalue.getTypeInfo()),
                                                     cond);

Modified: cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParserTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParserTest.java?rev=1468852&r1=1468851&r2=1468852&view=diff
==============================================================================
--- cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParserTest.java
(original)
+++ cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/fiql/FiqlParserTest.java
Wed Apr 17 11:58:34 2013
@@ -128,13 +128,27 @@ public class FiqlParserTest extends Asse
 
     @Test
     public void testParseName() throws SearchParseException {
-        SearchCondition<Condition> filter = parser.parse("name==king");
+        doTestParseName("name==king");
+    }
+    
+    @Test
+    public void testParseTheName() throws SearchParseException {
+        doTestParseName("thename==king");
+    }
+    
+    @Test
+    public void testParseTheName2() throws SearchParseException {
+        doTestParseName("theName==king");
+    }
+
+    private void doTestParseName(String exp) throws SearchParseException {
+        SearchCondition<Condition> filter = parser.parse(exp);
         assertTrue(filter.isMet(new Condition("king", 10, new Date())));
         assertTrue(filter.isMet(new Condition("king", 0, null)));
         assertFalse(filter.isMet(new Condition("diamond", 10, new Date())));
         assertFalse(filter.isMet(new Condition("diamond", 0, null)));
     }
-
+    
     @Test
     public void testParseLevel() throws SearchParseException {
         SearchCondition<Condition> filter = parser.parse("level=gt=10");
@@ -319,8 +333,12 @@ public class FiqlParserTest extends Asse
             this.time = time;
         }
 
-        public void setException(Exception ex) {
-            // do nothing
+        public void setTheName(String thename) {
+            setName(thename);
+        }
+        
+        public String getTheName() {
+            return getName();
         }
 
     }



Mime
View raw message