Пример #1
0
 private void runChecker() {
   requestScope.runInScope(
       () -> {
         try {
           runInTransaction(this::updateStatus);
         } catch (Exception e) {
           throw new RuntimeException(e);
         }
       });
 }
  @Test
  public void testAsyncApp() throws Exception {
    final Request req =
        Requests.from(BASE_URI, URI.create(BASE_URI.getPath() + uriSuffix), "GET").build();

    Future<Response> res =
        requestScope.runInScope(
            new Callable<Future<Response>>() {

              @Override
              public Future<Response> call() throws Exception {
                return invoker.apply(req);
              }
            });
    assertEquals(expectedResponse, res.get().getEntity());
  }