3
3
import apoc .periodic .Periodic ;
4
4
import apoc .text .Strings ;
5
5
import apoc .util .TestUtil ;
6
- import apoc .util .Util ;
6
+ import apoc .util .UtilExtended ;
7
7
import org .junit .AfterClass ;
8
8
import org .junit .BeforeClass ;
9
9
import org .junit .ClassRule ;
@@ -53,25 +53,25 @@ public static void tearDown() throws SQLException {
53
53
54
54
@ Test
55
55
public void testLoadJdbc () throws Exception {
56
- testCall (db , "CALL apoc.load.jdbc($url,'PERSON',[], $config)" , Util .map ("url" , postgress .getJdbcUrl (),
57
- "config" , Util .map ("schema" , "test" ,
58
- "credentials" , Util .map ("user" , postgress .getUsername (), "password" , postgress .getPassword ()))),
56
+ testCall (db , "CALL apoc.load.jdbc($url,'PERSON',[], $config)" , UtilExtended .map ("url" , postgress .getJdbcUrl (),
57
+ "config" , UtilExtended .map ("schema" , "test" ,
58
+ "credentials" , UtilExtended .map ("user" , postgress .getUsername (), "password" , postgress .getPassword ()))),
59
59
(row ) -> assertResult (row ));
60
60
}
61
61
62
62
@ Test
63
63
public void testLoadJdbSelect () throws Exception {
64
- testCall (db , "CALL apoc.load.jdbc($url,'SELECT * FROM PERSON',[], $config)" , Util .map ("url" , postgress .getJdbcUrl (),
65
- "config" , Util .map ("schema" , "test" ,
66
- "credentials" , Util .map ("user" , postgress .getUsername (), "password" , postgress .getPassword ()))),
64
+ testCall (db , "CALL apoc.load.jdbc($url,'SELECT * FROM PERSON',[], $config)" , UtilExtended .map ("url" , postgress .getJdbcUrl (),
65
+ "config" , UtilExtended .map ("schema" , "test" ,
66
+ "credentials" , UtilExtended .map ("user" , postgress .getUsername (), "password" , postgress .getPassword ()))),
67
67
(row ) -> assertResult (row ));
68
68
}
69
69
70
70
@ Test
71
71
public void testLoadJdbSelectWithArrays () throws Exception {
72
- testCall (db , "CALL apoc.load.jdbc($url,'SELECT * FROM ARRAY_TABLE',[], $config)" , Util .map ("url" , postgress .getJdbcUrl (),
73
- "config" , Util .map ("schema" , "test" ,
74
- "credentials" , Util .map ("user" , postgress .getUsername (), "password" , postgress .getPassword ()))),
72
+ testCall (db , "CALL apoc.load.jdbc($url,'SELECT * FROM ARRAY_TABLE',[], $config)" , UtilExtended .map ("url" , postgress .getJdbcUrl (),
73
+ "config" , UtilExtended .map ("schema" , "test" ,
74
+ "credentials" , UtilExtended .map ("user" , postgress .getUsername (), "password" , postgress .getPassword ()))),
75
75
(result ) -> {
76
76
Map <String , Object > row = (Map <String , Object >)result .get ("row" );
77
77
assertEquals ("John" , row .get ("NAME" ));
@@ -85,27 +85,27 @@ public void testLoadJdbSelectWithArrays() throws Exception {
85
85
@ Test
86
86
public void testLoadJdbcUpdate () throws Exception {
87
87
testCall (db , "CALL apoc.load.jdbcUpdate($url,'UPDATE PERSON SET \" SURNAME\" = ? WHERE \" NAME\" = ?', ['DOE', 'John'], $config)" ,
88
- Util .map ("url" , postgress .getJdbcUrl (),
89
- "config" , Util .map ("schema" , "test" ,
90
- "credentials" , Util .map ("user" , postgress .getUsername (), "password" , postgress .getPassword ()))),
91
- (row ) -> assertEquals ( Util .map ("count" , 1 ), row .get ("row" )));
88
+ UtilExtended .map ("url" , postgress .getJdbcUrl (),
89
+ "config" , UtilExtended .map ("schema" , "test" ,
90
+ "credentials" , UtilExtended .map ("user" , postgress .getUsername (), "password" , postgress .getPassword ()))),
91
+ (row ) -> assertEquals ( UtilExtended .map ("count" , 1 ), row .get ("row" )));
92
92
}
93
93
94
94
@ Test
95
95
public void testLoadJdbcParams () throws Exception {
96
96
testCall (db , "CALL apoc.load.jdbc($url,'SELECT * FROM PERSON WHERE \" NAME\" = ?',['John'], $config)" , // YIELD row RETURN row
97
- Util .map ("url" , postgress .getJdbcUrl (),
98
- "config" , Util .map ("schema" , "test" ,
99
- "credentials" , Util .map ("user" , postgress .getUsername (), "password" , postgress .getPassword ()))),
97
+ UtilExtended .map ("url" , postgress .getJdbcUrl (),
98
+ "config" , UtilExtended .map ("schema" , "test" ,
99
+ "credentials" , UtilExtended .map ("user" , postgress .getUsername (), "password" , postgress .getPassword ()))),
100
100
(row ) -> assertResult (row ));
101
101
}
102
102
103
103
@ Test
104
104
@ Ignore ("flaky" )
105
105
public void testIssue4141PeriodicIterateWithJdbc () throws Exception {
106
- var config = Util .map ("url" , postgress .getJdbcUrl (),
107
- "config" , Util .map ("schema" , "test" ,
108
- "credentials" , Util .map ("user" , postgress .getUsername (), "password" , postgress .getPassword ())));
106
+ var config = UtilExtended .map ("url" , postgress .getJdbcUrl (),
107
+ "config" , UtilExtended .map ("schema" , "test" ,
108
+ "credentials" , UtilExtended .map ("user" , postgress .getUsername (), "password" , postgress .getPassword ())));
109
109
110
110
String query = "WITH range(0, 100) as list UNWIND list as l CREATE (n:MyNode{id: l})" ;
111
111
0 commit comments