cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1351411 - in /cxf/branches/2.6.x-fixes: ./ parent/ rt/rs/extensions/search/ rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/ rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/ rt/rs/extensions/...
Date Mon, 18 Jun 2012 16:37:02 GMT
Author: sergeyb
Date: Mon Jun 18 16:37:01 2012
New Revision: 1351411

URL: http://svn.apache.org/viewvc?rev=1351411&view=rev
Log:
Merged revisions 1351410 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1351410 | sergeyb | 2012-06-18 17:31:33 +0100 (Mon, 18 Jun 2012) | 1 line
  
  [CXF-4221] Initial support for FIQL to JPA convertors, applying a slightly modified patch
on behalf of Jeff Wang
........

Added:
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/AbstractSearchConditionVisitor.java
      - copied unchanged from r1351410, cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/AbstractSearchConditionVisitor.java
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/
      - copied from r1351410, cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/JPALanguageVisitor.java
      - copied unchanged from r1351410, cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/JPALanguageVisitor.java
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitor.java
      - copied unchanged from r1351410, cxf/trunk/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitor.java
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/
      - copied from r1351410, cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/Book.java
      - copied unchanged from r1351410, cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/Book.java
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/JPALanguageVisitorTest.java
      - copied unchanged from r1351410, cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/JPALanguageVisitorTest.java
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitorTest.java
      - copied unchanged from r1351410, cxf/trunk/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitorTest.java
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/test/resources/
      - copied from r1351410, cxf/trunk/rt/rs/extensions/search/src/test/resources/
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/test/resources/META-INF/
      - copied from r1351410, cxf/trunk/rt/rs/extensions/search/src/test/resources/META-INF/
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/test/resources/META-INF/persistence.xml
      - copied unchanged from r1351410, cxf/trunk/rt/rs/extensions/search/src/test/resources/META-INF/persistence.xml
Modified:
    cxf/branches/2.6.x-fixes/   (props changed)
    cxf/branches/2.6.x-fixes/parent/pom.xml
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/pom.xml
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchCondition.java
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchConditionVisitor.java
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchUtils.java
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitor.java
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/FiqlParserTest.java
    cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitorTest.java

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1351410

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Jun 18 16:37:01 2012
@@ -1 +1 @@
-/cxf/trunk:1-1348209,1348845,1348862,1348866,1349016,1349264,1349307,1349406,1349549,1349714-1349717,1349723,1349825,1350114,1350141,1350186,1350215-1350303,1350305,1350318,1350582,1350617,1350633,1350739
+/cxf/trunk:1-1348209,1348845,1348862,1348866,1349016,1349264,1349307,1349406,1349549,1349714-1349717,1349723,1349825,1350114,1350141,1350186,1350215-1350303,1350305,1350318,1350582,1350617,1350633,1350739,1351410

Modified: cxf/branches/2.6.x-fixes/parent/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/parent/pom.xml?rev=1351411&r1=1351410&r2=1351411&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/parent/pom.xml (original)
+++ cxf/branches/2.6.x-fixes/parent/pom.xml Mon Jun 18 16:37:01 2012
@@ -146,7 +146,8 @@
         <cxf.geronimo.ws.metadata.version>1.1.3</cxf.geronimo.ws.metadata.version>
         <cxf.geronimo.servlet.version>1.0</cxf.geronimo.servlet.version>
         <cxf.geronimo.servlet25.version>1.1.2</cxf.geronimo.servlet25.version>
-
+        <cxf.geronimo.jpa.version>1.0</cxf.geronimo.jpa.version>
+ 
         <cxf.commons-codec.version>1.4</cxf.commons-codec.version>
         <cxf.commons-lang.version>2.6</cxf.commons-lang.version>
         <cxf.commons-collections.version>3.2.1</cxf.commons-collections.version>

Modified: cxf/branches/2.6.x-fixes/rt/rs/extensions/search/pom.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/rs/extensions/search/pom.xml?rev=1351411&r1=1351410&r2=1351411&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/rs/extensions/search/pom.xml (original)
+++ cxf/branches/2.6.x-fixes/rt/rs/extensions/search/pom.xml Mon Jun 18 16:37:01 2012
@@ -34,6 +34,8 @@
     </parent>
 
     <properties>
