1010import org .junit .jupiter .api .BeforeEach ;
1111import org .junit .jupiter .api .Test ;
1212
13+ import io .github .zero88 .utils .Strings ;
1314import io .zero88 .rsql .jooq .query .JooqFetchCountQuery ;
1415import io .zero88 .rsql .jooq .query .JooqFetchExistQuery ;
15- import io .github .zero88 .utils .Strings ;
1616
1717public class JooqRqlQueryTest {
1818
@@ -27,17 +27,19 @@ public void before() {
2727
2828 @ Test
2929 public void test_h2_schema_info () {
30- final String query = Tables .TABLE_SCHEMA .getName () + "==public" + ";" +
31- Tables .TABLE_NAME .getName () + "=exists=x" + " and " + "(" +
32- Tables .TABLE_TYPE .getName () + "=in=(xyz,abc)" + "," +
30+ final String query = Tables .TABLE_SCHEMA .getName () + "==public" + ";" + Tables .TABLE_NAME .getName () +
31+ "=exists=t" + " and " + "(" + Tables .TABLE_TYPE .getName () + "=in=(xyz,abc)" + "," +
3332 Tables .TABLE_CLASS .getName () + "=out=(123,456)" + ")" ;
3433 final Condition condition = jooqRqlParser .criteria (query , Tables .TABLES );
35- Assertions .assertEquals ("( 1 = 1 and \" INFORMATION_SCHEMA\" .\" TABLES\" .\" TABLE_SCHEMA\" = 'public' and " +
36- "\" INFORMATION_SCHEMA\" .\" TABLES\" .\" TABLE_NAME\" is not null and ( ( 1 = 1 and " +
37- "\" INFORMATION_SCHEMA\" .\" TABLES\" .\" TABLE_TYPE\" in ( 'xyz', 'abc' ) ) or " +
34+ Assertions .assertEquals ("( \" INFORMATION_SCHEMA\" .\" TABLES\" .\" TABLE_SCHEMA\" = 'public' and " +
35+ "\" INFORMATION_SCHEMA\" .\" TABLES\" .\" TABLE_NAME\" is not null and ( " +
36+ "\" INFORMATION_SCHEMA\" .\" TABLES\" .\" TABLE_TYPE\" in ( 'xyz', 'abc' ) or " +
3837 "\" INFORMATION_SCHEMA\" .\" TABLES\" .\" TABLE_CLASS\" not in ( '123', '456' ) ) )" ,
3938 Strings .optimizeMultipleSpace (condition .toString ()));
39+ System .out .println (query );
40+ System .out .println (Strings .optimizeMultipleSpace (condition .toString ()));
4041 Assertions .assertEquals (0 , JooqFetchCountQuery .builder ()
42+ .parser (jooqRqlParser )
4143 .dsl (dsl )
4244 .table (Tables .TABLES )
4345 .build ()
@@ -47,14 +49,13 @@ public void test_h2_schema_info() {
4749
4850 @ Test
4951 public void test_h2_exist () {
50- final String query = Tables .TABLE_SCHEMA .getName () + "==public" + ";" +
51- Tables .TABLE_NAME .getName () + "=exists=x" + " and " + "(" +
52- Tables .TABLE_TYPE .getName () + "=in=(xyz,abc)" + "," +
52+ final String query = Tables .TABLE_SCHEMA .getName () + "==public" + ";" + Tables .TABLE_NAME .getName () +
53+ "=exists=x" + " and " + "(" + Tables .TABLE_TYPE .getName () + "=in=(xyz,abc)" + "," +
5354 Tables .TABLE_CLASS .getName () + "=out=(123,456)" + ")" ;
5455 final Condition condition = jooqRqlParser .criteria (query , Tables .TABLES );
55- Assertions .assertEquals ("( 1 = 1 and \" INFORMATION_SCHEMA\" .\" TABLES\" .\" TABLE_SCHEMA\" = 'public' and " +
56- "\" INFORMATION_SCHEMA\" .\" TABLES\" .\" TABLE_NAME\" is not null and ( ( 1 = 1 and " +
57- "\" INFORMATION_SCHEMA\" .\" TABLES\" .\" TABLE_TYPE\" in ( 'xyz', 'abc' ) ) or " +
56+ Assertions .assertEquals ("( \" INFORMATION_SCHEMA\" .\" TABLES\" .\" TABLE_SCHEMA\" = 'public' and " +
57+ "\" INFORMATION_SCHEMA\" .\" TABLES\" .\" TABLE_NAME\" is not null and ( " +
58+ "\" INFORMATION_SCHEMA\" .\" TABLES\" .\" TABLE_TYPE\" in ( 'xyz', 'abc' ) or " +
5859 "\" INFORMATION_SCHEMA\" .\" TABLES\" .\" TABLE_CLASS\" not in ( '123', '456' ) ) )" ,
5960 Strings .optimizeMultipleSpace (condition .toString ()));
6061 Assertions .assertEquals (false ,
0 commit comments