Package io.teknek.intravert.model

Examples of io.teknek.intravert.model.Response


              .add(new Operation()
                      .withId("2")
                      .withType(ActionFactory.SET_KEYSPACE)
                      .withArguments(
                              new ImmutableMap.Builder<String, Object>().put("name", keyspaceName).build()));
      Response response = service.doRequest(request);
      TestUtils.assertResponseDidNotFail(response);
      List<Map> results = (List<Map>) response.getResults().get("1");
      Assert.assertNotNull(results.get(0).get(Constants.SESSION_ID));
    }
    {
      Request other = new Request();
      other.getOperations().add(
              new Operation()
                      .withId("1")
                      .withType(ActionFactory.LOAD_SESSION)
                      .withArguments(
                              new ImmutableMap.Builder<String, Object>().put(Constants.SESSION_ID,
                                      0L).build()));
      other.getOperations().add(new Operation().withId("2").withType(ActionFactory.GET_KEYSPACE));
      Response second = service.doRequest(other);
      TestUtils.assertResponseDidNotFail(second);
      List<Map> results = (List<Map>) second.getResults().get("2");
      Assert.assertEquals(keyspaceName, results.get(0).get("keyspace"));
    }
  }
View Full Code Here


                     .withId("2")
                    .withType(ActionFactory.SET_KEYSPACE)
                    .withArguments(
                            new ImmutableMap.Builder<String, Object>().put("name", "bla").build()));
    Client cl = new Client();
    Response response = cl.post("http://127.0.0.1:7654", request);
    List<Map> results = (List<Map>) response.getResults().get("1");
    Assert.assertNotNull(results.get(0).get(Constants.SESSION_ID));
  }
View Full Code Here

    filterDef.put("scope", "application");
    filterDef.put("script", "{ row -> if (row['value'].toInteger() > 21) return row else return null }");
    request.getOperations().add(new Operation()
    .withId("1").withType(ActionFactory.CREATE_FILTER).withArguments(filterDef));
    Client cl = new Client();
    Response response = cl.post("http://127.0.0.1:7654", request);
    List<Map> results = (List<Map>) response.getResults().get("1");
    Assert.assertEquals(new ImmutableMap.Builder<String, Object>().put("result", "ok").build(), results.get(0));
  }
View Full Code Here

    File output = new File(testDir, "output.json");
    Client c = new Client();
    ObjectMapper om  = new ObjectMapper();
    om.configure(Feature.INDENT_OUTPUT, true);
    Request r = om.readValue(input, Request.class);
    Response resp = c.post("http://localhost:7654", r);
    Assert.assertEquals(new String(Files.readAllBytes(output.toPath())).trim(), om.writeValueAsString(resp).trim());
  }
View Full Code Here

            .put("columnFamily", "upsert").build()));
    Client cl = new Client();
    ObjectMapper om = new ObjectMapper();
    om.configure(Feature.INDENT_OUTPUT,true);
    System.out.println(om.writeValueAsString(request));
    Response response = cl.post("http://127.0.0.1:7654", request);
    List<Map> results = (List<Map>) response.getResults().get("1");
    Assert.assertEquals(new ImmutableMap.Builder<String, Object>().put("result", "ok").build(), results.get(0));
  }
View Full Code Here

    HttpResponse response = httpClient.execute(postRequest);
    if (response.getStatusLine().getStatusCode() != 200) {
      throw new RuntimeException("Failed : HTTP error code : "
              + response.getStatusLine().getStatusCode());
    }
    Response r = MAPPER.readValue(response.getEntity().getContent(), Response.class);
    response.getEntity().getContent().close();
    return r;
  }
View Full Code Here

  private RequestProcessor requestProcessor = new DefaultRequestProcessor();
  private ApplicationContext applicationContext = new ApplicationContext();
 
  @Override
  public Response doRequest(Request request) {
    Response response = new Response();
    RequestContext requestContext = new RequestContext();
    requestProcessor.process(request, response, requestContext, applicationContext);
    return response;
  }
View Full Code Here

TOP

Related Classes of io.teknek.intravert.model.Response

Copyright © 2018 www.massapicom. 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.