+        <hibernate.em.version>4.1.0.Final</hibernate.em.version>
+        <hsqldb.version>1.8.0.10</hsqldb.version>
     </properties>
 
     <dependencies>
@@ -47,12 +49,30 @@
             <artifactId>cxf-rt-frontend-jaxrs</artifactId>
             <version>${project.version}</version>
         </dependency>
-        
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-jpa_2.0_spec</artifactId>
+            <version>${cxf.geronimo.jpa.version}</version>
+            <scope>provided</scope>
+            <optional>true</optional>
+        </dependency>        
         <dependency>
             <groupId>org.easymock</groupId>
             <artifactId>easymock</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+			<groupId>org.hibernate</groupId>
+			<artifactId>hibernate-entitymanager</artifactId>
+			<version>${hibernate.em.version}</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>hsqldb</groupId>
+			<artifactId>hsqldb</artifactId>
+			<version>1.8.0.10</version>
+			<scope>test</scope>
+		</dependency>
     </dependencies>
     <build>
         <plugins>

Modified: cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchCondition.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchCondition.java?rev=1351411&r1=1351410&r2=1351411&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchCondition.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchCondition.java
Mon Jun 18 16:37:01 2012
@@ -92,18 +92,4 @@ public interface SearchCondition<T> {
      */
     void accept(SearchConditionVisitor<T> visitor);
     
-    /**
-     * 
-     * This method is now deprecated and will be removed soon.
-     * 
-     * Utility method for converting this condition into an SQL expression
-     * @param table table name
-     * @param columns column names, a wildcard as in 'SELECT * from table' will be used
-     *                if names are not provided 
-     * @return SQL expression
-     */    
-    @Deprecated
-    String toSQL(String table, String... columns);
-    
-    
 }

Modified: cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchConditionVisitor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchConditionVisitor.java?rev=1351411&r1=1351410&r2=1351411&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchConditionVisitor.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchConditionVisitor.java
Mon Jun 18 16:37:01 2012
@@ -29,11 +29,4 @@ public interface SearchConditionVisitor<
      * Callback providing a current SearchCondition object 
      */
     void visit(SearchCondition<T> sc);
-    
-    /**
-     * Recover the accumulated query
-     * @return query string
-     */
-    String getResult();
-
 }

Modified: cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchUtils.java?rev=1351411&r1=1351410&r2=1351411&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchUtils.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/SearchUtils.java
Mon Jun 18 16:37:01 2012
@@ -19,6 +19,7 @@
 package org.apache.cxf.jaxrs.ext.search;
 
 import java.text.SimpleDateFormat;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.cxf.jaxrs.ext.search.sql.SQLPrinterVisitor;
@@ -43,24 +44,31 @@ public final class SearchUtils {
     }
     
     public static <T> String toSQL(SearchCondition<T> sc, String table, String...
columns) {
-        SearchConditionVisitor<T> visitor = new SQLPrinterVisitor<T>(table, columns);
+        SQLPrinterVisitor<T> visitor = new SQLPrinterVisitor<T>(table, columns);
         sc.accept(visitor);
-        return visitor.getResult();
+        return visitor.getQuery();
     }
     
