bug #7818
openTaxonRelationshipsDTOTest leaves test environment in unpredictable state
0%
Description
as stated in #7648#note-14 the TaxonRelationshipsDTOTest
causes problems for other tests.
e.g.: Running the following tests in sequence
mvn -Dtest=eu.etaxonomy.cdm.api.service.dto.TaxonRelationshipsDTOTest,eu.etaxonomy.cdm.api.service.taxonGraph.TaxonGraphHibernateListenerTest test
will end up with TaxonGraphHibernateListenerTest to fail due to:
Tests in error: testChangeSpecificEpithet_of_InfraSpecific(eu.etaxonomy.cdm.api.service.taxonGraph.TaxonGraphHibernateListenerTest): object references an unsaved transient instance - save the transient instance before flushing: eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType testChangeNomRef(eu.etaxonomy.cdm.api.service.taxonGraph.TaxonGraphHibernateListenerTest): object references an unsaved transient instance - save the transient instance before flushing: eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType testChangeSpecificEpithet_of_Species(eu.etaxonomy.cdm.api.service.taxonGraph.TaxonGraphHibernateListenerTest): object references an unsaved transient instance - save the transient instance before flushing: eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType testChangeRank(eu.etaxonomy.cdm.api.service.taxonGraph.TaxonGraphHibernateListenerTest): object references an unsaved transient instance - save the transient instance before flushing: eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType testNewTaxonName(eu.etaxonomy.cdm.api.service.taxonGraph.TaxonGraphHibernateListenerTest): object references an unsaved transient instance - save the transient instance before flushing: eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType testChangeGenus(eu.etaxonomy.cdm.api.service.taxonGraph.TaxonGraphHibernateListenerTest): object references an unsaved transient instance - save the transient instance before flushing: eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType testNewGenusName(eu.etaxonomy.cdm.api.service.taxonGraph.TaxonGraphHibernateListenerTest): object references an unsaved transient instance - save the transient instance before flushing: eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType
This is clearly caused by the TaxonRelationshipsDTOTest which run in the up started application context of the previously run CdmTransactionalIntegrationTests but not cleaning up the context afterwards.
The following changes to the TaxonRelationshipsDTOTest solve the problem:
public class TaxonRelationshipsDTOTest extends CdmTransactionalIntegrationTest
// /**
// * @throws java.lang.Exception
// */
// @BeforeClass
// public static void setUpBeforeClass() throws Exception {
// if (Language.DEFAULT() == null){
// new DefaultTermInitializer().initialize();
// }
// }
running the DefaultTermInitializer().initialize()
outside of the CdmIntegrationTest-Context seems to have cause the side effect.
The problem becomes only relevant if the TaxonRelationshipsDTOTest is run as first test, before others. For test like this one we should implement some means to reset the terms to the initial virgin state. <<<< TODO