branch feature/1174-Import_EBP_Transactions updated (89c8a76 -> 4775428)
This is an automated email from the git hooks/post-receive script. New change to branch feature/1174-Import_EBP_Transactions in repository lima. See https://gitlab.nuiton.org/chorem/lima.git from 89c8a76 refs #1174 [ISO] mise à jour des tests suite au rebase new 4775428 refs #1174 Correction sur affichage des résultats d'import dans le cas ou il n'y a pas eu d'erreur The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 4775428da6bbc6e955fd606bd1c0624dc2b96f76 Author: David Cossé <cosse@codelutin.com> Date: Thu Sep 8 13:38:54 2016 +0200 refs #1174 Correction sur affichage des résultats d'import dans le cas ou il n'y a pas eu d'erreur Summary of changes: .../java/org/chorem/lima/business/ImportResult.java | 5 ++--- .../chorem/lima/business/ImportExportServiceTest.java | 17 ++++++++--------- .../org/chorem/lima/ui/importexport/ImportExport.java | 6 +++--- 3 files changed, 13 insertions(+), 15 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/1174-Import_EBP_Transactions in repository lima. See https://gitlab.nuiton.org/chorem/lima.git commit 4775428da6bbc6e955fd606bd1c0624dc2b96f76 Author: David Cossé <cosse@codelutin.com> Date: Thu Sep 8 13:38:54 2016 +0200 refs #1174 Correction sur affichage des résultats d'import dans le cas ou il n'y a pas eu d'erreur --- .../java/org/chorem/lima/business/ImportResult.java | 5 ++--- .../chorem/lima/business/ImportExportServiceTest.java | 17 ++++++++--------- .../org/chorem/lima/ui/importexport/ImportExport.java | 6 +++--- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/ImportResult.java b/lima-business-api/src/main/java/org/chorem/lima/business/ImportResult.java index 8cec320..4d0a7b3 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/ImportResult.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/ImportResult.java @@ -22,10 +22,10 @@ package org.chorem.lima.business; * #L% */ +import com.google.common.collect.Maps; import org.chorem.lima.business.exceptions.LimaException; import java.io.Serializable; -import java.util.HashMap; import java.util.Map; /** @@ -50,6 +50,7 @@ public class ImportResult implements Serializable{ nbUpdated = 0; nbIgnored = 0; lineIndex = 2;// line 1 s header + allExceptions = Maps.newHashMap(); this.fromSource = fromSource; } @@ -81,14 +82,12 @@ public class ImportResult implements Serializable{ } public void addException(LimaException e) { - allExceptions = allExceptions == null ? new HashMap<Integer, LimaException>() : allExceptions; allExceptions.put(this.lineIndex, e); nbIgnored++; lineIndex++; } public void addInitException(LimaException e) { - allExceptions = allExceptions == null ? new HashMap<Integer, LimaException>() : allExceptions; allExceptions.put(1, e); nbIgnored++; lineIndex++; diff --git a/lima-business/src/test/java/org/chorem/lima/business/ImportExportServiceTest.java b/lima-business/src/test/java/org/chorem/lima/business/ImportExportServiceTest.java index 94fdf75..757599f 100644 --- a/lima-business/src/test/java/org/chorem/lima/business/ImportExportServiceTest.java +++ b/lima-business/src/test/java/org/chorem/lima/business/ImportExportServiceTest.java @@ -106,7 +106,7 @@ public class ImportExportServiceTest extends AbstractLimaTest { // make sure all account have been created Assert.assertEquals(nbEntities, accountService.getAllAccounts().size()); Assert.assertEquals(nbEntities, result.getImportResults().get(0).getNbCreated()); - Assert.assertNull(result.getImportResults().get(0).getAllExceptionsByLine()); + Assert.assertTrue(result.getImportResults().get(0).getAllExceptionsByLine().isEmpty()); } finally { IOUtils.closeQuietly(contentStream); } @@ -118,7 +118,6 @@ public class ImportExportServiceTest extends AbstractLimaTest { ImportExportResults result = importService.importAccountAsCSV(inportStream); Assert.assertNotNull(result); Map<Integer, LimaException> exceptionMap = result.getImportResults().get(0).getAllExceptionsByLine(); - Assert.assertNotNull(exceptionMap); Collection<LimaException> exceptions = exceptionMap.values(); Assert.assertEquals(1, exceptions.size()); ImportFileException exception = (ImportFileException) exceptions.iterator().next(); @@ -158,7 +157,7 @@ public class ImportExportServiceTest extends AbstractLimaTest { Assert.assertEquals(nbEntities, entryBookService.getAllEntryBooks().size()); Assert.assertEquals(nbEntities, result.getNbCreated()); - Assert.assertNull(result.getAllExceptionsByLine()); + Assert.assertTrue(result.getAllExceptionsByLine().isEmpty()); } @Test @@ -215,7 +214,7 @@ public class ImportExportServiceTest extends AbstractLimaTest { Assert.assertEquals(nbEntities, entries.size()); Assert.assertEquals(nbEntities, result.getNbCreated()); - Assert.assertNull(result.getAllExceptionsByLine()); + Assert.assertTrue(result.getAllExceptionsByLine().isEmpty()); } @Test @@ -250,7 +249,7 @@ public class ImportExportServiceTest extends AbstractLimaTest { Assert.assertEquals(nbFiscalPeriods, fiscalPeriodService.getAllFiscalPeriods().size()); Assert.assertEquals(nbFiscalPeriods, result.getNbCreated()); - Assert.assertNull(result.getAllExceptionsByLine()); + Assert.assertTrue(result.getAllExceptionsByLine().isEmpty()); } @Test @@ -285,7 +284,7 @@ public class ImportExportServiceTest extends AbstractLimaTest { ImportResult importResult = importResults.get(i); log.info(imported[i] +": created:"+importResult.getNbCreated() + " updated:" + importResult.getNbUpdated() + " ignoded:" + importResult.getNbIgnored()); Assert.assertTrue(importResult.getNbCreated()>0); - Assert.assertNull(importResult.getAllExceptionsByLine()); + Assert.assertTrue(importResult.getAllExceptionsByLine().isEmpty()); } } @@ -445,7 +444,7 @@ public class ImportExportServiceTest extends AbstractLimaTest { result = importService.importFinancialStatementsAsCSV(bcr_developed).getImportResults().get(0); - Assert.assertNull(result.getAllExceptionsByLine()); + Assert.assertTrue(result.getAllExceptionsByLine().isEmpty()); Assert.assertEquals(162, result.getNbCreated()); Assert.assertEquals(162, financialStatementService.getAllFinancialStatements().size()); FinancialStatement actifImmobiliseStatement = financialStatementService.getFinancialStatementByLabel("ACTIF IMMOBILISÉ"); @@ -466,7 +465,7 @@ public class ImportExportServiceTest extends AbstractLimaTest { result = importService.importVATStatementsAsCSV(bcr_developed).getImportResults().get(0); - Assert.assertNull(result.getAllExceptionsByLine()); + Assert.assertTrue(result.getAllExceptionsByLine().isEmpty()); Assert.assertEquals(55, result.getNbCreated()); Assert.assertEquals(55, vatStatementService.getAllVatStatements().size()); } @@ -507,7 +506,7 @@ public class ImportExportServiceTest extends AbstractLimaTest { InputStream entriesStream = ImportExportServiceTest.class.getResourceAsStream("/ebp/ecritures.txt"); String entriesData = IOUtils.toString(entriesStream, "ISO-8859-1"); ImportResult result = importService.importEntriesFromEbp(entriesData).getImportResults().get(0); - Assert.assertNull(result.getAllExceptionsByLine()); + Assert.assertTrue(result.getAllExceptionsByLine().isEmpty()); Assert.assertEquals(28, result.getNbCreated()); entriesStream.close(); diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java b/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java index 6dfe168..9ff99bf 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java @@ -395,7 +395,7 @@ public class ImportExport { Class fromSource = result.getFromSource(); message.append("Import "); message.append(getFromSourceMessage(fromSource)); - message.append(result.getAllExceptionsByLine().size() > 0 ? "Des erreurs sont survenues lors de l'import, veuillez regarder le fichier de log pour plus de détails.\n" : "Aucune erreur rencontrée\n"); + message.append(result.getAllExceptionsByLine().isEmpty() ? "Aucune erreur rencontrée\n" : "Des erreurs sont survenues lors de l'import, veuillez regarder le fichier de log pour plus de détails.\n"); message.append(t("lima.import.report", result.getNbCreated(), result.getNbIgnored(), result.getNbUpdated())); logErrorMessage(result, fromSource); @@ -420,7 +420,7 @@ public class ImportExport { protected void logErrorMessage(ImportResult result,Class fromSource) { Map<Integer, LimaException> exceptionsByLine = result.getAllExceptionsByLine(); - if (exceptionsByLine != null) { + if (!exceptionsByLine.isEmpty()) { StringBuilder errorMessage = new StringBuilder(); errorMessage.append("\n" + "Import " + getFromSourceMessage(fromSource)); errorMessage.append("\n" + t("lima.import.report", result.getNbCreated(), result.getNbIgnored(), result.getNbUpdated())); @@ -701,7 +701,7 @@ public class ImportExport { protected ImportExportResults processBackup(ImportResult result, String tmpDir, String determinant) { ImportExportResults results = null; InputStream entryBooksStream = null, transactionsStream = null, fiscalPeriodsStream = null, accountsStream = null, entriesStream = null, identityStream = null; - if (result.getAllExceptionsByLine() == null || result.getAllExceptionsByLine().isEmpty()) { + if (result.getAllExceptionsByLine().isEmpty()) { try { entryBooksStream = new FileInputStream(tmpDir + EntryBook.class.getSimpleName() + "-" + determinant + ".csv"); String entryBooksStreamString = IOUtils.toString(entryBooksStream); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm