Fixed issues connecting to the databases
diff --git a/component-test/src/main/resources/application.yaml b/component-test/src/main/resources/application.yaml
index adc4ffa..9e3bd4f 100644
--- a/component-test/src/main/resources/application.yaml
+++ b/component-test/src/main/resources/application.yaml
@@ -26,4 +26,11 @@
activemq:
brokerUrl: vm://localhost?broker.persistent=false
- concurrency: 3-10
\ No newline at end of file
+ concurrency: 3-10
+
+spring:
+ datasource:
+ driver-class-name: org.postgresql.Driver
+ url: jdbc:postgresql://localhost:5432/seshat
+ username: postgres
+ password: postgres
\ No newline at end of file
diff --git a/service/src/main/java/org/apache/fineract/cn/provisioner/internal/util/DataSourceUtils.java b/service/src/main/java/org/apache/fineract/cn/provisioner/internal/util/DataSourceUtils.java
index 3560830..f8c89a6 100644
--- a/service/src/main/java/org/apache/fineract/cn/provisioner/internal/util/DataSourceUtils.java
+++ b/service/src/main/java/org/apache/fineract/cn/provisioner/internal/util/DataSourceUtils.java
@@ -18,6 +18,7 @@
*/
package org.apache.fineract.cn.provisioner.internal.util;
+import org.apache.fineract.cn.postgresql.util.PostgreSQLConstants;
import org.springframework.core.env.Environment;
import org.apache.fineract.cn.postgresql.util.JdbcUrlBuilder;
@@ -39,6 +40,7 @@
} catch (ClassNotFoundException cnfex) {
throw new IllegalArgumentException(cnfex.getMessage(), cnfex);
}
+
final String jdbcUrl = JdbcUrlBuilder
.create(JdbcUrlBuilder.DatabaseType.POSTGRESQL)
.host(databaseConnectionInfo.getHost())
@@ -62,7 +64,9 @@
public static Connection createProvisionerConnection(final Environment environment, String databaseName) {
final DatabaseConnectionInfo databaseConnectionInfo = new DatabaseConnectionInfo();
databaseConnectionInfo.setDriverClass(environment.getProperty("postgresql.driverClass"));
- databaseConnectionInfo.setDatabaseName(environment.getProperty(databaseName));
+ databaseName = databaseName.equals(PostgreSQLConstants.POSTGRESQL_DATABASE_NAME_DEFAULT) ? PostgreSQLConstants.POSTGRESQL_DATABASE_NAME_DEFAULT :
+ (databaseName.equals("playground") ? "playground" : "postgres");
+ databaseConnectionInfo.setDatabaseName(databaseName);
databaseConnectionInfo.setHost(environment.getProperty("postgresql.host"));
databaseConnectionInfo.setPort(environment.getProperty("postgresql.port"));
databaseConnectionInfo.setUser(environment.getProperty("postgresql.user"));