diff options
Diffstat (limited to 'plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/PurgeAttributeTest.java')
-rw-r--r-- | plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/PurgeAttributeTest.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/PurgeAttributeTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/PurgeAttributeTest.java index 3449192bcee..d9612a2c206 100644 --- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/PurgeAttributeTest.java +++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/intergration/PurgeAttributeTest.java @@ -40,6 +40,7 @@ public class PurgeAttributeTest { @Test public void testPurgeAttribute() throws Exception { JdbcClient jdbcClient = jdbcService.getClient(); + JdbcStatement stmt = jdbcClient.getStatement(); int prePurgeAttributeCount = getCount(jdbcClient, "osee_attribute"); int preAttributeRows = getCount(jdbcClient, "osee_attribute where value = 'Software Requirements'"); @@ -48,9 +49,11 @@ public class PurgeAttributeTest { int prePurgeTxsCount = getCount(jdbcClient, "osee_txs"); + stmt.runPreparedQuery("select attr_id from osee_attribute where value = 'Software Requirements'"); List<Long> toPurge = new LinkedList<>(); - jdbcClient.runQuery(stmt -> toPurge.add(stmt.getLong("attr_id")), - "select attr_id from osee_attribute where value = 'Software Requirements'"); + while (stmt.next()) { + toPurge.add(stmt.getLong("attr_id")); + } PurgeAttributesDatabaseTxCallable callable = new PurgeAttributesDatabaseTxCallable(null, null, jdbcClient, sqlJoinFactory, toPurge, null); @@ -68,12 +71,11 @@ public class PurgeAttributeTest { } private int getCount(JdbcClient jdbcClient, String table) { + JdbcStatement stmt = jdbcClient.getStatement(); int toReturn = -1; - try (JdbcStatement chStmt = jdbcClient.getStatement()) { - chStmt.runPreparedQuery("select count(1) from " + table); - while (chStmt.next()) { - toReturn = chStmt.getInt(1); - } + stmt.runPreparedQuery("select count(1) from " + table); + while (stmt.next()) { + toReturn = stmt.getInt(1); } return toReturn; } |