Skip to content

Commit

Permalink
fix: exportDao test
Browse files Browse the repository at this point in the history
  • Loading branch information
Nolife999 committed Oct 4, 2023
1 parent 2e207ec commit 6e58c98
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void startExportUpdateState(List<String> fileName, int fileIndex, boolean
* @return
* @throws ArcException
*/
private HashMap<String, ArrayList<String>> exportFileRetrieveRules(int n, List<String> howToExport,
protected HashMap<String, ArrayList<String>> exportFileRetrieveRules(int n, List<String> howToExport,
List<String> tablesToExport, String bacASable) throws ArcException {
// if columns,orders table is specified, get the information from database metadata
String howToExportReworked;
Expand All @@ -120,10 +120,13 @@ private HashMap<String, ArrayList<String>> exportFileRetrieveRules(int n, List<S
}

public ResultSet exportFileFilteredOrdered(Statement stmt, int n, List<String> tablesToExport, List<String> filterTable, List<String> orderTable, String bacASable) throws SQLException {

ArcPreparedStatementBuilder query = new ArcPreparedStatementBuilder();
query.build(SQL.SELECT, "*", SQL.FROM, bacASable, SQL.DOT, tablesToExport.get(n),
SQL.WHERE, (StringUtils.isEmpty(filterTable.get(n)) ? SQL.TRUE : filterTable.get(n)), " ",
(StringUtils.isEmpty(orderTable.get(n)) ? "" : SQL.ORDER_BY + orderTable.get(n)), " ");

query.build(SQL.SELECT, "*", SQL.FROM, ViewEnum.getFullName(bacASable, tablesToExport.get(n)));
query.build(SQL.WHERE, (StringUtils.isEmpty(filterTable.get(n)) ? SQL.TRUE : filterTable.get(n)), " ");
query.build((StringUtils.isEmpty(orderTable.get(n)) ? "" : SQL.ORDER_BY + orderTable.get(n)), " ");

return stmt.executeQuery(query.getQuery().toString());
}

Expand Down
2 changes: 2 additions & 0 deletions arc-web/src/main/resources/messages_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ export.error.filesystem=Export failed because of file system problem
export.file.delete.error=Deletion of file {0} failed
export.file.rename.error=Renaming failed

pilotage.error.download.archive=Archive download failed

query.complete=Query complete!

gui.help=Help
Expand Down
2 changes: 2 additions & 0 deletions arc-web/src/main/resources/messages_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ export.error.filesystem=L'export a \u00e9chou\u00e9 \u00e0 cause d'un probl\u00e
export.file.delete.error=La suppression du fichier {0} a \u00e9chou\u00e9
export.file.rename.error=Le renommage a \u00e9chou\u00e9

pilotage.error.download.archive=Le t\u00e9l\u00e9chargement de l'archve a \u00e9chou\u00e9

query.complete=Requ\u00eate termin\u00e9e !

gui.help=Aide
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void exportFileRetrieve() throws ArcException {
tablesToExport.add("export");

// execute query
HashMap<String, ArrayList<String>> retrievedData = pdao.exportFileRetrieve(0, howToExport, tablesToExport, BddPatcherTest.testSandbox1);
HashMap<String, ArrayList<String>> retrievedData = pdao.exportFileRetrieveRules(0, howToExport, tablesToExport, BddPatcherTest.testSandbox1);

// test the content of the view
assertEquals(3, retrievedData.keySet().size()); // 3 columns selected
Expand Down

0 comments on commit 6e58c98

Please sign in to comment.