Beispiel #1
0
 /** Clean up method. */
 @After
 public void cleanUp() {
   try {
     testSession.close();
     adminSession.execute(new DropDB(RENAMED));
     adminSession.execute(new DropDB(NAME));
     adminSession.close();
     // give the server some time to clean up the sessions before next test
     Performance.sleep(100);
   } catch (final Exception ex) {
     fail(Util.message(ex));
   }
 }
Beispiel #2
0
 /**
  * Performs the specified query n times and and returns the result.
  *
  * @param query query to be evaluated
  * @param n number of runs
  * @return resulting string
  * @throws IOException I/O exception
  */
 protected static String eval(final int n, final String query) throws IOException {
   // loop through number of runs for a single query
   check();
   String result = "";
   for (int rn = 0; rn < n; ++rn) result = session.execute(new XQuery(query));
   return result;
 }
Beispiel #3
0
 /**
  * Assumes that this command fails.
  *
  * @param cmd command reference
  * @param s session
  */
 private static void no(final Command cmd, final Session s) {
   try {
     s.execute(cmd);
     fail("\"" + cmd + "\" was supposed to fail.");
   } catch (final IOException ignored) {
   }
 }
Beispiel #4
0
 /**
  * Assumes that this command is successful.
  *
  * @param cmd command reference
  * @param s session
  */
 private static void ok(final Command cmd, final Session s) {
   try {
     s.execute(cmd);
   } catch (final IOException ex) {
     fail(Util.message(ex));
   }
 }
Beispiel #5
0
  /**
   * Initializes the benchmark.
   *
   * @throws IOException I/O exception
   */
  @BeforeClass
  public static void init() throws IOException {
    // check if server is (not) running
    final int sp = context.soptions.get(StaticOptions.SERVERPORT);
    server = local || BaseXServer.ping(S_LOCALHOST, sp) ? null : createServer();
    session = local ? new LocalSession(context) : createClient();

    // create test database
    session.execute(new Set(MainOptions.QUERYINFO, true));
  }
Beispiel #6
0
 @Override
 public void request(HTTPSession session, ResponseHandler handler) {
   ((Session) session).execute(handler);
 }
Beispiel #7
0
 /**
  * Creates or opens the test database.
  *
  * @throws IOException I/O exception
  */
 private static void check() throws IOException {
   session.execute(new Check(INPUT));
 }