コード例 #1
0
ファイル: FnHttpTest.java プロジェクト: james-jw/basex
 /** Tests http:send-request((),()). */
 @Test
 public void sendReqNoParams() {
   final Command cmd = new XQuery(_HTTP_SEND_REQUEST.args("()"));
   try {
     cmd.execute(ctx);
   } catch (final BaseXException ex) {
     assertTrue(ex.getMessage().contains(ErrType.HC.toString()));
   }
 }
コード例 #2
0
  @Test
  public void testForNonExistingRoute() throws Exception {
    String[] route = {"A", "X", "J"};
    Command cmd = new DistCommand(route);

    String expected = DistCommand.NO_SUCH_ROUTE_ERROR;
    String actual = cmd.execute(g);
    assertEquals(expected, actual);
  }
コード例 #3
0
  @Test
  public void testForExistingRoute2Nodes() throws Exception {
    String[] route = {"D", "A"};
    Command cmd = new DistCommand(route);

    String expected = "1";
    String actual = cmd.execute(g);
    assertEquals(expected, actual);
  }
コード例 #4
0
  /**
   * Runs the stress test.
   *
   * @param clients number of clients
   * @param runs number of runs per client
   * @throws Exception exception
   */
  private static void run(final int clients, final int runs) throws Exception {
    // Create test database
    Command cmd = new CreateDB(NAME, INPUT);
    cmd.execute(context);

    // Start clients
    final Client[] cl = new Client[clients];
    for (int i = 0; i < clients; ++i) cl[i] = new Client(runs);
    for (final Client c : cl) c.start();
    for (final Client c : cl) c.join();
    // Drop database
    cmd = new DropDB(NAME);
    cmd.execute(context);
  }