Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
vga91 committed Jan 24, 2025
1 parent f2d0bf9 commit db1d435
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
22 changes: 11 additions & 11 deletions extended-it/src/test/java/apoc/load/PostgresJdbcTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public void testLoadJdbcAnalytics() {
"url", getUrl(postgress),
"config", map(PROVIDER_CONF_KEY, Analytics.Provider.POSTGRES.name())
),
r -> commonAnalyticsAssertions(r, 1));
r -> commonAnalyticsAssertions(r, 1L));
}

@Test
Expand All @@ -190,19 +190,19 @@ public void testLoadJdbcAnalyticsWindow() {
"url", getUrl(postgress),
"config", map(PROVIDER_CONF_KEY, Analytics.Provider.MYSQL.name())
),
r -> commonAnalyticsAssertions(r, 2));
r -> commonAnalyticsAssertions(r, 2L));
}

private static void commonAnalyticsAssertions(Result r, int expected3rdResult) {
assertRowRank(r.next(), 1);
assertRowRank(r.next(), 1);
private static void commonAnalyticsAssertions(Result r, long expected3rdResult) {
assertRowRank(r.next(), 1L);
assertRowRank(r.next(), 1L);
assertRowRank(r.next(), expected3rdResult);
assertRowRank(r.next(), 2);
assertRowRank(r.next(), 3);
assertRowRank(r.next(), 3);
assertRowRank(r.next(), 4);
assertRowRank(r.next(), 5);
assertRowRank(r.next(), 6);
assertRowRank(r.next(), 2L);
assertRowRank(r.next(), 3L);
assertRowRank(r.next(), 3L);
assertRowRank(r.next(), 4L);
assertRowRank(r.next(), 5L);
assertRowRank(r.next(), 6L);

assertFalse(r.hasNext());
}
Expand Down
11 changes: 9 additions & 2 deletions extended/src/test/java/apoc/load/DuckDBJdbcTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void setUp() throws Exception {
TestUtil.registerProcedure(db, Jdbc.class, Periodic.class, Analytics.class);

conn = DriverManager.getConnection(JDBC_DUCKDB);
createPersonTableAndData();
createPersonTableAndData(conn);

String movies = Util.readResourceFile(ANALYTICS_CYPHER_FILE);
try (Transaction tx = db.beginTx()) {
Expand Down Expand Up @@ -156,6 +156,13 @@ public void testLoadJdbcAnalytics() {
assertEquals("New York City", result.get(nameKey));
assertEquals("US", result.get(countryKey));

row = r.next();
result = (Map) row.get(rowKey);
rank = (long) result.get(rankKey);
assertEquals(5, rank);
assertEquals("Seattle", result.get(nameKey));
assertEquals("US", result.get(countryKey));

assertFalse(r.hasNext());
});
}
Expand Down Expand Up @@ -461,7 +468,7 @@ public void testIssue3496() {
});
}

private void createPersonTableAndData() throws SQLException {
private void createPersonTableAndData(Connection conn) throws SQLException {
try { conn.createStatement().execute("DROP TABLE PERSON"); } catch (SQLException se) {/*ignore*/}
conn.createStatement().execute("CREATE TABLE PERSON (NAME varchar(50), SURNAME varchar(50), HIRE_DATE DATE, EFFECTIVE_FROM_DATE TIMESTAMP, TEST_TIME TIME, NULL_DATE DATE)");
PreparedStatement ps = conn.prepareStatement("INSERT INTO PERSON values(?,null,?,?,?,?)");
Expand Down

0 comments on commit db1d435

Please sign in to comment.