@Test public void testAddObject() { batchHandler.addObject(groupSetA); batchHandler.addObject(groupSetB); batchHandler.addObject(groupSetC); batchHandler.flush(); Collection<IndicatorGroupSet> groupSets = indicatorService.getAllIndicatorGroupSets(); assertTrue(groupSets.contains(groupSetA)); assertTrue(groupSets.contains(groupSetB)); assertTrue(groupSets.contains(groupSetC)); }
@Ignore @Test public void testImportDataValueImportAll() { importObjectService.addImportObject(ImportObjectStatus.NEW, dataElementAModified, null); importObjectService.addImportObject(ImportObjectStatus.NEW, dataElementBModified, null); importObjectService.addImportObject(ImportObjectStatus.NEW, dataElementCModified, null); importObjectService.addImportObject(ImportObjectStatus.NEW, periodADuplicate, null); importObjectService.addImportObject(ImportObjectStatus.NEW, organisationUnitAModified, null); importObjectService.addImportObject(ImportObjectStatus.NEW, organisationUnitBModified, null); importObjectService.addImportObject(ImportObjectStatus.NEW, organisationUnitCModified, null); BatchHandler<ImportDataValue> batchHandler = batchHandlerFactory.createBatchHandler(ImportDataValueBatchHandler.class); batchHandler.init(); batchHandler.addObject(new ImportDataValue(dataValueADuplicate, ImportObjectStatus.NEW)); batchHandler.addObject(new ImportDataValue(dataValueBDuplicate, ImportObjectStatus.NEW)); batchHandler.addObject(new ImportDataValue(dataValueCDuplicate, ImportObjectStatus.NEW)); batchHandler.addObject(new ImportDataValue(dataValueDDuplicate, ImportObjectStatus.NEW)); batchHandler.addObject(new ImportDataValue(dataValueEDuplicate, ImportObjectStatus.NEW)); batchHandler.addObject(new ImportDataValue(dataValueFDuplicate, ImportObjectStatus.NEW)); batchHandler.addObject(new ImportDataValue(dataValueGDuplicate, ImportObjectStatus.NEW)); batchHandler.addObject(new ImportDataValue(dataValueHDuplicate, ImportObjectStatus.NEW)); batchHandler.addObject(new ImportDataValue(dataValueIDuplicate, ImportObjectStatus.NEW)); batchHandler.flush(); dbmsManager.clearSession(); importObjectService.importAll(); assertEquals(dataElementService.getAllDataElements().size(), 3); assertEquals(periodService.getPeriodsByPeriodType(periodTypeA).size(), 1); assertEquals(organisationUnitService.getAllOrganisationUnits().size(), 3); assertEquals(dataValueService.getAllDataValues().size(), 9); assertEquals(importObjectService.getImportObjects(DataElement.class).size(), 0); assertEquals(importObjectService.getImportObjects(Period.class).size(), 0); assertEquals(importObjectService.getImportObjects(OrganisationUnit.class).size(), 0); }