From db1d4359c4b83610c42dbbba2069dcbfb8f542ec Mon Sep 17 00:00:00 2001 From: vga91 Date: Fri, 24 Jan 2025 10:32:47 +0100 Subject: [PATCH] fix test --- .../test/java/apoc/load/PostgresJdbcTest.java | 22 +++++++++---------- .../test/java/apoc/load/DuckDBJdbcTest.java | 11 ++++++++-- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/extended-it/src/test/java/apoc/load/PostgresJdbcTest.java b/extended-it/src/test/java/apoc/load/PostgresJdbcTest.java index 5ec4ccac89..20a1541f2b 100644 --- a/extended-it/src/test/java/apoc/load/PostgresJdbcTest.java +++ b/extended-it/src/test/java/apoc/load/PostgresJdbcTest.java @@ -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 @@ -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()); } diff --git a/extended/src/test/java/apoc/load/DuckDBJdbcTest.java b/extended/src/test/java/apoc/load/DuckDBJdbcTest.java index 96cde16f97..13da5b95cd 100644 --- a/extended/src/test/java/apoc/load/DuckDBJdbcTest.java +++ b/extended/src/test/java/apoc/load/DuckDBJdbcTest.java @@ -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()) { @@ -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()); }); } @@ -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,?,?,?,?)");