Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ COPY ./docker/server.xml /opt/bitnami/tomcat/conf
RUN chmod 664 /opt/bitnami/tomcat/conf/server.xml

WORKDIR /opt/bitnami/tomcat/lib
# org.drizzle.jdbc.DrizzleDriver is used in docker/server.xml for jdbc/fineract_tenants DataSource
# (But note that connections to individual tenant DBs may use another driver...)
# org.drizzle.jdbc.DrizzleDriver is used by default for both the all tenants and demo tenant DB DataSource
RUN wget https://repo1.maven.org/maven2/org/drizzle/jdbc/drizzle-jdbc/1.4/drizzle-jdbc-1.4.jar

# https://issues.apache.org/jira/browse/LEGAL-462
# https://issues.apache.org/jira/browse/FINERACT-762
# We include an alternative JDBC driver (which is faster, but not allowed to be default in Apache distribution)
# allowing implementations to switch the driver used by changing start-up parameters (for both tenants and each tenant DB)
# The commented out lines in the docker-compose.yml illustrate how to do this.
# To be sure that this instead of Drizlle is used, comment out wget above.
RUN wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.19/mysql-connector-java-8.0.19.jar
7 changes: 6 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ services:
depends_on:
- fineractmysql
environment:
- JAVA_OPTS=-Djava.awt.headless=true -XX:+UseG1GC -Dfile.encoding=UTF-8
- DRIVERCLASS_NAME=org.drizzle.jdbc.DrizzleDriver
- PROTOCOL=jdbc
- SUB_PROTOCOL=mysql:thin
Expand All @@ -55,3 +54,9 @@ services:
- FINERACT_DEFAULT_TENANTDB_PORT=3306
- FINERACT_DEFAULT_TENANTDB_UID=root
- FINERACT_DEFAULT_TENANTDB_PWD=skdcnwauicn2ucnaecasdsajdnizucawencascdca

