Skip to content

Commit

Permalink
fix: setting new connection properties reset the connection attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Nolife999 committed Oct 8, 2023
1 parent 480082e commit 477c1a0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ public String getDatabaseUrl() {

public void setDatabaseUrl(String databaseUrl) {
this.databaseUrl = databaseUrl;
// reset the connection getter
this.connectionProperties=null;
}

public String getDatabaseUsername() {
Expand All @@ -106,6 +108,8 @@ public String getDatabaseUsername() {

public void setDatabaseUsername(String databaseUsername) {
this.databaseUsername = databaseUsername;
// reset the connection getter
this.connectionProperties=null;
}

public String getDatabasePassword() {
Expand All @@ -114,6 +118,8 @@ public String getDatabasePassword() {

public void setDatabasePassword(String databasePassword) {
this.databasePassword = databasePassword;
// reset the connection getter
this.connectionProperties=null;
}

public String getDatabaseDriverClassName() {
Expand All @@ -122,6 +128,8 @@ public String getDatabaseDriverClassName() {

public void setDatabaseDriverClassName(String databaseDriverClassName) {
this.databaseDriverClassName = databaseDriverClassName;
// reset the connection getter
this.connectionProperties=null;
}

public String getDatabaseSchema() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ public class UtilitaireDaoTest extends InitializeQueryTest {

@Test
public void numberOfNods_test() {

u.getProperties().setConnectionProperties(null);
u.getProperties().setDatabaseUrl("{0=>\"db1\"},{1=>\"db2\"}");
u.getProperties().setDatabaseUsername("{0=>\"db1\"},{1=>\"db2\"}");
u.getProperties().setDatabasePassword("{0=>\"db1\"},{1=>\"db2\"}");
Expand All @@ -36,7 +34,6 @@ public void numberOfNods_test() {
public void getDriverConnexion_OK() throws SQLException, ArcException {

PropertiesHandler testProperties=new PropertiesHandler();
testProperties.setConnectionProperties(null);
testProperties.setDatabaseDriverClassName("org.postgresql.Driver");
testProperties.setDatabaseUrl(c.getMetaData().getURL());
testProperties.setDatabaseUsername(c.getMetaData().getUserName());
Expand All @@ -62,6 +59,7 @@ public void getDriverConnexion_KO() throws SQLException, ArcException {
u.getProperties().setDatabasePassword("NA");

u.getDriverConnexion();

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ protected static void buildProperties(String repertoire, Connection[] connection
PropertiesHandler testProperties=PropertiesHandler.getInstance();

// reset connection properties
testProperties.setConnectionProperties(null);

StringBuilder url=new StringBuilder();
StringBuilder username=new StringBuilder();
StringBuilder password=new StringBuilder();
Expand Down

0 comments on commit 477c1a0

Please sign in to comment.