Package juzu.test.protocol.mock

Examples of juzu.test.protocol.mock.MockClient.invoke()


    MockViewBridge render = client.render();
    assertEquals("render_phase", render.assertStringResponse());

    //
    String url = render.getTitle();
    MockActionBridge action = (MockActionBridge)client.invoke(url);
    //
//      client.
//      client.invoke();
//      assertNull(Registry.get("car"));
View Full Code Here


    MockApplication<?> app = application.init();

    //
    MockClient client = app.client();
    MockViewBridge render = client.render();
    MockViewBridge action = (MockViewBridge)client.invoke(render.assertStringResponse());
    String result = action.assertStringResponse();
    assertEquals("pass", result);
  }

  private <T extends Throwable> T  runParseError(String pkg, Class<T> expected) throws Exception {
View Full Code Here

    MockApplication<?> app = application.init();

    //
    MockClient client = app.client();
    MockViewBridge render = client.render();
    MockViewBridge action = (MockViewBridge)client.invoke(render.assertStringResponse());
    return action.assertFailure(expected);
  }

  private void runMissing(String pkg) throws Exception {
    MockApplication<File> application = application(InjectorProvider.GUICE, pkg);
View Full Code Here

    MockClient client = app.client();
    MockViewBridge render = client.render();
    String url = render.assertStringResponse();
    JSON json = (JSON)JSON.parse(url);
    json.set("parameters", new JSON());
    MockViewBridge action = (MockViewBridge)client.invoke(json.toString());
    String result = action.assertStringResponse();
    assertEquals("pass", result);
  }
}
View Full Code Here

    MockApplication<?> app = application("plugin.controller.resource.notfound").init();

    //
    MockClient client = app.client();
    MockViewBridge render = client.render();
    MockResourceBridge resource = (MockResourceBridge)client.invoke(render.assertStringResponse());
    resource.assertNotFound();
  }

  @Test
  public void testBinary() throws Exception {
View Full Code Here

    MockApplication<?> app = application("plugin.controller.resource.binary").init();

    //
    MockClient client = app.client();
    MockViewBridge render = client.render();
    MockResourceBridge resource = (MockResourceBridge)client.invoke(render.assertStringResponse());
    assertEquals("hello", new String(resource.assertBinaryResponse(), "UTF-8"));
    assertEquals("application/octet-stream", resource.getMimeType());
  }
}
View Full Code Here

  @Test
  public void testContextutal() throws Exception {
    MockApplication<?> app = application(InjectorProvider.WELD, "plugin.template.url.contextual").init();
    MockClient client = app.client();
    String url = client.render().assertStringResponse();
    assertEquals("pass", ((MockViewBridge)client.invoke(url)).assertStringResponse());
  }
}
View Full Code Here

    long id1 = Registry.<Long>unset("car");
    assertEquals(car.getIdentityHashCode(), id1);
    assertEquals(Identifiable.MANAGED, (int)Registry.<Integer>unset("status"));

    //
    request = client.invoke(Registry.<String>unset("action"));
    attributes = request.getAttributesHistory();
    assertEquals(1, attributes.size());
    car = (Identifiable)attributes.iterator().next().get();
    assertEquals(Identifiable.DESTROYED, car.getStatus());
View Full Code Here

    assertNotSame(id1, id2);
    assertEquals(id2, id2);
    assertEquals(Identifiable.MANAGED, (int)Registry.<Integer>unset("status"));

    //
    request = client.invoke(Registry.<String>unset("resource"));
    attributes = request.getAttributesHistory();
    assertEquals(1, attributes.size());
    car = (Identifiable)attributes.iterator().next().get();
    assertEquals(Identifiable.DESTROYED, car.getStatus());
View Full Code Here

    Identifiable car1 = (Identifiable)client.getFlashHistory(1).iterator().next().get();
    assertEquals(car1.getIdentityHashCode(), id1);
    assertEquals(Identifiable.DESTROYED, car1.getStatus());

    //
    client.invoke(Registry.<String>unset("action"));
    long id2 = Registry.<Long>unset("car");
    status = Registry.<Integer>unset("status");
    assertEquals(Identifiable.MANAGED, status);
    assertNotSame(id1, id2);
    assertEquals(1, client.getFlashHistory(0).size());
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.