Revision 68198871
Added by Anahit Babadshanjan over 15 years ago
cdmlib-services/src/test/java/eu/etaxonomy/cdm/test/function/TestJaxb.java | ||
---|---|---|
445 | 445 |
|
446 | 446 |
try { |
447 | 447 |
cdmDocumentBuilder = new CdmDocumentBuilder(); |
448 |
logger.info("Unmarshalling file: " + filename); |
|
448 | 449 |
dataSet = cdmDocumentBuilder.unmarshal(dataSet, new File(filename)); |
449 | 450 |
|
450 | 451 |
} catch (Exception e) { |
... | ... | |
455 | 456 |
// save data in DB |
456 | 457 |
|
457 | 458 |
Collection<TaxonBase> taxonBases; |
459 |
List<Agent> agents; |
|
458 | 460 |
|
459 | 461 |
TransactionStatus txStatus = appCtr.startTransaction(); |
460 | 462 |
|
463 |
logger.info("Saving data to DB: " + dbname); |
|
464 |
|
|
461 | 465 |
// Currently it's sufficient to save the taxa only since all other data |
462 | 466 |
// related to the taxa, such as synonyms, are automatically saved as well. |
463 | 467 |
|
464 | 468 |
// if ((agents = dataSet.getAgents()) != null) { |
465 |
// appCtr.getAgentService().saveAgentAll(agents); |
|
469 |
// logger.info("Saving agents"); |
|
470 |
// appCtr.getAgentService().saveAgentAll(agents); |
|
466 | 471 |
// } |
467 | 472 |
|
468 | 473 |
// FIXME: Clean getTaxa()/getTaxonBases() return parameters. |
469 | 474 |
|
470 | 475 |
// Need to get the taxa and the synonyms here. |
471 | 476 |
if ((taxonBases = dataSet.getTaxonBases_()) != null) { |
472 |
appCtr.getTaxonService().saveTaxonAll(taxonBases); |
|
477 |
logger.info("Saving taxon bases"); |
|
478 |
appCtr.getTaxonService().saveTaxonAll(taxonBases); |
|
473 | 479 |
} |
474 | 480 |
|
481 |
logger.info("All data saved"); |
|
482 |
|
|
475 | 483 |
appCtr.commitTransaction(txStatus); |
476 | 484 |
appCtr.close(); |
477 | 485 |
|
... | ... | |
485 | 493 |
//Loads terms to DB. |
486 | 494 |
//initPreloadedDb(serializeFromDb); |
487 | 495 |
|
488 |
doSerialize(serializeFromDb, marshOutOne); |
|
496 |
//doSerialize(serializeFromDb, marshOutOne);
|
|
489 | 497 |
|
490 | 498 |
//For tests to retrieve all data via services rather than traversing the tree. |
491 | 499 |
//doSerializeFlat(serializeFromDb, marshOutOne); |
Also available in: Unified diff