summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJonatan Kronqvist <jonatan.kronqvist@itmill.com>2011-09-08 10:53:55 +0000
committerJonatan Kronqvist <jonatan.kronqvist@itmill.com>2011-09-08 10:53:55 +0000
commite21098304736e32a74f359e8dfb80e587337085d (patch)
tree4de8044ae3e45b123a591eda9c54a80f109aef9c /tests
parent5fc9f775f3b256c31204cc681c640513559184c9 (diff)
downloadvaadin-framework-e21098304736e32a74f359e8dfb80e587337085d.tar.gz
vaadin-framework-e21098304736e32a74f359e8dfb80e587337085d.zip
Applied patch fixing #7391
svn changeset:20926/svn branch:6.7
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/vaadin/tests/server/container/sqlcontainer/SQLContainerTableQueryTest.java31
1 files changed, 29 insertions, 2 deletions
diff --git a/tests/src/com/vaadin/tests/server/container/sqlcontainer/SQLContainerTableQueryTest.java b/tests/src/com/vaadin/tests/server/container/sqlcontainer/SQLContainerTableQueryTest.java
index af9cdbf306..0451607e64 100644
--- a/tests/src/com/vaadin/tests/server/container/sqlcontainer/SQLContainerTableQueryTest.java
+++ b/tests/src/com/vaadin/tests/server/container/sqlcontainer/SQLContainerTableQueryTest.java
@@ -19,14 +19,12 @@ import com.vaadin.data.Container.ItemSetChangeListener;
import com.vaadin.data.Item;
import com.vaadin.data.util.filter.Like;
import com.vaadin.data.util.sqlcontainer.RowId;
-import com.vaadin.data.util.sqlcontainer.RowItem;
import com.vaadin.data.util.sqlcontainer.SQLContainer;
import com.vaadin.data.util.sqlcontainer.TemporaryRowId;
import com.vaadin.data.util.sqlcontainer.connection.JDBCConnectionPool;
import com.vaadin.data.util.sqlcontainer.connection.SimpleJDBCConnectionPool;
import com.vaadin.data.util.sqlcontainer.query.OrderBy;
import com.vaadin.data.util.sqlcontainer.query.TableQuery;
-import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.tests.server.container.sqlcontainer.AllTests.DB;
public class SQLContainerTableQueryTest {
@@ -146,6 +144,35 @@ public class SQLContainerTableQueryTest {
}
@Test
+ public void getItem_commitedModifiedAndRefreshed() throws SQLException {
+ String OLD_VALUE = "SomeValue"; //$NON-NLS-1$
+ String NEW_VALUE = "OtherValue"; //$NON-NLS-1$
+
+ SQLContainer container = new SQLContainer(new TableQuery("people", //$NON-NLS-1$
+ connectionPool, AllTests.sqlGen));
+ Object itemID = container.addItem();
+ Item item = container.getItem(itemID);
+ item.getItemProperty("NAME").setValue(OLD_VALUE); //$NON-NLS-1$
+ container.commit();
+
+ itemID = container.getIdByIndex(container.size() - 1);
+ item = container.getItem(itemID);
+ Assert.assertEquals(OLD_VALUE, item.getItemProperty("NAME") //$NON-NLS-1$
+ .getValue());
+ item.getItemProperty("NAME").setValue(NEW_VALUE); //$NON-NLS-1$
+
+ // refresh the container which free's the caches
+ // and the modified cache keeps untouched which is a really powerful
+ // feature
+ container.refresh();
+
+ // access the item again will use the item from the modified cache.
+ item = container.getItem(itemID);
+ Assert.assertEquals(NEW_VALUE, item.getItemProperty("NAME") //$NON-NLS-1$
+ .getValue());
+ }
+
+ @Test
public void getItem_table5000RowsWithParameter1337_returnsItemWithId1337()
throws SQLException {
DataGenerator.addFiveThousandPeople(connectionPool);