Skip to content
Permalink
Browse files
Merge pull request #9 from Izakey/FINCN-123
Migrate payroll service from MariaDB to PostgreSQL
  • Loading branch information
Izakey committed Sep 2, 2019
2 parents 6d758fa + 3527df3 commit d6b0c9a90664899a5891cecab178c1ce08a97569
Showing 12 changed files with 28 additions and 24 deletions.
@@ -1,5 +1,5 @@
Apache Fineract CN Payroll
Copyright [2017-2018] The Apache Software Foundation
Copyright [2017-2019] The Apache Software Foundation

This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
@@ -18,7 +18,6 @@
*/
package org.apache.fineract.cn.payroll;


import org.apache.fineract.cn.payroll.api.v1.EventConstants;
import org.apache.fineract.cn.payroll.api.v1.client.PayrollManager;
import org.apache.fineract.cn.payroll.service.PayrollServiceConfiguration;
@@ -74,8 +73,7 @@ public TestConfiguration() {

@ClassRule
public final static TenantDataStoreContextTestRule tenantDataStoreContext =
TenantDataStoreContextTestRule.forRandomTenantName(SuiteTestEnvironment.cassandraInitializer,
SuiteTestEnvironment.mariaDBInitializer);
TenantDataStoreContextTestRule.forRandomTenantName(cassandraInitializer, postgreSQLInitializer);

@Rule
public final TenantApplicationSecurityEnvironmentTestRule tenantApplicationSecurityEnvironment
@@ -20,7 +20,7 @@

import org.apache.fineract.cn.test.env.TestEnvironment;
import org.apache.fineract.cn.test.fixture.cassandra.CassandraInitializer;
import org.apache.fineract.cn.test.fixture.mariadb.MariaDBInitializer;
import org.apache.fineract.cn.test.fixture.postgresql.PostgreSQLInitializer;
import org.junit.ClassRule;
import org.junit.rules.RuleChain;
import org.junit.rules.RunExternalResourceOnce;
@@ -38,11 +38,11 @@ public class SuiteTestEnvironment {

static final TestEnvironment testEnvironment = new TestEnvironment(APP_NAME);
static final CassandraInitializer cassandraInitializer = new CassandraInitializer();
static final MariaDBInitializer mariaDBInitializer = new MariaDBInitializer();
static final PostgreSQLInitializer postgreSQLInitializer = new PostgreSQLInitializer();

@ClassRule
public static TestRule orderClassRules = RuleChain
.outerRule(new RunExternalResourceOnce(testEnvironment))
.around(new RunExternalResourceOnce(cassandraInitializer))
.around(new RunExternalResourceOnce(mariaDBInitializer));
.around(new RunExternalResourceOnce(postgreSQLInitializer));
}
@@ -57,7 +57,7 @@ dependencies {
[group: 'org.apache.fineract.cn', name: 'lang', version: versions.frameworklang],
[group: 'org.apache.fineract.cn', name: 'async', version: versions.frameworkasync],
[group: 'org.apache.fineract.cn', name: 'cassandra', version: versions.frameworkcassandra],
[group: 'org.apache.fineract.cn', name: 'mariadb', version: versions.frameworkmariadb],
[group: 'org.apache.fineract.cn', name: 'postgresql', version: versions.frameworkpostgresql],
[group: 'org.apache.fineract.cn', name: 'command', version: versions.frameworkcommand],
[group: 'org.hibernate', name: 'hibernate-validator', version: versions.validator]
)
@@ -26,7 +26,7 @@
import org.apache.fineract.cn.customer.api.v1.client.CustomerManager;
import org.apache.fineract.cn.lang.config.EnableServiceException;
import org.apache.fineract.cn.lang.config.EnableTenantContext;
import org.apache.fineract.cn.mariadb.config.EnableMariaDB;
import org.apache.fineract.cn.postgresql.config.EnablePostgreSQL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -46,7 +46,7 @@
@EnableAsync
@EnableTenantContext
@EnableCassandra
@EnableMariaDB
@EnablePostgreSQL
@EnableCommandProcessing
@EnableAnubis
@EnableServiceException
@@ -25,7 +25,7 @@
import org.apache.fineract.cn.command.annotation.CommandHandler;
import org.apache.fineract.cn.command.annotation.EventEmitter;
import org.apache.fineract.cn.lang.ApplicationName;
import org.apache.fineract.cn.mariadb.domain.FlywayFactoryBean;
import org.apache.fineract.cn.postgresql.domain.FlywayFactoryBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

@@ -26,7 +26,7 @@
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.fineract.cn.mariadb.util.LocalDateTimeConverter;
import org.apache.fineract.cn.postgresql.util.LocalDateTimeConverter;

@Entity
@Table(name = "meketre_payroll_collections")
@@ -26,7 +26,7 @@
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.fineract.cn.mariadb.util.LocalDateTimeConverter;
import org.apache.fineract.cn.postgresql.util.LocalDateTimeConverter;

@Entity
@Table(name = "meketre_payroll_configurations")
@@ -23,6 +23,11 @@ spring:
enabled: false
config:
enabled: false
datasource:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://localhost:5432/playground
username: postgres
password: postgres

eureka:
client:
@@ -42,13 +47,13 @@ cassandra:
write: LOCAL_QUORUM
delete: LOCAL_QUORUM

mariadb:
driverClass: org.mariadb.jdbc.Driver
postgresql:
driverClass: org.postgresql.Driver
database: seshat
host: localhost
port: 3306
user: root
password: mysql
port: 5432
user: postgres
password: postgres

bonecp:
idleMaxAgeInMinutes: 240
@@ -18,7 +18,7 @@
--

CREATE TABLE meketre_payroll_configurations (
id BIGINT NOT NULL AUTO_INCREMENT,
id BIGSERIAL NOT NULL,
customer_identifier VARCHAR(32) NOT NULL,
main_account_number VARCHAR(34) NOT NULL,
created_by VARCHAR(32) NOT NULL,
@@ -30,7 +30,7 @@ CREATE TABLE meketre_payroll_configurations (
);

CREATE TABLE meketre_payroll_allocations (
id BIGINT NOT NULL AUTO_INCREMENT,
id BIGSERIAL NOT NULL,
payroll_configuration_id BIGINT NOT NULL,
account_number VARCHAR(34) NOT NULL,
amount NUMERIC(15,5) NOT NULL,
@@ -41,7 +41,7 @@ CREATE TABLE meketre_payroll_allocations (
);

CREATE TABLE meketre_payroll_collections (
id BIGINT NOT NULL AUTO_INCREMENT,
id BIGSERIAL NOT NULL,
identifier VARCHAR(32) NOT NULL,
source_account_number VARCHAR(34) NOT NULL,
created_by VARCHAR(32) NOT NULL,
@@ -51,7 +51,7 @@ CREATE TABLE meketre_payroll_collections (
);

CREATE TABLE meketre_payroll_payments (
id BIGINT NOT NULL AUTO_INCREMENT,
id BIGSERIAL NOT NULL,
payroll_collection_id BIGINT NOT NULL,
customer_identifier VARCHAR(32) NOT NULL,
employer VARCHAR(256) NOT NULL,
@@ -23,7 +23,7 @@ ext.versions = [
frameworklang : '0.1.0-BUILD-SNAPSHOT',
frameworkasync : '0.1.0-BUILD-SNAPSHOT',
frameworkcassandra : '0.1.0-BUILD-SNAPSHOT',
frameworkmariadb : '0.1.0-BUILD-SNAPSHOT',
frameworkpostgresql : '0.1.0-BUILD-SNAPSHOT',
frameworkcommand : '0.1.0-BUILD-SNAPSHOT',
frameworktest: '0.1.0-BUILD-SNAPSHOT',
frameworkanubis: '0.1.0-BUILD-SNAPSHOT',
@@ -63,7 +63,8 @@ ext['spring-data-releasetrain.version'] = 'Gosling-SR2A'

dependencies {
compile(
[group: 'com.google.code.findbugs', name: 'jsr305']
[group: 'com.google.code.findbugs', name: 'jsr305'],
[group: 'org.apache.fineract.cn', name: 'postgresql', version: versions.frameworkpostgresql]
)

testCompile(

0 comments on commit d6b0c9a

Please sign in to comment.