Search in sources :

Example 1 with SBThreadLocalVisitorState

use of org.apache.cxf.jaxrs.ext.search.visitor.SBThreadLocalVisitorState in project cxf by apache.

the class SQLPrinterVisitorTest method testSQL4WithTLStateAndSingleThread.

@Test
public void testSQL4WithTLStateAndSingleThread() throws SearchParseException {
    SearchCondition<Condition> filter = parser.parse("(name==test,level==18);(name==test1,level!=19)");
    SQLPrinterVisitor<Condition> visitor = new SQLPrinterVisitor<>("table");
    visitor.setVisitorState(new SBThreadLocalVisitorState());
    filter.accept(visitor);
    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'))" + " AND ((name = 'test') OR (level = '18'))").equals(sql));
}
Also used : SearchCondition(org.apache.cxf.jaxrs.ext.search.SearchCondition) SBThreadLocalVisitorState(org.apache.cxf.jaxrs.ext.search.visitor.SBThreadLocalVisitorState) Test(org.junit.Test)

Aggregations

SearchCondition (org.apache.cxf.jaxrs.ext.search.SearchCondition)1 SBThreadLocalVisitorState (org.apache.cxf.jaxrs.ext.search.visitor.SBThreadLocalVisitorState)1 Test (org.junit.Test)1