@Test public void testImportWithInvalidRows() { CsvImportResults results; StringReader reader = new StringReader(getTestEntityRecordsAsCsv(IdMode.INVALID)); results = csvImporterExporter.importCsv(ENTITY_ID, reader, true, false); ArgumentCaptor<Record2> captor = ArgumentCaptor.forClass(Record2.class); verify(motechDataService, times(17)).create(captor.capture()); assertNotNull(results); assertEquals(17, results.totalNumberOfImportedInstances()); assertEquals(3, results.getRowErrors().size()); StringReader reader2 = new StringReader(getTestEntityRecordsAsCsv(IdMode.INVALID)); boolean thrown = false; try { csvImporterExporter.importCsv(ENTITY_ID, reader2, false, false); } catch (RuntimeException e){ thrown = true; } assertTrue(thrown); }
@Transactional public CsvImportResults importCsv(final long entityId, final Reader reader, boolean continueOnError, boolean clearData) { EntityInfo entityInfo = getEntity(entityId); return importCsv(entityInfo, reader, continueOnError, clearData); }
CsvImporterExporter extends AbstractMdsExporter { @Transactional public CsvImportResults importCsv(final long entityId, final Reader reader, boolean continueOnError, boolean clearData) { EntityInfo entityInfo = getEntity(entityId); return importCsv(entityInfo, reader, continueOnError, clearData); } }
CsvImporterExporter extends AbstractMdsExporter { @Transactional public CsvImportResults importCsv(final long entityId, final Reader reader, boolean continueOnError, boolean clearData) { EntityInfo entityInfo = getEntity(entityId); return importCsv(entityInfo, reader, continueOnError, clearData); }  }
CsvImporterExporter extends AbstractMdsExporter { @Transactional public CsvImportResults importCsv(final long entityId, final Reader reader, boolean continueOnError, boolean clearData) { EntityInfo entityInfo = getEntity(entityId); return importCsv(entityInfo, reader, continueOnError, clearData); }  @Transactional CsvImportResults importCsv(final long entityId, final Reader reader, boolean continueOnError, boolean clearData); @Transactional CsvImportResults importCsv(final long entityId, final Reader reader, CsvImportCustomizer importCustomizer, boolean continueOnError, boolean clearData); @Transactional CsvImportResults importCsv(final String entityClassName, final Reader reader, boolean continueOnError); @Transactional long exportCsv(final long entityId, final Writer writer); @Transactional long exportCsv(final String entityClassName, final Writer writer); @Transactional long exportCsv(final long entityId, final Writer writer, final CsvExportCustomizer exportCustomizer); @Transactional long exportCsv(final String entityClassName, final Writer writer, final CsvExportCustomizer exportCustomizer); @Transactional long exportCsv(long entityId, Writer writer, String lookupName, QueryParams params, List<String> headers,
                          Map<String, Object> lookupFields); @Transactional long exportCsv(String entityClassName, Writer writer, String lookupName, QueryParams params, List<String> headers,
                          Map<String, Object> lookupFields); @Transactional long exportCsv(long entityId, Writer writer, String lookupName, QueryParams params, List<String> headers,
                          Map<String, Object> lookupFields, CsvExportCustomizer exportCustomizer); @Transactional long exportCsv(String entityClassName, Writer writer, String lookupName, QueryParams params, List<String> headers,
                          Map<String, Object> lookupFields, CsvExportCustomizer exportCustomizer); }
CsvImporterExporter extends AbstractMdsExporter { @Transactional public CsvImportResults importCsv(final long entityId, final Reader reader, boolean continueOnError, boolean clearData) { EntityInfo entityInfo = getEntity(entityId); return importCsv(entityInfo, reader, continueOnError, clearData); }  @Transactional CsvImportResults importCsv(final long entityId, final Reader reader, boolean continueOnError, boolean clearData); @Transactional CsvImportResults importCsv(final long entityId, final Reader reader, CsvImportCustomizer importCustomizer, boolean continueOnError, boolean clearData); @Transactional CsvImportResults importCsv(final String entityClassName, final Reader reader, boolean continueOnError); @Transactional long exportCsv(final long entityId, final Writer writer); @Transactional long exportCsv(final String entityClassName, final Writer writer); @Transactional long exportCsv(final long entityId, final Writer writer, final CsvExportCustomizer exportCustomizer); @Transactional long exportCsv(final String entityClassName, final Writer writer, final CsvExportCustomizer exportCustomizer); @Transactional long exportCsv(long entityId, Writer writer, String lookupName, QueryParams params, List<String> headers,
                          Map<String, Object> lookupFields); @Transactional long exportCsv(String entityClassName, Writer writer, String lookupName, QueryParams params, List<String> headers,
                          Map<String, Object> lookupFields); @Transactional long exportCsv(long entityId, Writer writer, String lookupName, QueryParams params, List<String> headers,
                          Map<String, Object> lookupFields, CsvExportCustomizer exportCustomizer); @Transactional long exportCsv(String entityClassName, Writer writer, String lookupName, QueryParams params, List<String> headers,
                          Map<String, Object> lookupFields, CsvExportCustomizer exportCustomizer);  }