# https://issues.apache.org/jira/browse/FINERACT-762
# To use an altnerative JDBC driver (which is faster, but not allowed to be default in Apache distribution)
# replace org.drizzle.jdbc.DrizzleDriver with com.mysql.jdbc.Driver in DRIVERCLASS_NAME and fineract_tenants_driver,
# and remove ":thin:" from SUB_PROTOCOL and fineract_tenants_url. Note that the mysql-connector-java-*.jar is already
# bundled in the container by the Dockerfile, but just not used by default.
10 changes: 10 additions & 0 deletions fineract-provider/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ rat {
'**/*.json',
'**/*.txt',
'**/*.log',
'**/props/**',
'**/fineractdev-eclipse-preferences.epf',
'**/template-expected.html',
'**/template.mustache',
Expand Down Expand Up @@ -280,8 +281,10 @@ configurations {
/* Pick up dependencies based on the environemnt, defaults to production */
if (project.hasProperty('env') && project.getProperty('env') == 'dev') {
apply from: 'dev-dependencies.gradle'
apply from: rootProject.file('install-git-hooks.gradle')
} else {
apply from: 'dependencies.gradle'
apply from: rootProject.file('install-git-hooks.gradle')
}

/* Enable Oauth2 authentication based on environment, default to HTTP basic auth */
Expand Down Expand Up @@ -500,6 +503,7 @@ repositories {
}
configurations {
driver
installGitHooks
}
dependencies {
driver 'org.drizzle.jdbc:drizzle-jdbc:1.4'
Expand Down Expand Up @@ -567,3 +571,9 @@ tasks.withType(SpotBugsTask) {
reports.html.enabled = true
reportLevel = "high"
}

afterEvaluate {
// We install the hook at the first occasion
tasks['clean'].dependsOn installGitHooks
tasks['assemble'].dependsOn installGitHooks
}
3 changes: 2 additions & 1 deletion fineract-provider/config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
<property name="sortImportsInGroupAlphabetically" value="true"/>
<property name="customImportOrderRules" value="STATIC###THIRD_PARTY_PACKAGE"/>
</module>
<module name="OneStatementPerLine"/>

<!-- TODO Enable many more checks (go about this one by one, step by step, raise separate PRs fixing and then enforcing):

Expand Down Expand Up @@ -130,7 +131,7 @@
value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
</module>
<module name="ParenPad" />
<module name="OneStatementPerLine"/>

<module name="MultipleVariableDeclarations"/>
<module name="ArrayTypeStyle"/>
<module name="MissingSwitchDefault"/>
Expand Down
48 changes: 48 additions & 0 deletions fineract-provider/install-git-hooks.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
static def isLinuxOrMacOs() {
def osName = System.getProperty('os.name').toLowerCase(Locale.ROOT)
return osName.contains('linux') || osName.contains('mac os') || osName.contains('macos')
}

def gitDir = new File(rootProject.projectDir, "../")

task copyGitHooks(type: Copy) {
description 'Copies the git hooks from props/git-hooks to the .git folder.'
from("${gitDir}/props/") {
include '**/*.sh'
rename '(.*).sh', '$1'
}
into "${gitDir}/.git/hooks"
onlyIf { isLinuxOrMacOs() }
}


task installGitHooks(type: Exec) {
description 'Installs the pre-commit git hooks from team-props/git-hooks.'
group 'git hooks'
workingDir gitDir
commandLine 'chmod'
args '-R', '+x', '.git/hooks/'
dependsOn copyGitHooks
onlyIf { isLinuxOrMacOs() }
doLast {
logger.info('Git hook installed successfully.')
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import org.joda.time.format.DateTimeFormatter;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

/**
Expand Down Expand Up @@ -1909,6 +1910,7 @@ public void testSavingsAccount_WITH_WITHHOLD_TAX_DISABLE_AT_ACCOUNT_LEVEL() {
}

@Test
@Ignore // TODO FINERACT-852
public void testSavingsAccount_DormancyTracking() throws InterruptedException {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ public CommandProcessingResult update(final JsonCommand command) {
for (EmailConfiguration config : configurations) {
if(config.getName() !=null){
String value = command.stringValueOfParameterNamed(config.getName());
config.setValue(value); changes.put(config.getName(),value);
config.setValue(value);
changes.put(config.getName(),value);
this.repository.saveAndFlush(config);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,40 +30,25 @@ public class JDBCDriverConfig {
private final static String DRIVER_CLASS_PROPERTYNAME = "DRIVERCLASS_NAME";
private final static String PROTOCOL_PROPERTYNAME = "PROTOCOL";
private final static String SUBPROTOCOL_PROPERTYNAME = "SUB_PROTOCOL";
private final static String PORT_PROPERTYNAME = "PORT";

private String driverClassName;
private String protocol;
private String subProtocol;
private Integer port;

@Autowired ApplicationContext context;

@PostConstruct
protected void init() {
Environment environment = context.getEnvironment() ;
driverClassName = environment.getProperty(DRIVER_CLASS_PROPERTYNAME) ;
protocol = environment.getProperty(PROTOCOL_PROPERTYNAME) ;
subProtocol = environment.getProperty(SUBPROTOCOL_PROPERTYNAME) ;
port = Integer.parseInt(environment.getProperty(PORT_PROPERTYNAME)) ;
Environment environment = context.getEnvironment();
driverClassName = environment.getProperty(DRIVER_CLASS_PROPERTYNAME);
protocol = environment.getProperty(PROTOCOL_PROPERTYNAME);
subProtocol = environment.getProperty(SUBPROTOCOL_PROPERTYNAME);
}

public String getDriverClassName() {
return this.driverClassName;
}

public String getProtocol() {
return this.protocol;
}

public String getSubProtocol() {
return this.subProtocol;
}

public Integer getPort() {
return this.port;
}

public String constructProtocol(String schemaServer, String schemaServerPort, String schemaName) {
final String url = new StringBuilder(protocol).append(":").append(subProtocol).append("://").append(schemaServer).append(':').append(schemaServerPort)
.append('/').append(schemaName).toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private DataSource createNewDataSourceFor(final FineractPlatformTenantConnection
config.addDataSourceProperty("maintainTimeStats", "false");

// https://github.com/brettwooldridge/HikariCP/wiki/JDBC-Logging#mysql-connectorj
config.addDataSourceProperty("logger", "com.mysql.jdbc.log.StandardLogger");
// TODO FINERACT-890: config.addDataSourceProperty("logger", "com.mysql.cj.log.Slf4JLogger");
config.addDataSourceProperty("logSlowQueries", "true");
config.addDataSourceProperty("dumpQueriesOnException", "true");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,17 @@ public static CashierTxnType getCashierTxnType (Integer id) {

switch(id) {
case 101:
retVal = ALLOCATE; break;
retVal = ALLOCATE;
break;
case 102:
retVal = SETTLE; break;
retVal = SETTLE;
break;
case 103:
retVal = INWARD_CASH_TXN; break;
retVal = INWARD_CASH_TXN;
break;
case 104:
retVal = OUTWARD_CASH_TXN; break;
retVal = OUTWARD_CASH_TXN;
break;
default:
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private GetUsersUserIdResponse() {
@ApiModelProperty(example = "false")
public Boolean passwordNeverExpires;
public StaffData staff;
public Collection<RoleData> availableRoles;;
public Collection<RoleData> availableRoles;
public Collection<RoleData> selectedRoles;

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<prop key="maintainTimeStats">false</prop>

<!-- https://github.com/brettwooldridge/HikariCP/wiki/JDBC-Logging#mysql-connectorj -->
<prop key="logger">com.mysql.jdbc.log.StandardLogger</prop>
<!-- TODO FINERACT-890: <prop key="logger">com.mysql.cj.log.Slf4JLogger</prop> -->
<prop key="logSlowQueries">true</prop>
<prop key="dumpQueriesOnException">true</prop>
</props>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
DRIVERCLASS_NAME:org.drizzle.jdbc.DrizzleDriver
PROTOCOL:jdbc
SUB_PROTOCOL:mysql:thin
PORT:3306

fineract_tenants_driver:org.drizzle.jdbc.DrizzleDriver
fineract_tenants_url:jdbc:mysql:thin://localhost:3306/fineract_tenants
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
-- under the License.
--

update m_permission set grouping="organisation" where grouping = "organistion";
update m_permission set `grouping`="organisation" where grouping = "organistion";
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ INSERT INTO c_configuration (`name`, `enabled`) VALUES ('allow-pending-client-st
INSERT INTO c_configuration (`name`, `enabled`) VALUES ('allow-pending-group-status', '0');


INSERT INTO .`r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`)
INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`)
VALUES ('status_id', '0', 'Invalid', 'Invalid');
INSERT INTO .`r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`)
INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`)
VALUES ('status_id', '100', 'Pending', 'Pending');
INSERT INTO .`r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`)
INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`)
VALUES ('status_id', '300', 'Active', 'Active');
INSERT INTO .`r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`)
INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`)
VALUES ('status_id', '600', 'Closed', 'Closed');
INSERT INTO .`r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`)
VALUES ('loan_status_id', '0', 'Invalid', 'Invalid');
INSERT INTO `r_enum_value` (`enum_name`, `enum_id`, `enum_message_property`, `enum_value`)
VALUES ('loan_status_id', '0', 'Invalid', 'Invalid');
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ CREATE TABLE `m_savings_officer_assignment_history` (
CONSTRAINT `fk_m_savings_officer_assignment_history_0002` FOREIGN KEY (`savings_officer_id`) REFERENCES `m_staff` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

insert into m_permission (grouping,code,entity_name,action_name) values ('portfolio','REMOVESAVINGSOFFICER_SAVINGSACCOUNT','SAVINGSACCOUNT','REMOVESAVINGSOFFICER');
insert into m_permission (grouping,code,entity_name,action_name) values ('portfolio','UPDATESAVINGSOFFICER_SAVINGSACCOUNT','SAVINGSACCOUNT','UPDATESAVINGSOFFICER');
insert into m_permission (`grouping`,code,entity_name,action_name) values ('portfolio','REMOVESAVINGSOFFICER_SAVINGSACCOUNT','SAVINGSACCOUNT','REMOVESAVINGSOFFICER');
insert into m_permission (`grouping`,code,entity_name,action_name) values ('portfolio','UPDATESAVINGSOFFICER_SAVINGSACCOUNT','SAVINGSACCOUNT','UPDATESAVINGSOFFICER');

Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
--


update m_permission set grouping = 'configuration' where entity_name = 'report';
update m_permission set `grouping` = 'configuration' where entity_name = 'report';
Original file line number Diff line number Diff line change
Expand Up @@ -69,42 +69,42 @@ CREATE TABLE `m_cashier_transactions` (


INSERT INTO m_permission (
grouping, code, entity_name, action_name, can_maker_checker
`grouping`, code, entity_name, action_name, can_maker_checker
) values (
'cash_mgmt', 'CREATE_TELLER', 'TELLER', 'CREATE', 1
);
INSERT INTO m_permission (
grouping, code, entity_name, action_name, can_maker_checker
`grouping`, code, entity_name, action_name, can_maker_checker
) values (
'cash_mgmt', 'UPDATE_TELLER', 'TELLER', 'CREATE', 1
);

INSERT INTO m_permission (
grouping, code, entity_name, action_name, can_maker_checker
`grouping`, code, entity_name, action_name, can_maker_checker
) values (
'cash_mgmt', 'ALLOCATECASHIER_TELLER', 'TELLER', 'ALLOCATE', 1
);

INSERT INTO m_permission (
grouping, code, entity_name, action_name, can_maker_checker
`grouping`, code, entity_name, action_name, can_maker_checker
) values (
'cash_mgmt', 'UPDATECASHIERALLOCATION_TELLER', 'TELLER', 'UPDATECASHIERALLOCATION', 1
);

INSERT INTO m_permission (
grouping, code, entity_name, action_name, can_maker_checker
`grouping`, code, entity_name, action_name, can_maker_checker
) values (
'cash_mgmt', 'DELETECASHIERALLOCATION_TELLER', 'TELLER', 'DELETECASHIERALLOCATION', 1
);

INSERT INTO m_permission (
grouping, code, entity_name, action_name, can_maker_checker
`grouping`, code, entity_name, action_name, can_maker_checker
) values (
'cash_mgmt', 'ALLOCATECASHTOCASHIER_TELLER', 'TELLER', 'ALLOCATECASHTOCASHIER', 1
);

INSERT INTO m_permission (
grouping, code, entity_name, action_name, can_maker_checker
`grouping`, code, entity_name, action_name, can_maker_checker
) values (
'cash_mgmt', 'SETTLECASHFROMCASHIER_TELLER', 'TELLER', 'SETTLECASHFROMCASHIER', 1
);
Expand All @@ -123,4 +123,4 @@ CREATE TABLE `m_cashier_transactions` (
enum_name, enum_id, enum_message_property, enum_value, enum_type
) values (
'teller_status', 600, 'Closed', 'Closed',0
);
);
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ VALUES (
NULL , '^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\\s).{6,50}$', 'Password must be at least 6 characters, no more than 50 characters long, must include at least one upper case letter, one lower case letter, one numeric digit and no space', '0'
);

INSERT INTO m_permission (grouping, code, entity_name, action_name, can_maker_checker)
INSERT INTO m_permission (`grouping`, code, entity_name, action_name, can_maker_checker)
VALUE ("authorisation","READ_PASSWORD_PREFERENCES","PASSWORD_PREFERENCES","READ",0);

INSERT INTO m_permission (grouping, code, entity_name, action_name, can_maker_checker)
INSERT INTO m_permission (`grouping`, code, entity_name, action_name, can_maker_checker)
VALUE ("authorisation","UPDATE_PASSWORD_PREFERENCES","PASSWORD_PREFERENCES","UPDATE",0);

INSERT INTO m_permission (grouping, code, entity_name, action_name, can_maker_checker)
INSERT INTO m_permission (`grouping`, code, entity_name, action_name, can_maker_checker)
VALUE ("authorisation","UPDATE_PASSWORD_PREFERENCES_CHECKER","PASSWORD_PREFERENCES","UPDATE_CHECKER",0);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ALTER TABLE `m_staff`
ADD CONSTRAINT `FK_m_staff_m_image` FOREIGN KEY (`image_id`) REFERENCES `m_image` (`id`);

INSERT INTO m_permission (
grouping ,
`grouping` ,
code ,
entity_name ,
action_name ,
Expand All @@ -32,4 +32,4 @@ can_maker_checker
('portfolio', 'CREATE_STAFFIMAGE', 'STAFFIMAGE', 'CREATE', '1'),
('portfolio', 'CREATE_STAFFIMAGE_CHECKER', 'STAFFIMAGE', 'CREATE', '0'),
('portfolio', 'DELETE_STAFFIMAGE', 'STAFFIMAGE', 'DELETE', '1'),
('portfolio', 'DELETE_STAFFIMAGE_CHECKER', 'STAFFIMAGE', 'DELETE', '0');
('portfolio', 'DELETE_STAFFIMAGE_CHECKER', 'STAFFIMAGE', 'DELETE', '0');
Loading