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]");
   }
 }
Ejemplo n.º 3
0
  @Before
  public void setUp() {
    try {
      URL res = this.getClass().getClassLoader().getResource("toolspecs");
      // use the file toolspec xml as the input file too (for this test)
      toolspecsDir = res.getFile();
      repo = new LocalToolRepository(res.getFile());

    } catch (IOException ex) {
      fail(ex.getMessage());
    }
  }
Ejemplo n.º 4
0
 private static ModuleImpl newModuleImpl(String name, String version, ModuleState state)
     throws CoreException {
   ModuleImpl module = null;
   String resource = "xml/" + name + ".xml";
   try {
     module = loadModule(resource);
   } catch (IOException e) {
     e.printStackTrace();
     Assert.fail(resource + ": " + e.getMessage());
   }
   module.setVersion(Version.parseVersion(version));
   module.setState(state);
   return module;
 }