diff options
author | Artur Signell <artur@vaadin.com> | 2012-08-22 21:57:12 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2012-08-22 22:24:31 +0300 |
commit | af2638fc57cf3d9f6dc84957bb6ee4b256ec60e7 (patch) | |
tree | 20081d6ad4bcd90b9fe42814f9fe8c61d643cfae /tests | |
parent | 098957c08507449e34fd64618d4964ee0b030eba (diff) | |
download | vaadin-framework-af2638fc57cf3d9f6dc84957bb6ee4b256ec60e7.tar.gz vaadin-framework-af2638fc57cf3d9f6dc84957bb6ee4b256ec60e7.zip |
Removed readThrough/writeThrough in favor of buffered (#8180)
Diffstat (limited to 'tests')
13 files changed, 20 insertions, 117 deletions
diff --git a/tests/server-side/com/vaadin/tests/server/components/AbstractTestFieldValueChange.java b/tests/server-side/com/vaadin/tests/server/components/AbstractTestFieldValueChange.java index 3512f555c9..f2de4f3c04 100644 --- a/tests/server-side/com/vaadin/tests/server/components/AbstractTestFieldValueChange.java +++ b/tests/server-side/com/vaadin/tests/server/components/AbstractTestFieldValueChange.java @@ -42,8 +42,7 @@ public abstract class AbstractTestFieldValueChange<T> extends TestCase { */ public void testRemoveListener() { getField().setPropertyDataSource(new ObjectProperty<String>("")); - getField().setWriteThrough(true); - getField().setReadThrough(true); + getField().setBuffered(false); // Expectations and start test listener.valueChange(EasyMock.isA(ValueChangeEvent.class)); @@ -76,10 +75,9 @@ public abstract class AbstractTestFieldValueChange<T> extends TestCase { * Field value change notifications closely mirror value changes of the data * source behind the field. */ - public void testWriteThroughReadThrough() { + public void testNonBuffered() { getField().setPropertyDataSource(new ObjectProperty<String>("")); - getField().setWriteThrough(true); - getField().setReadThrough(true); + getField().setBuffered(false); expectValueChangeFromSetValueNotCommit(); } @@ -91,47 +89,9 @@ public abstract class AbstractTestFieldValueChange<T> extends TestCase { * Field value change notifications reflect the buffered value in the field, * not the original data source value changes. */ - public void testNoWriteThroughNoReadThrough() { + public void testBuffered() { getField().setPropertyDataSource(new ObjectProperty<String>("")); - getField().setWriteThrough(false); - getField().setReadThrough(false); - - expectValueChangeFromSetValueNotCommit(); - } - - /** - * Less common partly buffered case: writeThrough (auto-commit) is on and - * readThrough is off. Calling commit() should not cause notifications. - * - * Without readThrough activated, changes to the data source that do not - * cause notifications are not reflected by the field value. - * - * Field value change notifications correspond to changes made to the data - * source value through the text field or the (notifying) property. - */ - public void testWriteThroughNoReadThrough() { - getField().setPropertyDataSource(new ObjectProperty<String>("")); - getField().setWriteThrough(true); - getField().setReadThrough(false); - - expectValueChangeFromSetValueNotCommit(); - } - - /** - * Partly buffered use where the data source is read but not nor modified - * during editing, and is updated at commit(). - * - * When used like this, a field is updated from the data source if necessary - * when its value is requested and the property value has changed but the - * field has not been modified in its buffer. - * - * Field value change notifications reflect the buffered value in the field, - * not the original data source value changes. - */ - public void testNoWriteThroughReadThrough() { - getField().setPropertyDataSource(new ObjectProperty<String>("")); - getField().setWriteThrough(false); - getField().setReadThrough(true); + getField().setBuffered(true); expectValueChangeFromSetValueNotCommit(); } diff --git a/tests/server-side/com/vaadin/tests/server/components/TestTextFieldValueChange.java b/tests/server-side/com/vaadin/tests/server/components/TestTextFieldValueChange.java index f5db67be97..de838e339c 100644 --- a/tests/server-side/com/vaadin/tests/server/components/TestTextFieldValueChange.java +++ b/tests/server-side/com/vaadin/tests/server/components/TestTextFieldValueChange.java @@ -78,59 +78,6 @@ public class TestTextFieldValueChange extends } /** - * If read through is on and value has been modified, but not committed, the - * value should not propagate similar to - * {@link #testValueChangeEventPropagationWithReadThrough()} - * - * TODO make test field type agnostic (eg. combobox) - */ - public void testValueChangePropagationWithReadThroughWithModifiedValue() { - final String initialValue = "initial"; - ObjectProperty<String> property = new ObjectProperty<String>( - initialValue); - getField().setPropertyDataSource(property); - - // write buffering on, read buffering off - getField().setWriteThrough(false); - getField().setReadThrough(true); - - // Expect no value changes calls to listener - EasyMock.replay(getListener()); - - // first set the value (note, write through false -> not forwarded to - // property) - setValue(getField()); - - Assert.assertTrue(getField().isModified()); - - // Add listener and set the value -> should end up in listener once - getField().addListener(getListener()); - - // modify property value, should not fire value change in field as the - // field has uncommitted value (aka isModified() == true) - property.setValue("Foo"); - - // Ensure listener was called once - EasyMock.verify(getListener()); - - // get value should not fire value change again - Object value = getField().getValue(); - // Ensure listener still has been called only once - EasyMock.verify(getListener()); - - // field value should be different from the original value and current - // proeprty value - boolean isValueEqualToInitial = value.equals(initialValue); - Assert.assertFalse(isValueEqualToInitial); - boolean isValueEqualToPropertyValue = value.equals(property.getValue()); - Assert.assertFalse(isValueEqualToPropertyValue); - - // Ensure listener has not been called - EasyMock.verify(getListener()); - - } - - /** * Value change events from property should not propagate if read through is * false. Execpt when the property is being set. * diff --git a/tests/testbench/com/vaadin/tests/components/abstractfield/AbstractFieldCommitWithInvalidValues.java b/tests/testbench/com/vaadin/tests/components/abstractfield/AbstractFieldCommitWithInvalidValues.java index aa630c79fd..0aaa7c5f13 100644 --- a/tests/testbench/com/vaadin/tests/components/abstractfield/AbstractFieldCommitWithInvalidValues.java +++ b/tests/testbench/com/vaadin/tests/components/abstractfield/AbstractFieldCommitWithInvalidValues.java @@ -28,7 +28,7 @@ public class AbstractFieldCommitWithInvalidValues extends TestBase { tf = new TextField("A field, must contain 1-2 chars", new ObjectProperty<String>("a")); tf.addValidator(new StringLengthValidator("Invalid length", 1, 2, false)); - tf.setWriteThrough(false); + tf.setBuffered(true); tf.setRequired(true); Button b = new Button("Commit", new ClickListener() { diff --git a/tests/testbench/com/vaadin/tests/components/customfield/AddressField.java b/tests/testbench/com/vaadin/tests/components/customfield/AddressField.java index a3ee89b3ee..2daeb7bf25 100644 --- a/tests/testbench/com/vaadin/tests/components/customfield/AddressField.java +++ b/tests/testbench/com/vaadin/tests/components/customfield/AddressField.java @@ -34,7 +34,7 @@ public class AddressField extends CustomField<Address> { addressForm = new Form(); } addressForm.setCaption("Address"); - addressForm.setWriteThrough(false); + addressForm.setBuffered(true); // make sure field changes are sent early addressForm.setImmediate(true); diff --git a/tests/testbench/com/vaadin/tests/components/customfield/NestedPersonForm.java b/tests/testbench/com/vaadin/tests/components/customfield/NestedPersonForm.java index 0655c09102..9b40074433 100644 --- a/tests/testbench/com/vaadin/tests/components/customfield/NestedPersonForm.java +++ b/tests/testbench/com/vaadin/tests/components/customfield/NestedPersonForm.java @@ -31,7 +31,7 @@ public class NestedPersonForm extends Form { beanItem = new BeanItem<Person>(person); setCaption("Update person details"); - setWriteThrough(false); + setBuffered(true); setFormFieldFactory(new PersonFieldFactory()); // set the data source and the visible fields // Note that if the nested form is the first or last field in the parent diff --git a/tests/testbench/com/vaadin/tests/components/datefield/CommitInvalid.java b/tests/testbench/com/vaadin/tests/components/datefield/CommitInvalid.java index c4f001ac41..e24f4753ff 100644 --- a/tests/testbench/com/vaadin/tests/components/datefield/CommitInvalid.java +++ b/tests/testbench/com/vaadin/tests/components/datefield/CommitInvalid.java @@ -41,7 +41,7 @@ public class CommitInvalid extends TestBase { * Create and configure form. */ final Form form = new Form(); - form.setWriteThrough(false); // set write buffering on + form.setBuffered(true); // set write buffering on form.setImmediate(true); // make form (and especially its fields // immediate) @@ -132,8 +132,8 @@ public class CommitInvalid extends TestBase { } private void printState() { - log.log("Date. Field: " + f((Date) dateField.getValue()) - + " Property: " + f(dateProperty.getValue())); + log.log("Date. Field: " + f(dateField.getValue()) + " Property: " + + f(dateProperty.getValue())); log.log("Integer: Field: " + integerField.getValue() + " Property: " + integerProperty.getValue()); } diff --git a/tests/testbench/com/vaadin/tests/components/datefield/DateFieldInSubWindow.java b/tests/testbench/com/vaadin/tests/components/datefield/DateFieldInSubWindow.java index 2a7807670b..85f1c80a08 100644 --- a/tests/testbench/com/vaadin/tests/components/datefield/DateFieldInSubWindow.java +++ b/tests/testbench/com/vaadin/tests/components/datefield/DateFieldInSubWindow.java @@ -88,7 +88,7 @@ public class DateFieldInSubWindow extends AbstractTestCase { final Form generalForm = new Form(); { generalForm.setCaption("My form"); - generalForm.setWriteThrough(true); + generalForm.setBuffered(false); generalForm.setFormFieldFactory(fieldFactory); BeanItem<MyBean> myBeanItem = new BeanItem<MyBean>(myBean); diff --git a/tests/testbench/com/vaadin/tests/components/datefield/DateFieldRangeValidation.java b/tests/testbench/com/vaadin/tests/components/datefield/DateFieldRangeValidation.java index befdd65693..484b9cfee8 100644 --- a/tests/testbench/com/vaadin/tests/components/datefield/DateFieldRangeValidation.java +++ b/tests/testbench/com/vaadin/tests/components/datefield/DateFieldRangeValidation.java @@ -125,8 +125,7 @@ public class DateFieldRangeValidation extends TestBase { PopupDateField df = new PopupDateField(); df.setLocale(new Locale("en", "US")); df.setResolution(Resolution.DAY); - df.setWriteThrough(true); - df.setReadThrough(true); + df.setBuffered(false); df.setImmediate(true); return df; } diff --git a/tests/testbench/com/vaadin/tests/components/select/SelectDisplaysOldValue.java b/tests/testbench/com/vaadin/tests/components/select/SelectDisplaysOldValue.java index b9ae958a03..77c187ff60 100644 --- a/tests/testbench/com/vaadin/tests/components/select/SelectDisplaysOldValue.java +++ b/tests/testbench/com/vaadin/tests/components/select/SelectDisplaysOldValue.java @@ -121,8 +121,7 @@ public class SelectDisplaysOldValue extends TestBase { controllerComboBox.setNullSelectionAllowed(false); controllerComboBox.setNewItemsAllowed(false); controllerComboBox.setImmediate(true); - controllerComboBox.setWriteThrough(false); - controllerComboBox.setReadThrough(false); + controllerComboBox.setBuffered(true); } @@ -131,8 +130,7 @@ public class SelectDisplaysOldValue extends TestBase { slaveComboBox.setNullSelectionAllowed(false); slaveComboBox.setNewItemsAllowed(false); slaveComboBox.setImmediate(true); - slaveComboBox.setWriteThrough(false); - slaveComboBox.setReadThrough(false); + slaveComboBox.setBuffered(true); } private void refreshSlaveDropdown(Integer masterId) { diff --git a/tests/testbench/com/vaadin/tests/components/textfield/OutOfSyncIssueWithKeyboardShortcut.java b/tests/testbench/com/vaadin/tests/components/textfield/OutOfSyncIssueWithKeyboardShortcut.java index 89f9ffda40..955a9c2772 100644 --- a/tests/testbench/com/vaadin/tests/components/textfield/OutOfSyncIssueWithKeyboardShortcut.java +++ b/tests/testbench/com/vaadin/tests/components/textfield/OutOfSyncIssueWithKeyboardShortcut.java @@ -70,7 +70,7 @@ public class OutOfSyncIssueWithKeyboardShortcut extends TestBase { form.setImmediate(true); // this is critical for the problem to occur - form.setWriteThrough(false); + form.setBuffered(true); HorizontalLayout footer = new HorizontalLayout(); footer.setSpacing(true); diff --git a/tests/testbench/com/vaadin/tests/containers/sqlcontainer/CheckboxUpdateProblem.java b/tests/testbench/com/vaadin/tests/containers/sqlcontainer/CheckboxUpdateProblem.java index f34c12607a..537c9be973 100644 --- a/tests/testbench/com/vaadin/tests/containers/sqlcontainer/CheckboxUpdateProblem.java +++ b/tests/testbench/com/vaadin/tests/containers/sqlcontainer/CheckboxUpdateProblem.java @@ -76,7 +76,7 @@ public class CheckboxUpdateProblem extends Application.LegacyApplication private TestForm() { setSizeFull(); - setWriteThrough(false); + setBuffered(true); setInvalidCommitted(false); save = new Button("Save", this); diff --git a/tests/testbench/com/vaadin/tests/layouts/TestAbsoluteLayout.java b/tests/testbench/com/vaadin/tests/layouts/TestAbsoluteLayout.java index d2f14c114e..33fa0558e7 100644 --- a/tests/testbench/com/vaadin/tests/layouts/TestAbsoluteLayout.java +++ b/tests/testbench/com/vaadin/tests/layouts/TestAbsoluteLayout.java @@ -271,14 +271,14 @@ public class TestAbsoluteLayout extends TestBase { addComponent(addComp); componentEditor = new Form(); - componentEditor.setWriteThrough(false); + componentEditor.setBuffered(true); componentEditor.setCaption("Component properties:"); componentEditor.setFormFieldFactory(MFieldFactory.get()); addComponent(componentEditor); positionEditor = new Form(); positionEditor.setCaption("Component position"); - positionEditor.setWriteThrough(false); + positionEditor.setBuffered(true); positionEditor.setFormFieldFactory(MFieldFactory.get()); addComponent(positionEditor); diff --git a/tests/testbench/com/vaadin/tests/tickets/Ticket1806.java b/tests/testbench/com/vaadin/tests/tickets/Ticket1806.java index 2c979f4600..fa572039aa 100644 --- a/tests/testbench/com/vaadin/tests/tickets/Ticket1806.java +++ b/tests/testbench/com/vaadin/tests/tickets/Ticket1806.java @@ -17,8 +17,7 @@ public class Ticket1806 extends com.vaadin.Application.LegacyApplication { final ObjectProperty<String> prop = new ObjectProperty<String>(""); final TextField tf1 = new TextField( "Buffered TextField bound to ObjectProperty"); - tf1.setWriteThrough(false); - tf1.setReadThrough(false); + tf1.setBuffered(true); tf1.setPropertyDataSource(prop); main.addComponent(tf1); main.addComponent(new Button( |