From fb8c447ca2f78923600426a76dba99e7875c4dc5 Mon Sep 17 00:00:00 2001 From: John Alhroos Date: Tue, 21 Aug 2012 06:57:12 +0000 Subject: Fix for Table multirow dragging issue #6217 + Testbench test svn changeset:24208/svn branch:6.8 --- .../components/table/CtrlShiftMultiselect.java | 2 + .../components/table/SelectionRangeDragging.html | 52 ++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 tests/testbench/com/vaadin/tests/components/table/SelectionRangeDragging.html (limited to 'tests') diff --git a/tests/testbench/com/vaadin/tests/components/table/CtrlShiftMultiselect.java b/tests/testbench/com/vaadin/tests/components/table/CtrlShiftMultiselect.java index 02f4af045b..b9e23930e4 100644 --- a/tests/testbench/com/vaadin/tests/components/table/CtrlShiftMultiselect.java +++ b/tests/testbench/com/vaadin/tests/components/table/CtrlShiftMultiselect.java @@ -5,6 +5,7 @@ import com.vaadin.data.Item; import com.vaadin.data.util.IndexedContainer; import com.vaadin.tests.components.TestBase; import com.vaadin.ui.Table; +import com.vaadin.ui.Table.TableDragMode; @SuppressWarnings("serial") public class CtrlShiftMultiselect extends TestBase { @@ -18,6 +19,7 @@ public class CtrlShiftMultiselect extends TestBase { table.setSelectable(true); table.setMultiSelect(true); + table.setDragMode(TableDragMode.MULTIROW); table.setWidth("400px"); table.setHeight("400px"); diff --git a/tests/testbench/com/vaadin/tests/components/table/SelectionRangeDragging.html b/tests/testbench/com/vaadin/tests/components/table/SelectionRangeDragging.html new file mode 100644 index 0000000000..1e911699d1 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/table/SelectionRangeDragging.html @@ -0,0 +1,52 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.table.CtrlShiftMultiselect?restartApplication
mouseClickvaadin=runcomvaadintestscomponentstableCtrlShiftMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[5]/domChild[1]/domChild[0]112,12
mouseClickvaadin=runcomvaadintestscomponentstableCtrlShiftMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[10]/domChild[1]/domChild[0]82,16:shift
dragvaadin=runcomvaadintestscomponentstableCtrlShiftMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[8]/domChild[1]/domChild[0]87,1
mouseMoveAtvaadin=runcomvaadintestscomponentstableCtrlShiftMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[0]700,210
screenCapturemultiple-rows-dragged
dropvaadin=runcomvaadintestscomponentstableCtrlShiftMultiselect::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[0]700,210
+ + -- cgit v1.2.3 From 3d0fe88e20584ebb378786784f1a446e6f081021 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Wed, 22 Aug 2012 15:46:51 +0000 Subject: More tests for #9145 svn changeset:24221/svn branch:6.8 --- .../sqlcontainer/generator/SQLGeneratorsTest.java | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) (limited to 'tests') diff --git a/tests/server-side/com/vaadin/data/util/sqlcontainer/generator/SQLGeneratorsTest.java b/tests/server-side/com/vaadin/data/util/sqlcontainer/generator/SQLGeneratorsTest.java index e62a06e6e1..b8df4b1799 100644 --- a/tests/server-side/com/vaadin/data/util/sqlcontainer/generator/SQLGeneratorsTest.java +++ b/tests/server-side/com/vaadin/data/util/sqlcontainer/generator/SQLGeneratorsTest.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.easymock.EasyMock; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -14,7 +15,9 @@ import com.vaadin.data.Container.Filter; import com.vaadin.data.util.filter.Like; import com.vaadin.data.util.filter.Or; import com.vaadin.data.util.sqlcontainer.AllTests; +import com.vaadin.data.util.sqlcontainer.ColumnProperty; import com.vaadin.data.util.sqlcontainer.DataGenerator; +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.connection.JDBCConnectionPool; @@ -147,6 +150,86 @@ public class SQLGeneratorsTest { .equals(sh.getQueryString())); } + @Test + public void generateUpdateQuery_severalPrimKeys_shouldSucceed() + throws SQLException { + /* + * No need to run this for Oracle/MSSQL generators since the + * DefaultSQLGenerator method would be called anyway. + */ + if (AllTests.sqlGen instanceof MSSQLGenerator + || AllTests.sqlGen instanceof OracleGenerator) { + return; + } + + DefaultSQLGenerator sqlGen = new DefaultSQLGenerator(); + + // Create situation wihere PrimKey is a composite of two columns... + ColumnProperty cp1 = new ColumnProperty("FIRSTPK", false, true, false, + true, new Integer(1), Integer.class); + ColumnProperty cp2 = new ColumnProperty("SECONDPK", false, true, false, + true, "primKeyValue", String.class); + ColumnProperty cp3 = new ColumnProperty("NONPK", false, true, false, + false, new Integer(1), Integer.class); + + SQLContainer container = EasyMock.createNiceMock(SQLContainer.class); + + RowItem ri = new RowItem(container, new RowId(new Object[] { 0L }), + Arrays.asList(cp1, cp2, cp3)); + + StatementHelper generateUpdateQuery = sqlGen.generateUpdateQuery( + "testTable", ri); + + String queryString = generateUpdateQuery.getQueryString(); + + // Assert that the WHERE-clause has both prim keys... + Assert.assertEquals( + "UPDATE testTable SET \"NONPK\" = ?, \"SECONDPK\" = ?, \"FIRSTPK\" = ? WHERE \"SECONDPK\" = ? AND \"FIRSTPK\" = ?", + queryString); + } + + @Test + public void generateUpdateQuery_severalPrimKeysAndVersion_shouldSucceed() + throws SQLException { + /* + * No need to run this for Oracle/MSSQL generators since the + * DefaultSQLGenerator method would be called anyway. + */ + if (AllTests.sqlGen instanceof MSSQLGenerator + || AllTests.sqlGen instanceof OracleGenerator) { + return; + } + + DefaultSQLGenerator sqlGen = new DefaultSQLGenerator(); + + // Create situation wihere PrimKey is a composite of two columns... + ColumnProperty cp1 = new ColumnProperty("FIRSTPK", false, true, false, + true, new Integer(1), Integer.class); + ColumnProperty cp2 = new ColumnProperty("SECONDPK", false, true, false, + true, "primKeyValue", String.class); + ColumnProperty cp3 = new ColumnProperty("NONPK", false, true, false, + false, new Integer(1), Integer.class); + ColumnProperty cp4 = new ColumnProperty("VERSION", false, true, false, + false, new Integer(1), Integer.class); + cp4.setVersionColumn(true); + + SQLContainer container = EasyMock.createNiceMock(SQLContainer.class); + + RowItem ri = new RowItem(container, new RowId(new Object[] { 0L }), + Arrays.asList(cp1, cp2, cp3, cp4)); + + StatementHelper generateUpdateQuery = sqlGen.generateUpdateQuery( + "testTable", ri); + + String queryString = generateUpdateQuery.getQueryString(); + + // Assert that the WHERE-clause has both prim keys and version... + // Version should not be in SET... + Assert.assertEquals( + "UPDATE testTable SET \"NONPK\" = ?, \"SECONDPK\" = ?, \"FIRSTPK\" = ? WHERE \"VERSION\" = ? AND \"SECONDPK\" = ? AND \"FIRSTPK\" = ?", + queryString); + } + @Test public void generateInsertQuery_basicQuery_shouldSucceed() throws SQLException { -- cgit v1.2.3 From 9a32e217f2cb89887b2a46934b992ff32e880ba1 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Thu, 23 Aug 2012 08:11:14 +0000 Subject: Revert 24221 for now, the test does not work reliably svn changeset:24223/svn branch:6.8 --- .../sqlcontainer/generator/SQLGeneratorsTest.java | 83 ---------------------- 1 file changed, 83 deletions(-) (limited to 'tests') diff --git a/tests/server-side/com/vaadin/data/util/sqlcontainer/generator/SQLGeneratorsTest.java b/tests/server-side/com/vaadin/data/util/sqlcontainer/generator/SQLGeneratorsTest.java index b8df4b1799..e62a06e6e1 100644 --- a/tests/server-side/com/vaadin/data/util/sqlcontainer/generator/SQLGeneratorsTest.java +++ b/tests/server-side/com/vaadin/data/util/sqlcontainer/generator/SQLGeneratorsTest.java @@ -5,7 +5,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import org.easymock.EasyMock; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -15,9 +14,7 @@ import com.vaadin.data.Container.Filter; import com.vaadin.data.util.filter.Like; import com.vaadin.data.util.filter.Or; import com.vaadin.data.util.sqlcontainer.AllTests; -import com.vaadin.data.util.sqlcontainer.ColumnProperty; import com.vaadin.data.util.sqlcontainer.DataGenerator; -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.connection.JDBCConnectionPool; @@ -150,86 +147,6 @@ public class SQLGeneratorsTest { .equals(sh.getQueryString())); } - @Test - public void generateUpdateQuery_severalPrimKeys_shouldSucceed() - throws SQLException { - /* - * No need to run this for Oracle/MSSQL generators since the - * DefaultSQLGenerator method would be called anyway. - */ - if (AllTests.sqlGen instanceof MSSQLGenerator - || AllTests.sqlGen instanceof OracleGenerator) { - return; - } - - DefaultSQLGenerator sqlGen = new DefaultSQLGenerator(); - - // Create situation wihere PrimKey is a composite of two columns... - ColumnProperty cp1 = new ColumnProperty("FIRSTPK", false, true, false, - true, new Integer(1), Integer.class); - ColumnProperty cp2 = new ColumnProperty("SECONDPK", false, true, false, - true, "primKeyValue", String.class); - ColumnProperty cp3 = new ColumnProperty("NONPK", false, true, false, - false, new Integer(1), Integer.class); - - SQLContainer container = EasyMock.createNiceMock(SQLContainer.class); - - RowItem ri = new RowItem(container, new RowId(new Object[] { 0L }), - Arrays.asList(cp1, cp2, cp3)); - - StatementHelper generateUpdateQuery = sqlGen.generateUpdateQuery( - "testTable", ri); - - String queryString = generateUpdateQuery.getQueryString(); - - // Assert that the WHERE-clause has both prim keys... - Assert.assertEquals( - "UPDATE testTable SET \"NONPK\" = ?, \"SECONDPK\" = ?, \"FIRSTPK\" = ? WHERE \"SECONDPK\" = ? AND \"FIRSTPK\" = ?", - queryString); - } - - @Test - public void generateUpdateQuery_severalPrimKeysAndVersion_shouldSucceed() - throws SQLException { - /* - * No need to run this for Oracle/MSSQL generators since the - * DefaultSQLGenerator method would be called anyway. - */ - if (AllTests.sqlGen instanceof MSSQLGenerator - || AllTests.sqlGen instanceof OracleGenerator) { - return; - } - - DefaultSQLGenerator sqlGen = new DefaultSQLGenerator(); - - // Create situation wihere PrimKey is a composite of two columns... - ColumnProperty cp1 = new ColumnProperty("FIRSTPK", false, true, false, - true, new Integer(1), Integer.class); - ColumnProperty cp2 = new ColumnProperty("SECONDPK", false, true, false, - true, "primKeyValue", String.class); - ColumnProperty cp3 = new ColumnProperty("NONPK", false, true, false, - false, new Integer(1), Integer.class); - ColumnProperty cp4 = new ColumnProperty("VERSION", false, true, false, - false, new Integer(1), Integer.class); - cp4.setVersionColumn(true); - - SQLContainer container = EasyMock.createNiceMock(SQLContainer.class); - - RowItem ri = new RowItem(container, new RowId(new Object[] { 0L }), - Arrays.asList(cp1, cp2, cp3, cp4)); - - StatementHelper generateUpdateQuery = sqlGen.generateUpdateQuery( - "testTable", ri); - - String queryString = generateUpdateQuery.getQueryString(); - - // Assert that the WHERE-clause has both prim keys and version... - // Version should not be in SET... - Assert.assertEquals( - "UPDATE testTable SET \"NONPK\" = ?, \"SECONDPK\" = ?, \"FIRSTPK\" = ? WHERE \"VERSION\" = ? AND \"SECONDPK\" = ? AND \"FIRSTPK\" = ?", - queryString); - } - @Test public void generateInsertQuery_basicQuery_shouldSucceed() throws SQLException { -- cgit v1.2.3