Revision 3779
Added by Jing Tao over 16 years ago
test/edu/ucsb/nceas/metacattest/client/MetacatClientTest.java | ||
---|---|---|
356 | 356 |
} |
357 | 357 |
|
358 | 358 |
/** |
359 |
* Test the upload() function with a known document |
|
359 |
* Test the upload() function with a data file. |
|
360 |
* 1. Insert version 1 successfully. |
|
361 |
* 2. Update version 2 successfully |
|
362 |
* 3. Update version 2 again and should be failed. |
|
360 | 363 |
*/ |
361 | 364 |
public void upload() |
362 | 365 |
{ |
... | ... | |
375 | 378 |
assertTrue(response.indexOf("<success>") != -1); |
376 | 379 |
assertTrue(response.indexOf(identifier) != -1); |
377 | 380 |
//System.err.println(response); |
381 |
//upload the same identifier again. it should return an error |
|
382 |
try |
|
383 |
{ |
|
384 |
response = m.upload(identifier, |
|
385 |
new File(onlinetestdatafile)); |
|
386 |
fail("Metacat shouldn't successfully upload the same identifier twice "+response); |
|
387 |
} |
|
388 |
catch(Exception ee) |
|
389 |
{ |
|
390 |
assertTrue(ee.getMessage().indexOf("<error>") != -1); |
|
391 |
} |
|
378 | 392 |
|
379 | 393 |
} catch (MetacatAuthException mae) { |
380 | 394 |
fail("Authorization failed:\n" + mae.getMessage()); |
... | ... | |
390 | 404 |
fail("General exception:\n" + e.getMessage()); |
391 | 405 |
} |
392 | 406 |
} |
407 |
|
|
393 | 408 |
|
409 |
|
|
394 | 410 |
/** |
395 | 411 |
* Test the upload() function by passing an InputStream |
396 | 412 |
*/ |
Also available in: Unified diff
Add code to test upload same identifier twice.