From 429bee7afdc695e269d3dcfaabbc65b11cafed4d Mon Sep 17 00:00:00 2001 From: Manuel Soulier Date: Mon, 27 Nov 2023 08:41:07 +0100 Subject: [PATCH] feat: ExportFormat test --- .../ImportStep3GetTableDataService.java | 2 +- .../services/importServlet/bo/ExportFormat.java | 4 ++++ .../importServlet/bo/ExportFormatTest.java | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 arc-ws/src/test/java/fr/insee/arc/ws/services/importServlet/bo/ExportFormatTest.java diff --git a/arc-ws/src/main/java/fr/insee/arc/ws/services/importServlet/ImportStep3GetTableDataService.java b/arc-ws/src/main/java/fr/insee/arc/ws/services/importServlet/ImportStep3GetTableDataService.java index b6a004721..c1f8e325d 100644 --- a/arc-ws/src/main/java/fr/insee/arc/ws/services/importServlet/ImportStep3GetTableDataService.java +++ b/arc-ws/src/main/java/fr/insee/arc/ws/services/importServlet/ImportStep3GetTableDataService.java @@ -37,7 +37,7 @@ public void execute(SendResponse resp) throws ArcException { // binary transfer ServiceDao.execQueryExportDataToResponse(resp.getWr(), - ViewEnum.normalizeTableName(arcClientIdentifier.getClient()), this.arcClientIdentifier.getFormat().equals(ExportFormat.CSV_GZIP.getFormat())); + ViewEnum.normalizeTableName(arcClientIdentifier.getClient()), ExportFormat.isCsv(this.arcClientIdentifier.getFormat())); if (this.clientDao.isWebServiceNotPending()) { this.clientDao.dropTable(arcClientIdentifier.getClient()); diff --git a/arc-ws/src/main/java/fr/insee/arc/ws/services/importServlet/bo/ExportFormat.java b/arc-ws/src/main/java/fr/insee/arc/ws/services/importServlet/bo/ExportFormat.java index cda9690cc..987dfb252 100644 --- a/arc-ws/src/main/java/fr/insee/arc/ws/services/importServlet/bo/ExportFormat.java +++ b/arc-ws/src/main/java/fr/insee/arc/ws/services/importServlet/bo/ExportFormat.java @@ -14,5 +14,9 @@ private ExportFormat(String format) public String getFormat() { return format; } + + public static boolean isCsv(String clientFormat) { + return clientFormat.equals(CSV_GZIP.toString()); + } } diff --git a/arc-ws/src/test/java/fr/insee/arc/ws/services/importServlet/bo/ExportFormatTest.java b/arc-ws/src/test/java/fr/insee/arc/ws/services/importServlet/bo/ExportFormatTest.java new file mode 100644 index 000000000..44e7a74ee --- /dev/null +++ b/arc-ws/src/test/java/fr/insee/arc/ws/services/importServlet/bo/ExportFormatTest.java @@ -0,0 +1,15 @@ +package fr.insee.arc.ws.services.importServlet.bo; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class ExportFormatTest { + + @Test + public void isCsv() { + assertFalse(ExportFormat.isCsv(ExportFormat.BINARY.toString())); + assertTrue(ExportFormat.isCsv(ExportFormat.CSV_GZIP.toString())); + } + +}