From af2638fc57cf3d9f6dc84957bb6ee4b256ec60e7 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Wed, 22 Aug 2012 21:57:12 +0300 Subject: Removed readThrough/writeThrough in favor of buffered (#8180) --- .../components/AbstractTestFieldValueChange.java | 50 ++------------------ .../components/TestTextFieldValueChange.java | 53 ---------------------- 2 files changed, 5 insertions(+), 98 deletions(-) (limited to 'tests/server-side/com') 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 extends TestCase { */ public void testRemoveListener() { getField().setPropertyDataSource(new ObjectProperty("")); - 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 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("")); - getField().setWriteThrough(true); - getField().setReadThrough(true); + getField().setBuffered(false); expectValueChangeFromSetValueNotCommit(); } @@ -91,47 +89,9 @@ public abstract class AbstractTestFieldValueChange 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("")); - 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("")); - 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("")); - 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 @@ -77,59 +77,6 @@ public class TestTextFieldValueChange extends EasyMock.verify(getListener()); } - /** - * 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 property = new ObjectProperty( - 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. -- cgit v1.2.3