Skip to content

Commit

Permalink
fix: test on clientDao
Browse files Browse the repository at this point in the history
  • Loading branch information
Nolife999 committed Nov 30, 2023
1 parent a34b3dd commit 529a5be
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ public void buildTableNameTokensSuffix() {
String client = "ARTEMIS";
long timestamp = System.currentTimeMillis();

assertEquals("arc_bas2.artemis_"+timestamp+"_pilotage_fichier", TableNaming.buildTableNameWithTokens("arc_bas2", ViewEnum.PILOTAGE_FICHIER, client, timestamp));
assertEquals("arc_bas2.artemis_"+timestamp+"_id_source", TableNaming.buildTableNameWithTokens("arc_bas2", ColumnEnum.ID_SOURCE, client, timestamp));
assertEquals("arc_bas2.ARTEMIS_"+timestamp+"_pilotage_fichier", TableNaming.buildTableNameWithTokens("arc_bas2", ViewEnum.PILOTAGE_FICHIER, client, timestamp));
assertEquals("arc_bas2.ARTEMIS_"+timestamp+"_id_source", TableNaming.buildTableNameWithTokens("arc_bas2", ColumnEnum.ID_SOURCE, client, timestamp));
assertEquals(null, TableNaming.buildTableNameWithTokens("arc_bas2", ColumnEnum.ID_SOURCE, null, timestamp));
assertEquals("arc_bas2.artemis_"+timestamp+"_test", TableNaming.buildTableNameWithTokens("arc_bas2", "test", client, timestamp));
assertEquals("arc_bas2.ARTEMIS_"+timestamp+"_test", TableNaming.buildTableNameWithTokens("arc_bas2", "test", client, timestamp));
assertEquals("arc_bas2.test", TableNaming.buildTableNameWithTokens("arc_bas2", "TEST"));

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ public boolean verificationClientFamille() throws ArcException {
ArcPreparedStatementBuilder request = new ArcPreparedStatementBuilder();
request.append("SELECT EXISTS (SELECT 1 FROM arc.ihm_client")
.append(" WHERE id_application=" + request.quoteText(client))
.append(" AND id_famille=" + request.quoteText(famille)).append(" LIMIT 1);");
.append(" AND id_famille=" + request.quoteText(famille))
.append(" LIMIT 1);");

String bool = UtilitaireDao.get(0).executeRequestWithoutMetadata(connection, request).get(0).get(0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,18 @@ public class ClientDaoTest extends InitializeQueryTest {
@Test
public void clientDaoTest() throws ArcException, SQLException {

InitializeQueryTest.buildPropertiesWithoutScalability("any");
InitializeQueryTest.buildPropertiesWithoutScalability(null);

PropertiesHandler p = PropertiesHandler.getInstance();

initializeTestData();

testVerificationFamilleOK();
testVerificationFamilleKO();

testSelectBusinessDataTables();

destroyTestData();
// destroyTestData();
}

private void testSelectBusinessDataTables() throws ArcException {
Expand All @@ -47,7 +49,6 @@ private void testSelectBusinessDataTables() throws ArcException {
assertEquals(2,clientTables.size());
}

@Test
public void testVerificationFamilleOK() throws ArcException {
JSONObject json = new JSONObject(
"{\"client\":\"ARTEMIS\",\"environnement\":\"arc.bas1\",\"familleNorme\":\"DSN\",\"format\":\"csv_gzip\"}");
Expand All @@ -56,7 +57,6 @@ public void testVerificationFamilleOK() throws ArcException {
assertTrue(clientDao.verificationClientFamille());
}

@Test
public void testVerificationFamilleKO() throws ArcException {
JSONObject json = new JSONObject(
"{\"client\":\"ARTEMIS\",\"environnement\":\"arc.bas1\",\"familleNorme\":\"BATI\",\"format\":\"csv_gzip\"}");
Expand All @@ -80,7 +80,7 @@ private void initializeTestData() throws SQLException, ArcException {
query.append("SELECT 'DSN' as id_famille,'DSNFLASH' as id_application");
query.append(SQL.END_QUERY);

query.append("CREATE TABLE arc_bas1.ihm_mod_table_metier AS ");
query.append("CREATE TABLE arc_bas1.mod_table_metier AS ");
query.append("SELECT 'DSN' as id_famille,'mapping_dsn_test1_ok' as nom_table_metier UNION ALL ");
query.append("SELECT 'DSN' as id_famille,'mapping_dsn_test2_ok' as nom_table_metier UNION ALL ");
query.append("SELECT 'PASRAU' as id_famille,'mapping_pasrau_test_ok' as nom_table_metier");
Expand Down

0 comments on commit 529a5be

Please sign in to comment.