Project

General

Profile

« Previous | Next » 

Revision 7dab8082

Added by Patrick Plitzner about 6 years ago

ref #6484 Adjust count method to find method to return the same number

  • performance can still be improved by integrating AssignmentStatus and/or indirectlyAssociatedSpecimen into the HQL query

View differences:

cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/OccurrenceServiceTest.java
479 479
        // "TaxonName_TypeDesignationBase",
480 480
        // "HomotypicalGroup"}, "testListAssociatedAndTypedTaxa");
481 481
        // } catch (FileNotFoundException e) {
482
        // // TODO Auto-generated catch block
483 482
        // e.printStackTrace();
484 483
        // }
485 484
        //
......
953 952
//                  "TeamOrPersonBase",
954 953
//                  "HomotypicalGroup"}, "testListAssociatedTaxaAndListByAssociatedTaxon");
955 954
//      } catch (FileNotFoundException e) {
956
//          // TODO Auto-generated catch block
957 955
//          e.printStackTrace();
958 956
//      }
959 957
        //check initial state
......
1177 1175
        config.setClazz(DerivedUnit.class);
1178 1176
        config.setAssociatedTaxonUuid(taxon.getUuid());
1179 1177
        config.setRetrieveIndirectlyAssociatedSpecimens(true);
1180
        /* TODO issue #6484: the parameters FindOccurrencesConfigurator.getAssignmentStatus()
1181
        * and FindOccurrencesConfigurator.isRetrieveIndirectlyAssociatedSpecimens() are not evaluated
1182
        * in the count method
1183
        *
1184
        */
1185
//        assertEquals(3, occurrenceService.countOccurrences(config));
1178
        assertEquals(3, occurrenceService.countOccurrences(config));
1186 1179
        List<SpecimenOrObservationBase> indirectlyAssociatedSpecimens = occurrenceService.findByTitle(config)
1187 1180
                .getRecords();
1188 1181
        assertEquals(3, indirectlyAssociatedSpecimens.size());
......
1204 1197
        //all specimen
1205 1198
        config = new FindOccurrencesConfigurator();
1206 1199
        config.setAssignmentStatus(AssignmentStatus.ALL_SPECIMENS);
1207
        /* TODO issue #6484: the parameters FindOccurrencesConfigurator.getAssignmentStatus()
1208
        * and FindOccurrencesConfigurator.isRetrieveIndirectlyAssociatedSpecimens() are not evaluated
1209
        * in the count method
1210
        */
1211
//        assertEquals(4, occurrenceService.countOccurrences(config));
1200
        assertEquals(4, occurrenceService.countOccurrences(config));
1212 1201
        List<SpecimenOrObservationBase> allSpecimens = occurrenceService.findByTitle(config).getRecords();
1213 1202
        assertEquals(4, allSpecimens.size());
1214 1203
        assertTrue(allSpecimens.contains(derivedUnit1));
......
1219 1208
        //assigned specimen
1220 1209
        config = new FindOccurrencesConfigurator();
1221 1210
        config.setAssignmentStatus(AssignmentStatus.ASSIGNED_SPECIMENS);
1222
        /* TODO issue #6484: the parameters FindOccurrencesConfigurator.getAssignmentStatus()
1223
        * and FindOccurrencesConfigurator.isRetrieveIndirectlyAssociatedSpecimens() are not evaluated
1224
        * in the count method
1225
        */
1226
//        assertEquals(2, occurrenceService.countOccurrences(config));
1211
        assertEquals(2, occurrenceService.countOccurrences(config));
1227 1212
        List<SpecimenOrObservationBase> assignedSpecimens = occurrenceService.findByTitle(config).getRecords();
1228 1213
        assertEquals(2, assignedSpecimens.size());
1229 1214
        assertTrue(assignedSpecimens.contains(derivedUnit1));
......
1232 1217
        //unassigned specimen
1233 1218
        config = new FindOccurrencesConfigurator();
1234 1219
        config.setAssignmentStatus(AssignmentStatus.UNASSIGNED_SPECIMENS);
1235
        /* TODO issue #6484: the parameters FindOccurrencesConfigurator.getAssignmentStatus()
1236
        * and FindOccurrencesConfigurator.isRetrieveIndirectlyAssociatedSpecimens() are not evaluated
1237
        * in the count method
1238
        */
1239
//        assertEquals(2, occurrenceService.countOccurrences(config));
1220
        assertEquals(2, occurrenceService.countOccurrences(config));
1240 1221
        List<SpecimenOrObservationBase> unAssignedSpecimens = occurrenceService.findByTitle(config).getRecords();
1241 1222
        assertEquals(2, unAssignedSpecimens.size());
1242 1223
        assertTrue(unAssignedSpecimens.contains(derivedUnit2));

Also available in: Unified diff