示例#1
0
 /**
  * Test sending of HTTP request without any attributes - error shall be thrown that mandatory
  * attributes are missing.
  */
 @Test
 public void sendEmptyReq() {
   try {
     new XQuery(_HTTP_SEND_REQUEST.args("<http:request/>")).execute(ctx);
   } catch (final BaseXException ex) {
     assertTrue(ex.getMessage().contains(ErrType.HC.toString()));
   }
 }
示例#2
0
 /** 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()));
   }
 }
示例#3
0
 /**
  * Assert that a query returns the same result with and without ft index.
  *
  * @param q query
  */
 private static void assertQuery(final String q) {
   try {
     assertEquals(
         "Query failed:\n" + q + '\n',
         new XQuery(q).execute(context),
         new XQuery(q).execute(CTX_IX));
   } catch (final BaseXException e) {
     fail("Query failed:\n" + q + "\nMessage: " + e.getMessage());
   }
 }
示例#4
0
 @Override
 public void run() {
   try {
     for (int i = 0; i < runs; ++i) {
       Performance.sleep((long) (50 * RND.nextDouble()));
       // Return nth text of the database
       final int n = RND.nextInt() % MAX + 1;
       final String qu = Util.info(QUERY, n);
       new XQuery(qu).execute(context);
     }
   } catch (final BaseXException ex) {
     ex.printStackTrace();
   }
 }