cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1296285 - in /cxf/branches/2.3.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/search/ rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/search/
Date Fri, 02 Mar 2012 16:22:02 GMT
Author: sergeyb
Date: Fri Mar  2 16:22:01 2012
New Revision: 1296285

URL: http://svn.apache.org/viewvc?rev=1296285&view=rev
Log:
Merged revisions 1296276,1296282 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.4.x-fixes

................
  r1296276 | sergeyb | 2012-03-02 16:15:01 +0000 (Fri, 02 Mar 2012) | 16 lines
  
  Merged revisions 1296273 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/branches/2.5.x-fixes
  
  ................
    r1296273 | sergeyb | 2012-03-02 16:10:28 +0000 (Fri, 02 Mar 2012) | 9 lines
    
    Merged revisions 1296270 via svnmerge from 
    https://svn.apache.org/repos/asf/cxf/trunk
    
    ........
      r1296270 | sergeyb | 2012-03-02 16:06:19 +0000 (Fri, 02 Mar 2012) | 1 line
      
      [CXF-4153] Fixing Beanspector wrongly getting the property names in case of 'is'
    ........
  ................
................
  r1296282 | sergeyb | 2012-03-02 16:19:31 +0000 (Fri, 02 Mar 2012) | 16 lines
  
  Merged revisions 1296281 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/branches/2.5.x-fixes
  
  ................
    r1296281 | sergeyb | 2012-03-02 16:18:01 +0000 (Fri, 02 Mar 2012) | 9 lines
    
    Merged revisions 1296277 via svnmerge from 
    https://svn.apache.org/repos/asf/cxf/trunk
    
    ........
      r1296277 | sergeyb | 2012-03-02 16:16:13 +0000 (Fri, 02 Mar 2012) | 1 line
      
      [CXF-4153] Adding the missing test file
    ........
  ................
................

Added:
    cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/search/BeanspectorTest.java
      - copied unchanged from r1296282, cxf/branches/2.4.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/search/BeanspectorTest.java
Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/search/Beanspector.java
    cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/search/FiqlParserTest.java

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Fri Mar  2 16:22:01 2012
@@ -0,0 +1,3 @@
+/cxf/branches/2.4.x-fixes:1296276-1296282
+/cxf/branches/2.5.x-fixes:1296273,1296281
+/cxf/trunk:1296270,1296277

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/search/Beanspector.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/search/Beanspector.java?rev=1296285&r1=1296284&r2=1296285&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/search/Beanspector.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/search/Beanspector.java
Fri Mar  2 16:22:01 2012
@@ -60,9 +60,9 @@ class Beanspector<T> {
         }
         for (Method m : tclass.getMethods()) {
             if (isGetter(m)) {
-                getters.put(getterName(m), m);
+                getters.put(getPropertyName(m), m);
             } else if (isSetter(m)) {
-                setters.put(setterName(m), m);
+                setters.put(getPropertyName(m), m);
             }
         }
         // check type equality for getter-setter pairs
@@ -171,8 +171,17 @@ class Beanspector<T> {
                && (m.getName().startsWith("get") || m.getName().startsWith("is"));
     }
 
-    private String getterName(Method m) {
-        return m.getName().replace("is", "").replace("get", "").toLowerCase();
+    private String getPropertyName(Method m) {
+        // at this point the method is either getter or setter
+        String result = m.getName().toLowerCase();
+
+        if (result.startsWith("is")) {
+            result = result.substring(2, result.length());
+        } else {
+            result = result.substring(3, result.length());
+        }
+        return result;
+
     }
 
     private boolean isSetter(Method m) {
@@ -180,8 +189,6 @@ class Beanspector<T> {
                && (m.getName().startsWith("set") || m.getName().startsWith("is"));
     }
 
-    private String setterName(Method m) {
-        return m.getName().replace("is", "").replace("set", "").toLowerCase();
-    }
+    
 
 }

Modified: cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/search/FiqlParserTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/search/FiqlParserTest.java?rev=1296285&r1=1296284&r2=1296285&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/search/FiqlParserTest.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/ext/search/FiqlParserTest.java
Fri Mar  2 16:22:01 2012
@@ -118,11 +118,6 @@ public class FiqlParserTest extends Asse
         parser.parse("name==10");
     }
 
-    @Test(expected = IllegalArgumentException.class)
-    public void testMismatchedAccessorTypes() throws FiqlParseException {
-        new FiqlParser<MismatchedTypes>(MismatchedTypes.class);
-    }
-
     @Test
     public void testParseName() throws FiqlParseException {
         SearchCondition<Condition> filter = parser.parse("name==king");
@@ -277,14 +272,4 @@ public class FiqlParserTest extends Asse
 
     }
 
-    // TODO refactor to Beanspector unit tests
-    @Ignore
-    static class MismatchedTypes {
-        public Date getFoo() {
-            return null;
-        }
-
-        public void setFoo(String val) {
-        }
-    }
 }



Mime
View raw message