assertTrue("Empty user table.", submitter != null);
Study s = new Study();
s.setName(newName);
Submission sub = getFixture().createSubmission(submitter, s);
getSubmissionHome().store(sub);
// force commit immediately, important:
setComplete();
endTransaction();
logger.info("study created: " + s.getName() + "id = " + s.getId());
logger.info("submission created: " + "id = " + sub.getId());
onSetUp();
// 2. add a nexus file:
// String fileName = "12Tx432C.nex"; Failure
// String fileName = "TestNexusFile.nex";
// String fileName = "M12c11.nex";
// String fileName = "M1389.nex"; //17k
// String fileName = "M1001"; //489k
// String fileName = "M999.nx";
// String fileName = "EF1 Spiders.nex";
String fileName = "wtset.nex";
// String fileName = "multiTrees-label.nex";
// String fileName = "charset-taxset-partition.nex";
// String fileName = "49LBR.PDI-branch-length-continue.nex"; // continuous matrix, provided by
// Peter M.
// String fileName = "A100c2x3x96c12c17c08.tre"; //only has a tree, no matrix.
// String fileName = "M99c2x3x96c12c31c40.nex"; // only has a matrix, no tree.
//String fileName = "avian-ovomucoids.nex";
//String fileName = "Combined_Bayes_orig.nex";
String path = "/" + fileName;
File nexusFile = new File(getClass().getResource(path).toURI());
Collection<File> files = new ArrayList<File>();
files.add(nexusFile);
long t1 = System.currentTimeMillis();
getSubmissionHome().refresh(sub);
// sub = (Submission) loadObject(Submission.class, sub.getId());
s = sub.getStudy();
assertTrue("Failed to refresh submission.", sub != null);
getFixture().addNexusFilesJDBC(sub, files, null);
// getStudyService().addNexusFiles(s, files);
// force commit immediately, important:
setComplete();
endTransaction();
long t2 = System.currentTimeMillis();
logger.info("files added: " + s.getName() + "id = " + s.getId() + " Time =" + (t2 - t1));
logger.info("mesquite logging =" + MesquiteConverter.getParsingLog(fileName));
// 3. verify
String studySQL = "select count(*) from Study where study_id=" + s.getId();
String subSQL = "select count(*) from Submission where submission_id=" + sub.getId();
int count = jdbcTemplate.queryForInt(studySQL);
assertTrue(count == 1);
count = jdbcTemplate.queryForInt(subSQL);
assertTrue(count == 1);
onSetUp();
// 4. delete: delete submission:
// after add Nexus files, sub is outdated:
// hibernateTemplate.setFlushMode(HibernateAccessor.FLUSH_COMMIT);
Submission s2 = (Submission) hibernateTemplate.get(Submission.class, sub.getId());
t1 = System.currentTimeMillis();
getFixture().deleteSubmission(s2);
// getStudyService().deleteStudy(s);
setComplete();
endTransaction();