Package com.google.web.bindery.requestfactory.shared

Examples of com.google.web.bindery.requestfactory.shared.SimpleFooRequest.create()


    simpleFooRequest().findSimpleFooById(999L).fire(new Receiver<SimpleFooProxy>() {
      @Override
      public void onSuccess(SimpleFooProxy response) {
        response = checkSerialization(response);
        SimpleFooRequest context = simpleFooRequest();
        SimpleBarProxy bar = context.create(SimpleBarProxy.class);
        Request<String> helloReq = context.hello(bar).using(response);
        bar = context.edit(bar);
        bar.setUserName("BAR");
        helloReq.fire(new Receiver<String>() {
          @Override
View Full Code Here


  public void testServerFailureCheckedException() {
    delayTestFinish(DELAY_TEST_FINISH);

    SimpleFooRequest context = simpleFooRequest();
    SimpleFooProxy newFoo = context.create(SimpleFooProxy.class);
    final Request<SimpleFooProxy> persistRequest = context.persistAndReturnSelf().using(newFoo);
    final SimpleFooProxy mutableFoo = context.edit(newFoo);
    // 43 is the crash causing magic number for a checked exception
    mutableFoo.setPleaseCrash(43);
    persistRequest.fire(new SimpleFooFailureReceiver(mutableFoo, persistRequest, null));
View Full Code Here

  }

  public void testServerFailureRuntimeException() {
    delayTestFinish(DELAY_TEST_FINISH);
    SimpleFooRequest context = simpleFooRequest();
    SimpleFooProxy newFoo = context.create(SimpleFooProxy.class);
    final Request<SimpleFooProxy> persistRequest = context.persistAndReturnSelf().using(newFoo);
    final SimpleFooProxy mutableFoo = context.edit(newFoo);
    // 42 is the crash causing magic number for a runtime exception
    mutableFoo.setPleaseCrash(42);
    persistRequest.fire(new SimpleFooFailureReceiver(mutableFoo, persistRequest, null));
View Full Code Here

  /**
   * Tests the behaviors of setters and their effects on getters.
   */
  public void testSetters() {
    SimpleFooRequest context = simpleFooRequest();
    SimpleFooProxy foo = context.create(SimpleFooProxy.class);
    SimpleBarProxy bar = context.create(SimpleBarProxy.class);

    // Assert that uninitalize references are null
    assertNull(foo.getBarField());

View Full Code Here

   * Tests the behaviors of setters and their effects on getters.
   */
  public void testSetters() {
    SimpleFooRequest context = simpleFooRequest();
    SimpleFooProxy foo = context.create(SimpleFooProxy.class);
    SimpleBarProxy bar = context.create(SimpleBarProxy.class);

    // Assert that uninitalize references are null
    assertNull(foo.getBarField());

    // Assert that objects are mutable after creation
View Full Code Here

   * There's plenty of special-case code for Collection properties, so they need
   * to be tested as well.
   */
  public void testSettersWithCollections() {
    SimpleFooRequest context = simpleFooRequest();
    SimpleFooProxy foo = context.create(SimpleFooProxy.class);
    SimpleBarProxy bar = context.create(SimpleBarProxy.class);
    List<SimpleBarProxy> originalList = Collections.singletonList(bar);

    // Assert that uninitalize references are null
    assertNull(foo.getOneToManyField());
View Full Code Here

   * to be tested as well.
   */
  public void testSettersWithCollections() {
    SimpleFooRequest context = simpleFooRequest();
    SimpleFooProxy foo = context.create(SimpleFooProxy.class);
    SimpleBarProxy bar = context.create(SimpleBarProxy.class);
    List<SimpleBarProxy> originalList = Collections.singletonList(bar);

    // Assert that uninitalize references are null
    assertNull(foo.getOneToManyField());

View Full Code Here

            SimpleFooRequest context = simpleFooRequest();

            foo = context.edit(foo);

            // Create
            SimpleValueProxy created = context.create(SimpleValueProxy.class);
            created.setNumber(42);
            created.setString("Hello world!");
            created.setSimpleFoo(foo);

            // That proxy is a "clone" of the 'create' one
View Full Code Here

            created.setNumber(42);
            created.setString("Hello world!");
            created.setSimpleFoo(foo);

            // That proxy is a "clone" of the 'create' one
            SimpleValueProxy other = context.create(SimpleValueProxy.class);
            other.setNumber(42);
            other.setString("Hello world!");
            other.setSimpleFoo(foo);

            // Test cycles in value
View Full Code Here

                assertFalse(context.isChanged());

                // Change to another value proxy causes a change
                // Note that create() doesn't cause a change, see testChangedCreate
                SimpleValueProxy old = foo.getSimpleValue();
                SimpleValueProxy created = context.create(SimpleValueProxy.class);
                foo.setSimpleValue(created);
                assertTrue(context.isChanged());

                // An equivalent value proxy reverts the change
                foo.setSimpleValue(old.getSimpleValue().get(1));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.