use of org.unitils.dbunit.annotation.ExpectedDataSet in project cdmlib by cybertaxonomy.
the class TaxonNodeDaoHibernateImplTest method testSortindexForJavassist.
@Test
@DataSet(value = "TaxonNodeDaoHibernateImplTest.testSortindexForJavassist.xml")
@ExpectedDataSet("TaxonNodeDaoHibernateImplTest.testSortindexForJavassist-result.xml")
public // test if TaxonNode.remove(index) works correctly with proxies
void testSortindexForJavassist() {
Taxon taxonWithLazyLoadedParentNodeOnTopLevel = (Taxon) taxonDao.findByUuid(UUID.fromString("bc09aca6-06fd-4905-b1e7-cbf7cc65d783"));
TaxonNode parent = taxonWithLazyLoadedParentNodeOnTopLevel.getTaxonNodes().iterator().next().getParent();
Assert.assertTrue("Parent node must be proxy, otherwise test does not work", parent instanceof Proxy);
Taxon firstTopLevelTaxon = (Taxon) taxonDao.findByUuid(UUID.fromString("7b8b5cb3-37ba-4dba-91ac-4c6ffd6ac331"));
Classification classification = classificationDao.findByUuid(ClassificationUuid);
TaxonNode childNode = classification.addParentChild(taxonWithLazyLoadedParentNodeOnTopLevel, firstTopLevelTaxon, null, null);
this.taxonNodeDao.saveOrUpdate(childNode);
commitAndStartNewTransaction(new String[] { "TaxonNode" });
}
use of org.unitils.dbunit.annotation.ExpectedDataSet in project cdmlib by cybertaxonomy.
the class DescriptionElementDaoHibernateImplTest method testRemoveLanguageString.
/**
* See #2114
*/
@Test
// (value="DescriptionElementDaoHibernateImplTest.xml")
@DataSet
@ExpectedDataSet
public void testRemoveLanguageString() {
// test write
TextData textDataTwo = (TextData) descriptionElementDao.findByUuid(uuidDobuleTextData);
Assert.assertEquals("There should be exactly 2 languageText in the multilanguageText", 2, textDataTwo.size());
Assert.assertTrue("The language should be English", textDataTwo.containsKey(Language.ENGLISH()));
textDataTwo.removeText(Language.ENGLISH());
Assert.assertEquals("There should be only 1 language left", 1, textDataTwo.size());
descriptionElementDao.saveOrUpdate(textDataTwo);
setComplete();
endTransaction();
try {
if (printDatasets) {
printDataSet(System.out, new String[] { "LanguageString", "DescriptionElementBase", "DESCRIPTIONELEMENTBASE_LANGUAGESTRING" });
}
} catch (Exception e) {
logger.warn(e);
}
}
use of org.unitils.dbunit.annotation.ExpectedDataSet in project cdmlib by cybertaxonomy.
the class AgentDaoImplTest method testSave.
@Test
@DataSet("AgentDaoImplTest.testSave.xml")
@ExpectedDataSet
public void testSave() {
Person person = Person.NewInstance();
person.setGivenName("ben");
agentDao.save(person);
commit();
}
use of org.unitils.dbunit.annotation.ExpectedDataSet in project cdmlib by cybertaxonomy.
the class AgentDaoImplTest method testUpdate.
@Test
@DataSet
@ExpectedDataSet
public void testUpdate() {
Person person = (Person) agentDao.findByUuid(personUuid);
assert person != null : "person must exist";
person.setGivenName("Benjamin");
agentDao.update(person);
// commitAndStartNewTransaction(new String[]{"AGENTBASE_AUD","AGENTBASE"});
commit();
}
use of org.unitils.dbunit.annotation.ExpectedDataSet in project cdmlib by cybertaxonomy.
the class TypeDesignationDaoHibernateImplTest method testSaveTypeDesignationsBidirectionalCascade.
@Test
@ExpectedDataSet
public void testSaveTypeDesignationsBidirectionalCascade() {
SpecimenTypeDesignation desig1 = SpecimenTypeDesignation.NewInstance();
desig1.setUuid(UUID.fromString("a1b8af89-b724-469b-b0ce-027c2199aadd"));
TaxonName name = TaxonNameFactory.NewBotanicalInstance(Rank.SPECIES());
name.setUuid(UUID.fromString("503d78dc-5d4c-4eb6-b682-0ab90fdee02c"));
name.setTitleCache("Name saved via cascade", true);
name.addTypeDesignation(desig1, false);
typeDesignationDao.saveOrUpdate(desig1);
commit();
}
Aggregations