Skip to content

Commit

Permalink
BAH-3939 | Fix. Update Dependency Versions (#58)
Browse files Browse the repository at this point in the history
* Parvathy | BAH-3939 | Upgrade Spring Boot Version From 1.5.22.RELEASE To 2.0.0.RELEASE

* Parvathy | BAH-3939 | Upgrade Spring Boot Version To 2.0.9. RELEASE

* Parvathy | BAH-3939 | Upgrade Spring Boot Version To 2.1.0.RELEASE

* Parvathy | BAH-3939 | Upgrade Spring Boot Version To 2.1.18.RELEASE

* Parvathy | BAH-3939 | Upgrade Spring Boot Version To 2.2.0.RELEASE

* Parvathy | BAH-3939 | Upgrade Spring Boot Version To 2.5.15

* Parvathy | BAH-3939 | Fix. Upgrade mysql-connector-java Version To 8.0.28
  • Loading branch information
parvathy00 authored Jul 4, 2024
1 parent e6d196d commit 284d9ab
Show file tree
Hide file tree
Showing 19 changed files with 183 additions and 156 deletions.
76 changes: 39 additions & 37 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
buildscript {
ext {
springBootVersion = '1.5.22.RELEASE'
springBootVersion = '2.5.15'
dependencyCheckVersion = '3.1.2'
}
repositories {
Expand All @@ -13,11 +13,12 @@ buildscript {
}

plugins {
id "nebula.ospackage" version "4.5.1"
id "nebula.ospackage" version "8.4.2"
}

apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
apply plugin: 'org.owasp.dependencycheck'
Expand Down Expand Up @@ -72,39 +73,40 @@ jacocoTestCoverageVerification {
check.dependsOn jacocoTestCoverageVerification

dependencies {
compile('org.springframework.boot:spring-boot-starter')
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.13'
compile group: 'ch.qos.logback', name: 'logback-core', version: '1.2.13'
compile group: 'org.yaml', name: 'snakeyaml', version: '2.0'
compile("org.springframework.boot:spring-boot-starter-batch")
compile group: 'org.springframework', name: 'spring-beans', version: '5.3.20'
compile group: 'org.springframework', name: 'spring-core', version: '5.3.27'
compile group: 'org.springframework', name: 'spring-expression', version: '5.3.27'
compile group: 'org.codehaus.jettison', name: 'jettison', version: '1.5.4'
compile group: 'com.thoughtworks.xstream', name: 'xstream', version: '1.4.20'
compile group: 'com.google.protobuf', name: 'protobuf-java', version: '3.21.7'
compile("org.springframework.batch:spring-batch-test")
compile group: 'junit', name: 'junit', version: '4.13.1'
compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.42'
compile group: 'org.postgresql', name: 'postgresql', version: '42.3.9'
compile group: 'org.apache.commons', name: 'commons-dbcp2', version: '2.3.0'
compile group: 'commons-io', name: 'commons-io', version: '2.7'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.7'
compile group: 'org.freemarker', name: 'freemarker', version: '2.3.23'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.9'
compile "com.github.jsqlparser:jsqlparser:1.1"
compile 'org.springframework.cloud:spring-cloud-starter-task:1.2.2.RELEASE'
compile group: 'org.liquibase', name: 'liquibase-core', version: '4.8.0'
compile group: 'org.json', name: 'json', version: '20231013'

testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile group: 'junit', name: 'junit', version: '4.13.1'
testCompile group: 'org.mockito', name: 'mockito-core', version: '1.10.19'
testCompile group: 'org.powermock', name: 'powermock-core', version: '1.6.4'
testCompile "org.powermock:powermock-module-junit4:1.6.4"
testCompile "org.powermock:powermock-module-junit4-rule:1.6.4"
testCompile "org.powermock:powermock-api-mockito:1.6.4"
testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
implementation('org.springframework.boot:spring-boot-starter')
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.13'
implementation group: 'ch.qos.logback', name: 'logback-core', version: '1.2.13'
implementation group: 'org.yaml', name: 'snakeyaml', version: '2.0'
implementation("org.springframework.boot:spring-boot-starter-batch")
implementation group: 'org.springframework', name: 'spring-beans', version: '5.3.20'
implementation group: 'org.springframework', name: 'spring-core', version: '5.3.27'
implementation group: 'org.springframework', name: 'spring-expression', version: '5.3.27'
implementation group: 'org.codehaus.jettison', name: 'jettison', version: '1.5.4'
implementation group: 'com.thoughtworks.xstream', name: 'xstream', version: '1.4.20'
implementation group: 'com.google.protobuf', name: 'protobuf-java', version: '3.21.7'
implementation("org.springframework.batch:spring-batch-test")
implementation group: 'junit', name: 'junit', version: '4.13.1'
implementation group: 'mysql', name: 'mysql-connector-java', version: '8.0.28'
implementation group: 'org.postgresql', name: 'postgresql', version: '42.3.9'
implementation group: 'org.apache.commons', name: 'commons-dbcp2', version: '2.3.0'
implementation group: 'commons-io', name: 'commons-io', version: '2.7'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.7'
implementation group: 'org.freemarker', name: 'freemarker', version: '2.3.23'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.9'
implementation group: 'commons-collections', name: 'commons-collections', version: '3.2.2'
implementation "com.github.jsqlparser:jsqlparser:1.1"
implementation 'org.springframework.cloud:spring-cloud-starter-task:1.2.2.RELEASE'
implementation group: 'org.liquibase', name: 'liquibase-core', version: '4.8.0'
implementation group: 'org.json', name: 'json', version: '20231013'

testImplementation('org.springframework.boot:spring-boot-starter-test')
testImplementation group: 'junit', name: 'junit', version: '4.13.1'
testImplementation group: 'org.mockito', name: 'mockito-core', version: '1.10.19'
testImplementation group: 'org.powermock', name: 'powermock-core', version: '1.6.4'
testImplementation "org.powermock:powermock-module-junit4:1.6.4"
testImplementation "org.powermock:powermock-module-junit4-rule:1.6.4"
testImplementation "org.powermock:powermock-api-mockito:1.6.4"
testImplementation group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
}

jar {
Expand Down Expand Up @@ -165,8 +167,8 @@ buildRpm {
postUninstall file("${projectDir}/scripts/builds/postuninstall.sh")
}

task wrapper(type: Wrapper) {
gradleVersion = '4.5.1'
wrapper {
gradleVersion = '6.8.3'
}

checkstyle {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Tue May 24 11:00:15 IST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-bin.zip
78 changes: 43 additions & 35 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,25 +1,43 @@
#!/usr/bin/env bash
#!/usr/bin/env sh

##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn ( ) {
warn () {
echo "$*"
}

die ( ) {
die () {
echo
echo "$*"
echo
Expand All @@ -30,6 +48,7 @@ die ( ) {
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
Expand All @@ -40,31 +59,11 @@ case "`uname`" in
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac

# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
Expand All @@ -90,7 +89,7 @@ location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
Expand All @@ -114,6 +113,7 @@ fi
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
Expand Down Expand Up @@ -154,11 +154,19 @@ if $cygwin ; then
esac
fi

# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
exec "$JAVACMD" "$@"
14 changes: 4 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

Expand Down Expand Up @@ -46,10 +46,9 @@ echo location of your Java installation.
goto fail

:init
@rem Get command-line arguments, handling Windowz variants
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
Expand All @@ -60,11 +59,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line
Expand Down
32 changes: 17 additions & 15 deletions package/docker/files/application.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@

spring.datasource.url=jdbc:postgresql://${MART_DB_HOST}/${MART_DB_NAME}
spring.datasource.jdbc-url=jdbc:postgresql://${MART_DB_HOST}/${MART_DB_NAME}
spring.datasource.username=${MART_DB_USERNAME}
spring.datasource.password=${MART_DB_PASSWORD}
spring.datasource.driver-class-name=org.postgresql.Driver

spring.ds_openmrs.url=jdbc:mysql://${OPENMRS_DB_HOST}/${OPENMRS_DB_NAME}
spring.ds_openmrs.username=${OPENMRS_DB_USERNAME}
spring.ds_openmrs.password=${OPENMRS_DB_PASSWORD}
spring.ds_openmrs.driver-class-name=com.mysql.jdbc.Driver
spring.ds-openmrs.jdbc-url=jdbc:mysql://${OPENMRS_DB_HOST}/${OPENMRS_DB_NAME}
spring.ds-openmrs.username=${OPENMRS_DB_USERNAME}
spring.ds-openmrs.password=${OPENMRS_DB_PASSWORD}
spring.ds-openmrs.driver-class-name=com.mysql.cj.jdbc.Driver

spring.ds-mart.jdbc-url=jdbc:postgresql://${MART_DB_HOST}/${MART_DB_NAME}
spring.ds-mart.username=${MART_DB_USERNAME}
spring.ds-mart.password=${MART_DB_PASSWORD}
spring.ds-mart.driver-class-name=org.postgresql.Driver

spring.ds_mart.url=jdbc:postgresql://${MART_DB_HOST}/${MART_DB_NAME}
spring.ds_mart.username=${MART_DB_USERNAME}
spring.ds_mart.password=${MART_DB_PASSWORD}
spring.ds_mart.driver-class-name=org.postgresql.Driver
spring.batch.initialize-schema=always
spring.main.allow-bean-definition-overriding=true

bahmniMartConfigFile=file:/bahmni-mart/conf/bahmni-mart.json
defaultConfigPath=/bahmni-mart/conf/app.json
Expand All @@ -21,11 +23,11 @@ defaultExtensionConfigPath=/bahmni-mart/conf/extension.json
implementationExtensionConfigPath=""
logging.level.org.bahmni=INFO

liquibase.enabled=true
liquibase.change-log=file:/bahmni-mart/conf/liquibase.xml
liquibase.url=jdbc:postgresql://${MART_DB_HOST}/${MART_DB_NAME}
liquibase.user=${MART_DB_USERNAME}
liquibase.password=${MART_DB_PASSWORD}
spring.liquibase.enabled=true
spring.liquibase.change-log=file:/bahmni-mart/conf/liquibase.xml
spring.liquibase.url=jdbc:postgresql://${MART_DB_HOST}/${MART_DB_NAME}
spring.liquibase.user=${MART_DB_USERNAME}
spring.liquibase.password=${MART_DB_PASSWORD}

# Notifications config
bahmni-mart.mail.subject=""
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/org/bahmni/mart/BatchUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ public static String getPostgresCompatibleValue(String value, String dataType) {
case "timestamp":
case "time":
return getStringForPsql(value);
case "BIT":
if ("true".equalsIgnoreCase(value)) {
return "B'1'";
} else {
return "B'0'";
}
default:
return value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import org.postgresql.copy.CopyManager;
import org.postgresql.core.BaseConnection;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.batch.BatchDatabaseInitializer;
import org.springframework.boot.autoconfigure.batch.BatchDataSourceInitializer;
import org.springframework.boot.autoconfigure.batch.BatchProperties;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -23,7 +23,7 @@ public class DatabaseConfiguration {

@Primary
@Bean(name = "openmrsDb")
@ConfigurationProperties(prefix = "spring.ds_openmrs")
@ConfigurationProperties(prefix = "spring.ds-openmrs")
public DataSource openmrsDataSource() {
return DataSourceBuilder.create().build();
}
Expand All @@ -34,7 +34,7 @@ public JdbcTemplate openmrsJdbcTemplate(@Qualifier("openmrsDb") DataSource dsOpe
}

@Bean(name = "martDb")
@ConfigurationProperties(prefix = "spring.ds_mart")
@ConfigurationProperties(prefix = "spring.ds-mart")
public DataSource martDataSource() {
return DataSourceBuilder.create().build();
}
Expand Down Expand Up @@ -66,9 +66,9 @@ public DataSource dataSource() {
}

@Bean
public BatchDatabaseInitializer batchDatabaseInitializer(final BatchProperties properties,
public BatchDataSourceInitializer batchDataSourceInitializer(final BatchProperties properties,
@Qualifier("scdfDb") final DataSource dataSource,
final ResourceLoader resourceLoader) {
return new BatchDatabaseInitializer(dataSource, resourceLoader, properties);
return new BatchDataSourceInitializer(dataSource, resourceLoader, properties);
}
}
Loading

0 comments on commit 284d9ab

Please sign in to comment.