Project

General

Profile

« Previous | Next » 

Revision d1344a8b

Added by Andreas Kohlbecker over 6 years ago

ref #7103 defined test method execution order

View differences:

src/main/java/eu/etaxonomy/cdm/service/SpecimenTypeDesignationWorkingSetServiceImpl.java
24 24
import eu.etaxonomy.cdm.api.application.CdmRepository;
25 25
import eu.etaxonomy.cdm.api.service.DeleteResult;
26 26
import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator;
27
import eu.etaxonomy.cdm.debug.PersistentContextAnalyzer;
28 27
import eu.etaxonomy.cdm.model.common.VersionableEntity;
29 28
import eu.etaxonomy.cdm.model.name.Registration;
30 29
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
......
169 168

  
170 169
            Session session = repo.getSession();
171 170

  
172
            PersistentContextAnalyzer regAnalyzer = new PersistentContextAnalyzer(dto.getOwner(), session);
173
            regAnalyzer.printEntityGraph(System.out);
174
            regAnalyzer.printCopyEntities(System.out);
171
//            PersistentContextAnalyzer regAnalyzer = new PersistentContextAnalyzer(dto.getOwner(), session);
172
//            regAnalyzer.printEntityGraph(System.out);
173
//            regAnalyzer.printCopyEntities(System.out);
175 174

  
176 175
            session.merge(dto.getOwner());
177 176
            session.flush();
src/test/java/eu/etaxonomy/cdm/service/SpecimenTypeDesignationWorkingSetServiceImplTest.java
14 14

  
15 15
import org.junit.Assert;
16 16
import org.junit.BeforeClass;
17
import org.junit.FixMethodOrder;
17 18
import org.junit.Test;
19
import org.junit.runners.MethodSorters;
18 20
import org.unitils.database.annotations.Transactional;
19 21
import org.unitils.database.util.TransactionMode;
20 22
import org.unitils.dbunit.annotation.DataSet;
......
51 53
 *
52 54
 */
53 55
@Transactional(TransactionMode.DISABLED)
56
// IMPORTANT: test03_deleteTypeDesignationTest executed not as last would cause the other tests to fail due to changes in the db
57
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
54 58
public class SpecimenTypeDesignationWorkingSetServiceImplTest extends CdmVaadinIntegrationTest{
55 59

  
56 60
    @SpringBeanByName
......
84 88

  
85 89
    @Test
86 90
    @DataSet("SpecimenTypeDesignationWorkingSetServiceImplTest.xml")
87
    public void createAndEditTest() throws DerivedUnitConversionException, URISyntaxException, FileNotFoundException {
91
    public void test01_createAndEditTest() throws DerivedUnitConversionException, URISyntaxException, FileNotFoundException {
88 92

  
89 93
//        printDataSetWithNull(System.err, new String[]{"USERACCOUNT", "GROUPS", "USERACCOUNT_GRANTEDAUTHORITYIMPL", "USERACCOUNT_PERMISSIONGROUP"
90 94
//                , "PERMISSIONGROUP", "PERMISSIONGROUP_GRANTEDAUTHORITYIMPL", "GRANTEDAUTHORITYIMPL"});
......
160 164
    @Test
161 165
    @DataSet("SpecimenTypeDesignationWorkingSetServiceImplTest-deleteTest.xml")
162 166
    @ExpectedDataSet("SpecimenTypeDesignationWorkingSetServiceImplTest.deleteTypeDesignationTest-result.xml")
163
    public void deleteTypeDesignationTest() {
167
    public void test03_deleteTypeDesignationTest() {
164 168

  
165 169
        SpecimenTypeDesignationWorkingSetDTO<Registration> workingset = service.loadDtoByIds(registrationId, 0);
166 170
        Assert.assertTrue(workingset.getSpecimenTypeDesignationDTOs().size() == 2);
......
191 195

  
192 196
    @Test
193 197
    @DataSet("SpecimenTypeDesignationWorkingSetServiceImplTest-deleteTest.xml")
194
    public void deleteWorkingsetTest() {
198
    public void test02_deleteWorkingset() {
195 199

  
196
        //printDataSetWithNull(System.err, includeTableNames_delete);
200
        printDataSetWithNull(System.err, includeTableNames_delete);
197 201

  
202
        try {
198 203
        SpecimenTypeDesignationWorkingSetDTO<Registration> workingset = service.loadDtoByIds(registrationId, 0);
199 204
        Assert.assertNotNull(workingset.getOwner());
200 205
        Assert.assertEquals(2, workingset.getSpecimenTypeDesignationDTOs().size());
......
213 218
        Assert.assertEquals("FieldUnit should have been deleted", 0, cdmRepository.getOccurrenceService().count(FieldUnit.class));
214 219
        Assert.assertEquals("Gathering event should have been deleted by orphan remove", 0, cdmRepository.getEventBaseService().count(GatheringEvent.class));
215 220
        // FIXME  Assert.assertEquals("Media should have been deleted ", 0, cdmRepository.getMediaService().count(null));
216

  
221
        } catch (Exception e){
222
            e.printStackTrace(System.err);
223
        }
217 224
        // printDataSetWithNull(System.err, includeTableNames_delete);
218 225
    }
219 226

  

Also available in: Unified diff