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

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


  public void testViolationAbsent() {
    delayTestFinish(DELAY_TEST_FINISH);

    SimpleFooRequest context = simpleFooRequest();
    SimpleFooProxy newFoo = context.create(SimpleFooProxy.class);
    final Request<Void> fooReq = context.persist().using(newFoo);

    newFoo = context.edit(newFoo);
    newFoo.setUserName("Amit"); // will not cause violation.

    fooReq.fire(new Receiver<Void>() {
View Full Code Here


  public void testViolationsOnCreateVoidReturn() {
    delayTestFinish(DELAY_TEST_FINISH);

    SimpleFooRequest context = simpleFooRequest();
    SimpleFooProxy newFoo = context.create(SimpleFooProxy.class);
    final Request<Void> create = context.persist().using(newFoo);
    new FailFixAndRefire<Void>(newFoo, context, create).doVoidTest();
  }

  public void testViolationsOnEdit() {
    delayTestFinish(DELAY_TEST_FINISH);
View Full Code Here

    fooCreationRequest().fire(new Receiver<SimpleFooProxy>() {
      @Override
      public void onSuccess(SimpleFooProxy returned) {
        returned = checkSerialization(returned);
        SimpleFooRequest context = simpleFooRequest();
        Request<Void> editRequest = context.persist().using(returned);
        new FailFixAndRefire<Void>(returned, context, editRequest).doVoidTest();
      }
    });
  }
View Full Code Here

            newFoo = checkSerialization(newFoo);
            // no events are fired second time.
            assertEquals(1, handler.updateEventCount);
            assertEquals(1, handler.totalEventCount);
            SimpleFooRequest context = req.simpleFooRequest();
            final Request<Void> mutateRequest = context.persist().using(newFoo);
            newFoo = context.edit(newFoo);
            newFoo.setUserName("Ray");
            mutateRequest.fire(new Receiver<Void>() {
              @Override
              public void onSuccess(Void response) {
View Full Code Here

          public void onSuccess(SimpleFooProxy response) {
            response = checkSerialization(response);

            // Found the foo, edit it
            SimpleFooRequest context = simpleFooRequest();
            Request<Void> fooReq = context.persist().using(response);
            response = context.edit(response);
            response.setBarField(persistedBar);
            fooReq.fire(new Receiver<Void>() {
              @Override
              public void onSuccess(Void response) {
View Full Code Here

  public void testPersistNewEntityExistingRelation() {
    delayTestFinish(DELAY_TEST_FINISH);

    SimpleFooRequest context = simpleFooRequest();
    SimpleFooProxy newFoo = context.edit(context.create(SimpleFooProxy.class));
    final Request<Void> fooReq = context.persist().using(newFoo);

    newFoo.setUserName("Ray");

    final SimpleFooProxy finalFoo = newFoo;
    simpleBarRequest().findSimpleBarById("999L").fire(new Receiver<SimpleBarProxy>() {
View Full Code Here

          public void onSuccess(SimpleBarProxy response) {
            final SimpleBarProxy persistedBar = checkSerialization(response);

            assertEquals("Ray", persistedFoo.getUserName());
            SimpleFooRequest context = simpleFooRequest();
            final Request<Void> fooReq2 = context.persist().using(persistedFoo);
            SimpleFooProxy editablePersistedFoo = context.edit(persistedFoo);
            editablePersistedFoo.setBarField(persistedBar);
            fooReq2.fire(new Receiver<Void>() {
              @Override
              public void onSuccess(Void response) {
View Full Code Here

    SimpleFooRequest context = req.simpleFooRequest();
    SimpleFooProxy newFoo = context.create(SimpleFooProxy.class);

    context.returnNullString().to(count);
    context.persist().using(newFoo).to(new ThrowingReceiver<Void>(exception1));
    context.returnNullString().to(count);

    final SimpleFooProxy mutableFoo = context.edit(newFoo);
    // 42 is the crash causing magic number for a runtime exception
    mutableFoo.setPleaseCrash(42);
View Full Code Here

    SimpleFooRequest context = req.simpleFooRequest();
    SimpleFooProxy newFoo = context.create(SimpleFooProxy.class);
    newFoo.setUserName("a"); // too short

    context.returnNullString().to(count);
    context.persist().using(newFoo).to(new ThrowingReceiver<Void>(exception1));
    context.returnNullString().to(count);

    fireContextAndCatch(context, new ThrowingReceiver<Void>(exception2), new ExceptionVerifier() {
      @Override
      public void verify(Throwable e) {
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.