Ejemplo n.º 1
0
  /**
   * POST Test: specify an option.
   *
   * @throws IOException I/O exception
   */
  @Test
  public void postOption() throws IOException {
    assertEquals(
        "2",
        post(
            "",
            "<query xmlns=\""
                + URI
                + "\">"
                + "<text>2, delete node &lt;a/&gt;</text>"
                + "<option name='"
                + MainOptions.MIXUPDATES.name()
                + "' value='true'/></query>",
            APP_XML));

    try {
      post(
          "",
          "<query xmlns=\""
              + URI
              + "\">"
              + "<text>1, delete node &lt;a/&gt;</text>"
              + "<option name='"
              + MainOptions.MIXUPDATES.name()
              + "' value='false'/></query>",
          APP_XML);
      fail("Error expected.");
    } catch (final IOException ex) {
      assertContains(ex.getMessage(), "[XUST0001]");
    }
  }
Ejemplo n.º 2
0
 /** POST Test: execute buggy query. */
 @Test
 public void postErr() {
   try {
     assertEquals("", post("", "<query xmlns=\"" + URI + "\"><text>(</text></query>", APP_XML));
   } catch (final IOException ex) {
     assertContains(ex.getMessage(), "[XPST0003]");
   }
 }