Revision 3465
Added by Jing Tao over 17 years ago
test/edu/ucsb/nceas/metacattest/client/MetacatClientTest.java | ||
---|---|---|
136 | 136 |
suite.addTest(new MetacatClientTest("invalidRead")); |
137 | 137 |
suite.addTest(new MetacatClientTest("read")); |
138 | 138 |
suite.addTest(new MetacatClientTest("query")); |
139 |
suite.addTest(new MetacatClientTest("queryWithQformat")); |
|
139 | 140 |
suite.addTest(new MetacatClientTest("invalidUpdate")); |
140 | 141 |
suite.addTest(new MetacatClientTest("update")); |
141 | 142 |
suite.addTest(new MetacatClientTest("invalidDelete")); |
... | ... | |
287 | 288 |
Reader r = m.query(fr); |
288 | 289 |
//System.err.println("Starting query..."); |
289 | 290 |
String result = IOUtil.getAsString(r, true); |
290 |
//System.err.println("Query result:\n" + result);
|
|
291 |
System.err.println("Query result:\n" + result); |
|
291 | 292 |
String docid = readIdFromFile(DOCID); |
292 | 293 |
assertTrue(result.indexOf(docid+".1")!=-1); |
294 |
assertTrue(result.indexOf("<?xml")!=-1); |
|
293 | 295 |
} catch (MetacatAuthException mae) { |
294 | 296 |
fail("Authorization failed:\n" + mae.getMessage()); |
295 | 297 |
} catch (MetacatInaccessibleException mie) { |
... | ... | |
298 | 300 |
fail("General exception:\n" + e.getMessage()); |
299 | 301 |
} |
300 | 302 |
} |
303 |
/** |
|
304 |
* Test the query() function with a known document |
|
305 |
*/ |
|
306 |
public void queryWithQformat() |
|
307 |
{ |
|
308 |
try { |
|
309 |
m.login(username,password); |
|
310 |
FileReader fr = new FileReader(queryFile); |
|
311 |
String qformat = "knb"; |
|
312 |
Reader r = m.query(fr, qformat); |
|
313 |
//System.err.println("Starting query..."); |
|
314 |
String result = IOUtil.getAsString(r, true); |
|
315 |
System.err.println("Query result:\n" + result); |
|
316 |
String docid = readIdFromFile(DOCID); |
|
317 |
assertTrue(result.indexOf(docid+".1")!=-1); |
|
318 |
assertTrue(result.indexOf("<html>")!=-1); |
|
319 |
} catch (MetacatAuthException mae) { |
|
320 |
fail("Authorization failed:\n" + mae.getMessage()); |
|
321 |
} catch (MetacatInaccessibleException mie) { |
|
322 |
fail("Metacat Inaccessible:\n" + mie.getMessage()); |
|
323 |
} catch (Exception e) { |
|
324 |
fail("General exception:\n" + e.getMessage()); |
|
325 |
} |
|
326 |
} |
|
301 | 327 |
|
302 | 328 |
/** |
303 | 329 |
* Test the insert() function with a known document |
Also available in: Unified diff
Add a new test to test new query method with qformat.