/** * 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 <a/></text>" + "<option name='" + MainOptions.MIXUPDATES.name() + "' value='true'/></query>", APP_XML)); try { post( "", "<query xmlns=\"" + URI + "\">" + "<text>1, delete node <a/></text>" + "<option name='" + MainOptions.MIXUPDATES.name() + "' value='false'/></query>", APP_XML); fail("Error expected."); } catch (final IOException ex) { assertContains(ex.getMessage(), "[XUST0001]"); } }
/** 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]"); } }
@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()); } }
@Test public final void testStreams() throws Exception { for (int i = 0; i < 100; i++) { try { runStreamTest(i); } catch (IOException e) { e.printStackTrace(); fail(e.getMessage() + ": " + i); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage() + ": " + i); } } for (int i = 100; i < 2000; i += 250) { try { runStreamTest(i); } catch (IOException e) { e.printStackTrace(); fail(e.getMessage() + ": " + i); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage() + ": " + i); } } for (int i = 2000; i < 80000; i += 1000) { try { runStreamTest(i); } catch (IOException e) { e.printStackTrace(); fail(e.getMessage() + ": " + i); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage() + ": " + i); } } }