예제 #1
0
 /**
  * Adds documents to a database.
  *
  * @throws IOException I/O exception
  */
 @Test
 public final void add() throws IOException {
   session.execute("create db " + NAME);
   session.add(NAME, new ArrayInput("<X/>"));
   assertEqual("1", session.query("count(" + _DB_OPEN.args(NAME) + ')').execute());
   for (int i = 0; i < 9; i++) session.add(NAME, new ArrayInput("<X/>"));
   assertEqual("10", session.query("count(" + _DB_OPEN.args(NAME) + ')').execute());
 }
예제 #2
0
 /**
  * Adds a file with missing input.
  *
  * @throws IOException I/O exception
  */
 @Test(expected = BaseXException.class)
 public final void addNoInput() throws IOException {
   session.execute("create db " + NAME);
   session.add("", new ArrayInput(""));
 }