diff options
author | Henri Sara <hesara@vaadin.com> | 2013-05-14 15:25:58 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-05-14 13:37:25 +0000 |
commit | 67696f3dcb968bde52bee4bb841b642c41fc6009 (patch) | |
tree | 0d6ca3c4d2213cf716eefc4509346a7ab37c4412 /uitest/src/com/vaadin/tests/containers/sqlcontainer/DatabaseHelper.java | |
parent | 1a6200e19b1e366383286dfa7074c4183d8dcfb9 (diff) | |
download | vaadin-framework-67696f3dcb968bde52bee4bb841b642c41fc6009.tar.gz vaadin-framework-67696f3dcb968bde52bee4bb841b642c41fc6009.zip |
SQLContainer.indexOfId() also searches backwards (#11849, #10376)
Change-Id: Iea3f832cd50314f747b82b774c3be57797f9ac1d
Diffstat (limited to 'uitest/src/com/vaadin/tests/containers/sqlcontainer/DatabaseHelper.java')
-rw-r--r-- | uitest/src/com/vaadin/tests/containers/sqlcontainer/DatabaseHelper.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/containers/sqlcontainer/DatabaseHelper.java b/uitest/src/com/vaadin/tests/containers/sqlcontainer/DatabaseHelper.java index 287d772901..7e95a41742 100644 --- a/uitest/src/com/vaadin/tests/containers/sqlcontainer/DatabaseHelper.java +++ b/uitest/src/com/vaadin/tests/containers/sqlcontainer/DatabaseHelper.java @@ -15,6 +15,8 @@ class DatabaseHelper { private JDBCConnectionPool connectionPool = null; private SQLContainer testContainer = null; private static final String TABLENAME = "testtable"; + private SQLContainer largeContainer = null; + private static final String LARGE_TABLENAME = "largetable"; public DatabaseHelper() { initConnectionPool(); @@ -32,24 +34,42 @@ class DatabaseHelper { // Will fail if table doesn't exist, which is OK. conn.rollback(); } + try { + statement.execute("drop table " + LARGE_TABLENAME); + } catch (SQLException e) { + // Will fail if table doesn't exist, which is OK. + conn.rollback(); + } switch (SQLTestsConstants.db) { case HSQLDB: statement .execute("create table " + TABLENAME + " (id integer GENERATED BY DEFAULT AS IDENTITY, field1 varchar(100), field2 boolean, primary key(id))"); + statement + .execute("create table " + + LARGE_TABLENAME + + " (id integer GENERATED BY DEFAULT AS IDENTITY, field1 varchar(100), primary key(id))"); break; case MYSQL: statement .execute("create table " + TABLENAME + " (id integer auto_increment not null, field1 varchar(100), field2 boolean, primary key(id))"); + statement + .execute("create table " + + LARGE_TABLENAME + + " (id integer auto_increment not null, field1 varchar(100), primary key(id))"); break; case POSTGRESQL: statement .execute("create table " + TABLENAME + " (\"id\" serial primary key, \"field1\" varchar(100), \"field2\" boolean)"); + statement + .execute("create table " + + LARGE_TABLENAME + + " (\"id\" serial primary key, \"field1\" varchar(100))"); break; } statement.executeUpdate("insert into " + TABLENAME @@ -58,6 +78,12 @@ class DatabaseHelper { + " values(default, 'Ville', 'true')"); statement.executeUpdate("insert into " + TABLENAME + " values(default, 'Jussi', 'true')"); + + for (int i = 0; i < 400; ++i) { + statement.executeUpdate("insert into " + LARGE_TABLENAME + + " values(default, 'User " + i + "')"); + } + statement.close(); conn.commit(); connectionPool.releaseConnection(conn); @@ -71,6 +97,10 @@ class DatabaseHelper { TableQuery q1 = new TableQuery(TABLENAME, connectionPool); q1.setVersionColumn("id"); testContainer = new SQLContainer(q1); + + TableQuery q2 = new TableQuery(LARGE_TABLENAME, connectionPool); + q2.setVersionColumn("id"); + largeContainer = new SQLContainer(q2); } catch (SQLException e) { e.printStackTrace(); } @@ -89,4 +119,8 @@ class DatabaseHelper { public SQLContainer getTestContainer() { return testContainer; } + + public SQLContainer getLargeContainer() { + return largeContainer; + } }
\ No newline at end of file |