-    public static void startSqlQuery(StringBuilder sb, String table, String... columns) {
+    public static void startSqlQuery(StringBuilder sb, 
+                                     String table,
+                                     String tableAlias,
+                                     List<String> columns) {
         sb.append("SELECT ");
-        if (columns.length > 0) {
-            for (int i = 0; i < columns.length; i++) {
-                sb.append(columns[i]);
-                if (i + 1 < columns.length) {
+        if (columns != null && columns.size() > 0) {
+            for (int i = 0; i < columns.size(); i++) {
+                sb.append(columns.get(i));
+                if (i + 1 < columns.size()) {
                     sb.append(",");
                 }
             }
         } else {
             sb.append("*");
         }
-        sb.append(" FROM ").append(table).append(" WHERE ");
+        sb.append(" FROM ").append(table);
+        if (tableAlias != null) {
+            sb.append(" " + tableAlias);
+        }
+        sb.append(" WHERE ");
     }
     
     public static String conditionTypeToSqlOperator(ConditionType ct, String value) {

Modified: cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitor.java?rev=1351411&r1=1351410&r2=1351411&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitor.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/main/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitor.java
Mon Jun 18 16:37:01 2012
@@ -18,33 +18,41 @@
  */
 package org.apache.cxf.jaxrs.ext.search.sql;
 
+import java.util.Arrays;
+import java.util.List;
 import java.util.Map;
-import java.util.logging.Logger;
 
-import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.jaxrs.ext.search.AbstractSearchConditionVisitor;
 import org.apache.cxf.jaxrs.ext.search.PrimitiveStatement;
 import org.apache.cxf.jaxrs.ext.search.SearchCondition;
-import org.apache.cxf.jaxrs.ext.search.SearchConditionVisitor;
 import org.apache.cxf.jaxrs.ext.search.SearchUtils;
 
 
-public class SQLPrinterVisitor<T> implements SearchConditionVisitor<T> {
+public class SQLPrinterVisitor<T> extends AbstractSearchConditionVisitor<T> {
 
-    private static final Logger LOG = LogUtils.getL7dLogger(SQLPrinterVisitor.class);
-    
     private StringBuilder sb;
     private String table;
-    private String[] columns;
-    private Map<String, String> fieldMap;
+    private String tableAlias;
+    private List<String> columns;
     
     public SQLPrinterVisitor(String table, String... columns) {
-        this(null, table, columns);
+        this(null, table, Arrays.asList(columns));
+    }
+    
+    public SQLPrinterVisitor(Map<String, String> fieldMap, 
+                             String table,
+                             List<String> columns) {
+        this(fieldMap, table, null, columns);
     }
     
-    public SQLPrinterVisitor(Map<String, String> fieldMap, String table, String...
columns) {
-        this.fieldMap = fieldMap;
+    public SQLPrinterVisitor(Map<String, String> fieldMap, 
+                             String table, 
+                             String tableAlias,
+                             List<String> columns) {
+        super(fieldMap);
         this.columns = columns;
         this.table = table;
+        this.tableAlias = tableAlias;
     }
     
     public void visit(SearchCondition<T> sc) {
@@ -52,7 +60,7 @@ public class SQLPrinterVisitor<T> implem
         if (sb == null) {
             sb = new StringBuilder();
             if (table != null) {
-                SearchUtils.startSqlQuery(sb, table, columns);
+                SearchUtils.startSqlQuery(sb, table, tableAlias, columns);
             }
         }
         
@@ -60,14 +68,10 @@ public class SQLPrinterVisitor<T> implem
         if (statement != null) {
             if (statement.getProperty() != null) {
                 String rvalStr = statement.getValue().toString().replaceAll("\\*", "%");
-                String name = statement.getProperty();
-                if (fieldMap != null) {
-                    if (fieldMap.containsKey(name)) {
-                        name = fieldMap.get(name);
-                    } else {
-                        LOG.warning("Unrecognized field alias : " + name);
-                        return;
-                    }
+                String name = getRealPropertyName(statement.getProperty());
+               
+                if (tableAlias != null) {
+                    name = tableAlias + "." + name;
                 }
                 
                 sb.append(name).append(" ").append(
@@ -90,7 +94,12 @@ public class SQLPrinterVisitor<T> implem
     }
     
 
+    @Deprecated
     public String getResult() {
+        return getQuery();
+    }
+    
+    public String getQuery() {
         return sb == null ? null : sb.toString();
     }
 }

Modified: cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/FiqlParserTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/FiqlParserTest.java?rev=1351411&r1=1351410&r2=1351411&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/FiqlParserTest.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/FiqlParserTest.java
Mon Jun 18 16:37:01 2012
@@ -193,11 +193,10 @@ public class FiqlParserTest extends Asse
         assertFalse(filter.isMet(new Condition("am", 20, null)));
     }
 
-    @SuppressWarnings("deprecation")
     @Test
     public void testSQL1() throws FiqlParseException {
         SearchCondition<Condition> filter = parser.parse("name==ami*;level=gt=10");
-        String sql = filter.toSQL("table");
+        String sql = SearchUtils.toSQL(filter, "table");
         assertTrue("SELECT * FROM table WHERE (name LIKE 'ami%') AND (level > '10')".equals(sql)
                    || "SELECT * FROM table WHERE (level > '10') AND (name LIKE 'ami%')".equals(sql));
     }
@@ -222,11 +221,10 @@ public class FiqlParserTest extends Asse
         assertFalse(filter.isMet(new Condition("foo", 0, null)));
     }
 
-    @SuppressWarnings("deprecation")
     @Test
     public void testSQL2() throws FiqlParseException {
         SearchCondition<Condition> filter = parser.parse("name==ami*,level=gt=10");
-        String sql = filter.toSQL("table");
+        String sql = SearchUtils.toSQL(filter, "table");
         assertTrue("SELECT * FROM table WHERE (name LIKE 'ami%') OR (level > '10')".equals(sql)
                    || "SELECT * FROM table WHERE (level > '10') OR (name LIKE 'ami%')".equals(sql));
     }
@@ -240,33 +238,30 @@ public class FiqlParserTest extends Asse
         assertFalse(filter.isMet(new Condition("bar", 20, null)));
     }
 
-    @SuppressWarnings("deprecation")
     @Test
     public void testSQL3() throws FiqlParseException {
         SearchCondition<Condition> filter = parser.parse("name==foo*;(name!=*bar,level=gt=10)");
-        String sql = filter.toSQL("table");
+        String sql = SearchUtils.toSQL(filter, "table");
         assertTrue(("SELECT * FROM table WHERE (name LIKE 'foo%') AND ((name NOT LIKE '%bar')
"
                     + "OR (level > '10'))").equals(sql)
                    || ("SELECT * FROM table WHERE (name LIKE 'foo%') AND "
                        + "((level > '10') OR (name NOT LIKE '%bar'))").equals(sql));
     }
 
-    @SuppressWarnings("deprecation")
     @Test
     public void testSQL4() throws FiqlParseException {
         SearchCondition<Condition> filter = parser.parse("(name==test,level==18);(name==test1,level!=19)");
-        String sql = filter.toSQL("table");
+        String sql = SearchUtils.toSQL(filter, "table");
         assertTrue(("SELECT * FROM table WHERE ((name = 'test') OR (level = '18'))"
                     + " AND ((name = 'test1') OR (level <> '19'))").equals(sql)
                    || ("SELECT * FROM table WHERE ((name = 'test1') OR (level <> '19'))"
                        + " AND ((name = 'test') OR (level = '18'))").equals(sql));
     }
 
-    @SuppressWarnings("deprecation")
     @Test
     public void testSQL5() throws FiqlParseException {
         SearchCondition<Condition> filter = parser.parse("name==test");
-        String sql = filter.toSQL("table");
+        String sql = SearchUtils.toSQL(filter, "table");
         assertTrue("SELECT * FROM table WHERE name = 'test'".equals(sql));
     }
 

Modified: cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitorTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitorTest.java?rev=1351411&r1=1351410&r2=1351411&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitorTest.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/sql/SQLPrinterVisitorTest.java
Mon Jun 18 16:37:01 2012
@@ -39,7 +39,7 @@ public class SQLPrinterVisitorTest exten
         SearchCondition<Condition> filter = parser.parse("name==ami*;level=gt=10");
         SQLPrinterVisitor<Condition> visitor = new SQLPrinterVisitor<Condition>("table");
         filter.accept(visitor);
-        String sql = visitor.getResult();
+        String sql = visitor.getQuery();
         
         assertTrue("SELECT * FROM table WHERE (name LIKE 'ami%') AND (level > '10')".equals(sql)
                    || "SELECT * FROM table WHERE (level > '10') AND (name LIKE 'ami%')".equals(sql));
@@ -51,7 +51,7 @@ public class SQLPrinterVisitorTest exten
         SearchCondition<SearchBean> filter = beanParser.parse("name==ami*;level=gt=10");
         SQLPrinterVisitor<SearchBean> visitor = new SQLPrinterVisitor<SearchBean>("table");
         filter.accept(visitor);
-        String sql = visitor.getResult();
+        String sql = visitor.getQuery();
         
         assertTrue("SELECT * FROM table WHERE (name LIKE 'ami%') AND (level > '10')".equals(sql)
                    || "SELECT * FROM table WHERE (level > '10') AND (name LIKE 'ami%')".equals(sql));
@@ -62,7 +62,7 @@ public class SQLPrinterVisitorTest exten
         SearchCondition<Condition> filter = parser.parse("name==ami*,level=gt=10");
         SQLPrinterVisitor<Condition> visitor = new SQLPrinterVisitor<Condition>("table");
         filter.accept(visitor);
-        String sql = visitor.getResult();
+        String sql = visitor.getQuery();
         assertTrue("SELECT * FROM table WHERE (name LIKE 'ami%') OR (level > '10')".equals(sql)
                    || "SELECT * FROM table WHERE (level > '10') OR (name LIKE 'ami%')".equals(sql));
     }
@@ -72,7 +72,7 @@ public class SQLPrinterVisitorTest exten
         SearchCondition<Condition> filter = parser.parse("name==foo*;(name!=*bar,level=gt=10)");
         SQLPrinterVisitor<Condition> visitor = new SQLPrinterVisitor<Condition>("table");
         filter.accept(visitor);
-        String sql = visitor.getResult();
+        String sql = visitor.getQuery();
         assertTrue(("SELECT * FROM table WHERE (name LIKE 'foo%') AND ((name NOT LIKE '%bar')
"
                    + "OR (level > '10'))").equals(sql)
                    || ("SELECT * FROM table WHERE (name LIKE 'foo%') AND "
@@ -85,7 +85,7 @@ public class SQLPrinterVisitorTest exten
         SearchCondition<SearchBean> filter = beanParser.parse("name==foo*;(name!=*bar,level=gt=10)");
         SQLPrinterVisitor<SearchBean> visitor = new SQLPrinterVisitor<SearchBean>("table");
         filter.accept(visitor);
-        String sql = visitor.getResult();
+        String sql = visitor.getQuery();
         assertTrue(("SELECT * FROM table WHERE (name LIKE 'foo%') AND ((name NOT LIKE '%bar')
"
                    + "OR (level > '10'))").equals(sql)
                    || ("SELECT * FROM table WHERE (name LIKE 'foo%') AND "
@@ -97,7 +97,7 @@ public class SQLPrinterVisitorTest exten
         SearchCondition<Condition> filter = parser.parse("(name==test,level==18);(name==test1,level!=19)");
         SQLPrinterVisitor<Condition> visitor = new SQLPrinterVisitor<Condition>("table");
         filter.accept(visitor);
-        String sql = visitor.getResult();
+        String sql = visitor.getQuery();
         assertTrue(("SELECT * FROM table WHERE ((name = 'test') OR (level = '18'))"
                    + " AND ((name = 'test1') OR (level <> '19'))").equals(sql)
                    || ("SELECT * FROM table WHERE ((name = 'test1') OR (level <> '19'))"
@@ -109,7 +109,7 @@ public class SQLPrinterVisitorTest exten
         SearchCondition<Condition> filter = parser.parse("name==test");
         SQLPrinterVisitor<Condition> visitor = new SQLPrinterVisitor<Condition>("table");
         filter.accept(visitor);
-        String sql = visitor.getResult();
+        String sql = visitor.getQuery();
         assertTrue("SELECT * FROM table WHERE name = 'test'".equals(sql));
     }
     
@@ -119,7 +119,7 @@ public class SQLPrinterVisitorTest exten
         SQLPrinterVisitor<Condition> visitor = 
             new SQLPrinterVisitor<Condition>("table", "NAMES");
         filter.accept(visitor);
-        String sql = visitor.getResult();
+        String sql = visitor.getQuery();
         assertTrue("SELECT NAMES FROM table WHERE name = 'test'".equals(sql));
     }
     
@@ -129,9 +129,9 @@ public class SQLPrinterVisitorTest exten
         SQLPrinterVisitor<Condition> visitor = 
             new SQLPrinterVisitor<Condition>(
                 Collections.singletonMap("name", "NAMES"),
-                "table", "NAMES");
+                "table", Collections.singletonList("NAMES"));
         filter.accept(visitor);
-        String sql = visitor.getResult();
+        String sql = visitor.getQuery();
         assertTrue("SELECT NAMES FROM table WHERE NAMES = 'test'".equals(sql));
     }
     



Mime
View raw message