Skip to content

Commit

Permalink
Inline method addPrimaryKeyToCopyTable
Browse files Browse the repository at this point in the history
Inline method `addPrimaryKeyToCopyTable` in `TestPostgreSqlJdbcConnectionAccesses`
and `TestPostgreSqlJdbcConnectionCreation` for readability
  • Loading branch information
chenjian2664 committed Dec 10, 2024
1 parent da5fe7c commit 997c7a4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,12 @@ private void testJdbcMergeConnectionCreations()
{
assertJdbcConnections("CREATE TABLE copy_of_customer AS SELECT * FROM customer", 15, Optional.empty());

addPrimaryKeyToCopyTable();
postgreSqlServer.execute("ALTER TABLE copy_of_customer ADD CONSTRAINT t_copy_of_customer PRIMARY KEY (custkey)");
assertJdbcConnections("DELETE FROM copy_of_customer WHERE abs(custkey) = 1", 24, Optional.empty());
assertJdbcConnections("UPDATE copy_of_customer SET name = 'POLAND' WHERE abs(custkey) = 1", 32, Optional.empty());
assertJdbcConnections("MERGE INTO copy_of_customer c USING customer r ON r.custkey = c.custkey WHEN MATCHED THEN DELETE", 28, Optional.empty());
}

private void addPrimaryKeyToCopyTable()
{
postgreSqlServer.execute("ALTER TABLE copy_of_customer ADD CONSTRAINT t_copy_of_customer PRIMARY KEY (custkey)");
}

private static final class TestingPostgreSqlModule
extends AbstractConfigurationAwareModule
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,12 @@ private void testJdbcMergeConnectionCreations()
{
assertJdbcConnections("CREATE TABLE copy_of_customer AS SELECT * FROM customer", 6, Optional.empty());

addPrimaryKeyToCopyTable();
postgreSqlServer.execute("ALTER TABLE copy_of_customer ADD CONSTRAINT t_copy_of_nation PRIMARY KEY (custkey)");
assertJdbcConnections("DELETE FROM copy_of_customer WHERE abs(custkey) = 1", 17, Optional.empty());
assertJdbcConnections("UPDATE copy_of_customer SET name = 'POLAND' WHERE abs(custkey) = 1", 25, Optional.empty());
assertJdbcConnections("MERGE INTO copy_of_customer c USING customer r ON r.custkey = c.custkey WHEN MATCHED THEN DELETE", 18, Optional.empty());
}

private void addPrimaryKeyToCopyTable()
{
postgreSqlServer.execute("ALTER TABLE copy_of_customer ADD CONSTRAINT t_copy_of_nation PRIMARY KEY (custkey)");
}

private static final class TestingPostgreSqlModule
extends AbstractConfigurationAwareModule
{
Expand Down

0 comments on commit 997c7a4

Please sign in to comment.