LGTM

Thanks!

On Sun, Oct 3, 2010 at 4:46 PM, <b...@google.com> wrote:

> Reviewers: rjrjr,
>
> Description:
> Fix ClassCastException in AbtstractRequestContext.isChanged();
> Patch by: bobv
> Review by: rjrjr
>
>
> Please review this at http://gwt-code-reviews.appspot.com/931803/show
>
> Affected files:
>  M
> user/src/com/google/gwt/requestfactory/client/impl/AbstractRequestContext.java
>  M user/test/com/google/gwt/requestfactory/client/RequestFactoryTest.java
>
>
> Index:
> user/src/com/google/gwt/requestfactory/client/impl/AbstractRequestContext.java
> ===================================================================
> ---
> user/src/com/google/gwt/requestfactory/client/impl/AbstractRequestContext.java
>      (revision 8926)
> +++
> user/src/com/google/gwt/requestfactory/client/impl/AbstractRequestContext.java
>      (working copy)
> @@ -142,13 +142,13 @@
>     /*
>      * NB: Don't use the presence of ephemeral objects for this test.
>      *
> -     * Diffing the objects until one is found to be different. It's not
> just a
> +     * Diff the objects until one is found to be different. It's not just
> a
>      * simple flag-check because of the possibility of "unmaking" a change,
> per
>      * the JavaDoc.
>      */
>     for (EntityProxy edited : seenProxies.values()) {
>       AutoBean<EntityProxy> bean = AutoBeanUtils.getAutoBean(edited);
> -      AutoBean<?> previous = AutoBeanUtils.getAutoBean((EntityProxy)
> bean.getTag(PARENT_OBJECT));
> +      AutoBean<?> previous = bean.getTag(PARENT_OBJECT);
>       if (previous == null) {
>         // Compare to empty object
>         previous = getRequestFactory().getAutoBeanFactory().create(
> Index:
> user/test/com/google/gwt/requestfactory/client/RequestFactoryTest.java
> ===================================================================
> --- user/test/com/google/gwt/requestfactory/client/RequestFactoryTest.java
>      (revision 8926)
> +++ user/test/com/google/gwt/requestfactory/client/RequestFactoryTest.java
>      (working copy)
> @@ -190,7 +190,6 @@
>
>   /**
>    * Test that we can commit child objects.
> -
>    */
>   public void testCascadingCommit() {
>     delayTestFinish(5000);
> @@ -237,6 +236,40 @@
>     // Undo the change
>     foo.setCharField(null);
>     assertFalse(context.isChanged());
> +  }
> +
> +  public void testChangedEdit() {
> +    delayTestFinish(5000);
> +    simpleFooRequest().findSimpleFooById(1L).fire(
> +        new Receiver<SimpleFooProxy>() {
> +
> +          @Override
> +          public void onSuccess(SimpleFooProxy foo) {
> +            SimpleFooRequest context = simpleFooRequest();
> +
> +            // edit() doesn't cause a change
> +            foo = context.edit(foo);
> +            assertFalse(context.isChanged());
> +
> +            final String newName = "something else;";
> +            String oldName = foo.getUserName();
> +            assertFalse("Don't accidentally set the same name",
> +                newName.equals(oldName));
> +
> +            // gets don't cause a change
> +            assertFalse(context.isChanged());
> +
> +            // Change
> +            foo.setUserName(newName);
> +            assertTrue(context.isChanged());
> +
> +            // Undo the change
> +            foo.setUserName(oldName);
> +            assertFalse(context.isChanged());
> +
> +            finishTestAndReset();
> +          }
> +        });
>   }
>
>   public void testClassToken() {
>
>
>

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to