public void testCreateTable() throws Exception { assert !existsTable(connection, tableManager.getTableName()); tableManager.createTable(connection); assert existsTable(connection, tableManager.getTableName()); }
@Test(dependsOnMethods = "testExists") public void testDrop() throws Exception { assert tableManager.tableExists(connection); byte[] data = new byte[64]; new Random().nextBytes(data); PreparedStatement ps = null; try { ps = connection.prepareStatement("INSERT INTO " + tableManager.getTableName() + "(ID_COLUMN, DATA_COLUMN, TIMESTAMP_COLUMN) values(?, ?, ?)"); ps.setString(1, System.currentTimeMillis() + ""); ps.setBlob(2, new ByteArrayInputStream(data)); ps.setLong(3, System.currentTimeMillis()); assert 1 == ps.executeUpdate(); } finally { JdbcUtil.safeClose(ps); } tableManager.dropTable(connection); assert !tableManager.tableExists(connection); }
public void testTableQuoting() throws Exception { tableManager.setCacheName("my.cache"); assert !existsTable(connection, tableManager.getTableName()); tableManager.createTable(connection); assert existsTable(connection, tableManager.getTableName()); }
protected int rowCount() { ConnectionFactory connectionFactory = getConnection(); TableName tableName = tableManager.getTableName(); return UnitTestDatabaseManager.rowCount(connectionFactory, tableName); }
private void assertRowCount(int rowCount) { ConnectionFactory connectionFactory = store.getConnectionFactory(); TableName tableName = store.getTableManager().getTableName(); int value = UnitTestDatabaseManager.rowCount(connectionFactory, tableName); assert value == rowCount : "Expected " + rowCount + " rows, actual value is " + value; }