Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor AppServer to Kotlin #518

Open
wants to merge 145 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
40f25b8
Update to dev config
this-Aditya Dec 8, 2024
090fe1d
Refactored application class
this-Aditya Dec 18, 2024
451e9a6
Configured build to use kotlin
this-Aditya Dec 18, 2024
ca0e976
Updated kotlin version
this-Aditya Dec 18, 2024
526fa0b
Some kotlin changes
this-Aditya Dec 25, 2024
bb2b25b
update gradle and spring versions
this-Aditya Dec 26, 2024
803ed65
Disabling integration tests for now
this-Aditya Dec 26, 2024
6be2fba
Now downloading sources and java-docs
this-Aditya Dec 26, 2024
694d379
Updating strings to enum
this-Aditya Dec 26, 2024
0d181f7
Disabling tests for now
this-Aditya Dec 26, 2024
41d2c00
Stopping test compiling
this-Aditya Dec 26, 2024
333c39b
Replaced project dto with data class
this-Aditya Dec 27, 2024
ee71830
Added dependencies for mapstruct
this-Aditya Dec 27, 2024
3257415
Refactored project dto
this-Aditya Dec 27, 2024
bd433d3
Corrected call sites for ProjectDTOs
this-Aditya Dec 27, 2024
817c9e1
Updated PathUtils and deleted java project service, repository
this-Aditya Dec 29, 2024
b2ef1b9
Added utility functions for projects
this-Aditya Dec 29, 2024
4cbef07
Refactored project service and repository
this-Aditya Dec 29, 2024
4c4fc3f
No arg plugin configs
this-Aditya Dec 29, 2024
ecb39d9
Corrected kapt usage to autowire kotlin components
this-Aditya Dec 30, 2024
3d91b3c
Corrected dependencies of ProjectRepository
this-Aditya Dec 30, 2024
a190f50
Misc changes
this-Aditya Dec 30, 2024
8b37f2f
Updated Project entity and auditing class
this-Aditya Dec 30, 2024
d189075
Misc changes for projects
this-Aditya Dec 30, 2024
080307e
Changes to project
this-Aditya Dec 30, 2024
742a66a
Connection to postgres for testing with misc changes
this-Aditya Dec 31, 2024
074dbef
More changes for projects
this-Aditya Dec 31, 2024
2255391
Added license
this-Aditya Jan 1, 2025
67ad10f
Deleted java files
this-Aditya Jan 1, 2025
d58028b
Utility work
this-Aditya Jan 1, 2025
f163418
Added license
this-Aditya Jan 1, 2025
0b2fee3
Updated response entity exception handler
this-Aditya Jan 1, 2025
78c4208
Refactored exception entities to kotlin
this-Aditya Jan 1, 2025
071100d
Migrated custom exceptions to kotlin
this-Aditya Jan 1, 2025
fd45aca
Updated user entities to kotlin classes
this-Aditya Jan 1, 2025
59bca27
Refactored user dto's to kotlin data classes
this-Aditya Jan 1, 2025
bb60cd3
Updated user mapper to kotlin
this-Aditya Jan 1, 2025
83f39c3
Updated user repository to kotlin
this-Aditya Jan 1, 2025
3b3eef0
Migrated java user service to kotlin
this-Aditya Jan 1, 2025
5997c9b
Updated area affected by user code refactoring
this-Aditya Jan 1, 2025
ccb02fe
Added future improvement comments
this-Aditya Jan 1, 2025
5e3c88f
Refactored project dto(s) naming to lower case again
this-Aditya Jan 1, 2025
78e054e
Optimized imports
this-Aditya Jan 1, 2025
c2bb942
Refactoring of service classes
this-Aditya Jan 2, 2025
f13ed68
Refactored dto's for protocols
this-Aditya Jan 2, 2025
d6067c3
Mapper will use parallelStream instead of sequence
this-Aditya Jan 2, 2025
50359f3
Refactored interface and implementation of schedule generator service…
this-Aditya Jan 2, 2025
dc39e0a
Migrated protocol handler
this-Aditya Jan 2, 2025
c8f68d9
Migrated simple, clinical protocol handler and its factory to kotlin
this-Aditya Jan 2, 2025
5bfa32e
Refactored repeat protocol handler and its factory to kotlin
this-Aditya Jan 2, 2025
6309083
Updated ProtocolHandlerRunner to kotlin
this-Aditya Jan 2, 2025
133d112
Refactored repeat questionnaire handler and its factory
this-Aditya Jan 2, 2025
c0cafe7
Migrated TimeCalculatorService to kotlin
this-Aditya Jan 2, 2025
4a0e8b8
Added factories for remaining protocol handler's implementation
this-Aditya Jan 2, 2025
263ca97
Refactored task entity to kotlin
this-Aditya Jan 3, 2025
9eec942
Refactored task generator service to kotlin
this-Aditya Jan 3, 2025
52ed806
Notification and message entities are converted to kotlin along with …
this-Aditya Jan 3, 2025
3e55367
Protocol, assessment, assessment type and definition info migrated to…
this-Aditya Jan 3, 2025
42b00aa
Assessment protocol and its underlying protocols are transformed to k…
this-Aditya Jan 3, 2025
f301444
Questionnaire dto's (Schedule and AssessmentSchedule) are converted t…
this-Aditya Jan 3, 2025
90acdd3
Misc changes
this-Aditya Jan 3, 2025
0586a8f
Minor changes to protocol handler implementations
this-Aditya Jan 3, 2025
82f83f3
CachedMap is now in kotlin
this-Aditya Jan 3, 2025
05409f6
Github client is now in kotlin
this-Aditya Jan 4, 2025
d3b8cf5
CachedFunction and its associated utility components transformed
this-Aditya Jan 4, 2025
f69f1b9
Removing additional elements from map manually instead of overridden …
this-Aditya Jan 4, 2025
29da19b
Updated github service with client
this-Aditya Jan 4, 2025
c31c2e2
Dto's migration
this-Aditya Jan 4, 2025
845564e
Protocol fetcher strategy and its implementation converted
this-Aditya Jan 4, 2025
3cb0f01
Protocol generator and its implementation refactored to kotlin
this-Aditya Jan 4, 2025
6bb274b
Misc changes
this-Aditya Jan 4, 2025
f567e04
Misc changes
this-Aditya Jan 4, 2025
cc32cef
SearchCriteria, TaskSpecification and TaskSpecificationBuilder updated
this-Aditya Jan 5, 2025
e73bef8
Final updates to UserService
this-Aditya Jan 5, 2025
98843b7
Java converters refactored to kotlin mapper
this-Aditya Jan 5, 2025
d37067a
FcmDataMessageDto and FcmDataMessages are now in kotlin
this-Aditya Jan 5, 2025
b9fddf9
Notifications data transfer objects are now in kotlin
this-Aditya Jan 5, 2025
2fc6a65
State event dto's are refactored
this-Aditya Jan 5, 2025
ffef345
Notification and DataMessage entities updated
this-Aditya Jan 5, 2025
391cd14
Task generator service and notification type enum updated
this-Aditya Jan 5, 2025
a768354
Message and task state refactored
this-Aditya Jan 5, 2025
2c17795
Unit tests for ProjectService and UserService class are now in kotlin
this-Aditya Jan 5, 2025
e48ce27
Using mockito again instead of mockk for now
this-Aditya Jan 5, 2025
67eb0bb
Unused mockk
this-Aditya Jan 6, 2025
e4eee5e
FcmNotificationService test updated
this-Aditya Jan 6, 2025
19c2b8c
User and project controller updated
this-Aditya Jan 6, 2025
545bb00
Upload controller in kotlin is passing tests
this-Aditya Jan 6, 2025
ca2ffd5
DataMessage and Notification controllers are working in kotlin now
this-Aditya Jan 6, 2025
185af97
Tests for repositories of notification and data message are passing i…
this-Aditya Jan 6, 2025
6064580
User repository tests are also passing now
this-Aditya Jan 6, 2025
d4082ff
Protocol generator tests are working fine
this-Aditya Jan 6, 2025
c4b2786
Passing kotlin tests for schedulers
this-Aditya Jan 6, 2025
957437d
Storage service tests are passing in kotlin
this-Aditya Jan 6, 2025
7116f96
Kotlin transmitter tests passing
this-Aditya Jan 6, 2025
fa144c4
Misc changes
this-Aditya Jan 6, 2025
13d0453
Rest controllers for project and user updated
this-Aditya Jan 6, 2025
fe70ead
TaskStateEvent entity, dto and listener updated
this-Aditya Jan 7, 2025
77dcb23
TaskStateEvent repository and service updated
this-Aditya Jan 7, 2025
c0e2768
Task state event controller refactored
this-Aditya Jan 7, 2025
6384f3d
Questionnaire schedule service refactored
this-Aditya Jan 7, 2025
ec9ac56
Fcm notification service and repository migrated to kotlin
this-Aditya Jan 7, 2025
020c893
Refactored fcm services
this-Aditya Jan 7, 2025
fafdb36
Updated github and protocol endpoint
this-Aditya Jan 7, 2025
5b7c569
Questionnaire schedule endpoint controller updated
this-Aditya Jan 7, 2025
5ae92e0
Some work on notification state events
this-Aditya Jan 7, 2025
5e85cfd
State event work done
this-Aditya Jan 7, 2025
d398491
State event repository updated
this-Aditya Jan 7, 2025
8500f9a
Some fcm work
this-Aditya Jan 7, 2025
d8e5114
Fcm package completely refactored to kotlin
this-Aditya Jan 7, 2025
4412e79
Common part of integration tests refactored
this-Aditya Jan 7, 2025
a663995
Compiling the unit tests again
this-Aditya Jan 7, 2025
09265d1
Misc work
this-Aditya Jan 7, 2025
4bb9877
Fcm notification controller is now in kotlin
this-Aditya Jan 8, 2025
822e4e6
Final work on controllers
this-Aditya Jan 8, 2025
0ea4310
Worked on data messages handling
this-Aditya Jan 8, 2025
7065c0f
Some work on task handling
this-Aditya Jan 8, 2025
7cd3a64
Auth configs updated
this-Aditya Jan 8, 2025
0f18c19
Misc changes
this-Aditya Jan 8, 2025
b172824
Updated protocol handler implementations
this-Aditya Jan 8, 2025
4235649
Updated s3 storage work to kotlin
this-Aditya Jan 8, 2025
1abd597
Tasks and storage work
this-Aditya Jan 8, 2025
059f83e
Message state events refactor
this-Aditya Jan 8, 2025
4be2ea2
Some utility work
this-Aditya Jan 8, 2025
2177704
Refactor of project endpoint to kotlin
this-Aditya Jan 8, 2025
790e664
Refactored integration tests
this-Aditya Jan 8, 2025
90ddf3f
Partial scheduler refactor
this-Aditya Jan 8, 2025
341e175
Fcm package completely modified
this-Aditya Jan 8, 2025
20b13c1
Scheduler updated and integration tests uncommented
this-Aditya Jan 8, 2025
f68b7f0
Added missing licenses
this-Aditya Jan 8, 2025
88dec17
Correcting the integration tests
this-Aditya Jan 11, 2025
34c71fe
Disabling ktor usage for now to pass CI
this-Aditya Jan 11, 2025
62f8a1b
Resolved merge conflicts
this-Aditya Jan 11, 2025
aa0d1e5
Commenting failed test for now
this-Aditya Jan 11, 2025
8fa436a
Checking if issue is in controller conversion
this-Aditya Jan 11, 2025
087b77f
Trying to pass integration tests
this-Aditya Jan 12, 2025
171ca14
Controllers to kotlin
this-Aditya Jan 12, 2025
453cf3a
Refactor to pass CI
this-Aditya Jan 12, 2025
64364e9
Final try to pass CI with kotlin integration tests
this-Aditya Jan 13, 2025
91d319b
Final touches
this-Aditya Jan 13, 2025
49be0ec
Clearing the notification auth test database at last
this-Aditya Jan 14, 2025
beb8d2d
Minor change
this-Aditya Jan 15, 2025
54968ec
Refining things
this-Aditya Jan 17, 2025
844ee51
Work on transmitters
this-Aditya Jan 18, 2025
e5902dd
Final touches
this-Aditya Jan 18, 2025
a8ac75b
Minor change
this-Aditya Jan 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

### IntelliJ IDEA ###
.idea
.kotlin
*.iws
*.iml
*.ipr
Expand Down
101 changes: 89 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id 'pmd'
id 'java'
id 'eclipse'
id 'idea'
id 'scala'
id 'checkstyle'
id 'io.gatling.gradle' version '3.9.2.1'
id 'com.github.johnrengelman.shadow' version '8.1.0'
id 'org.springframework.boot' version '3.2.10'
id 'org.springframework.boot' version '3.3.3'
id 'org.openjfx.javafxplugin' version '0.0.13'
id("com.github.ben-manes.versions") version "0.46.0"
id 'io.spring.dependency-management' version '1.1.6'
id 'com.github.ben-manes.versions' version "0.46.0"
id 'org.jetbrains.kotlin.jvm' version '1.9.25'
id "org.jetbrains.kotlin.kapt" version "1.9.25"
id "org.jetbrains.kotlin.plugin.allopen" version "1.9.25"
id "org.jetbrains.kotlin.plugin.spring" version "1.9.25"
id "org.jetbrains.kotlin.plugin.jpa" version "1.9.25"
id "org.jetbrains.kotlin.plugin.noarg" version "1.9.25"
}

apply plugin: 'checkstyle'
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'scala'

group = 'org.radarbase'
version = '2.4.3'

Expand All @@ -22,17 +32,41 @@ java {
}
}

kotlin {
jvmToolchain(17)
}

kapt {
keepJavacAnnotationProcessors = true
}

idea {
module {
downloadJavadoc = true
downloadSources = true
}
}

repositories {
mavenCentral()
maven { url = "https://oss.sonatype.org/content/repositories/snapshots" }
}

springBoot {
mainClass.set('org.radarbase.appserver.AppserverApplicationKt')
}

bootJar {
mainClass = 'org.radarbase.appserver.AppserverApplication'
mainClass = 'org.radarbase.appserver.AppserverApplicationKt'
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

jar {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

ext {
springBootVersion = '3.2.10'
springBootVersion = '3.3.3'
springVersion = '6.0.6'
springOauth2Version = "2.5.2.RELEASE"
springOauth2AutoconfigureVersion = "2.6.8"
Expand All @@ -43,9 +77,20 @@ ext {
springSecurityVersion = '6.0.5'
hibernateValidatorVersion = '8.0.0.Final'
minioVersion = '8.5.10'
kotlinVersion = '1.9.25'
jacksonKotlinVersion = '2.15.4'
dateTimeVersion = '0.6.1'
ktorVersion = '2.3.0'
coroutinesVersion = '1.10.1'
mockitoKotlinVersion = '3.2.0'
}

sourceSets {
main {
kotlin {
srcDirs += 'src/main/java'
}
}
integrationTest {
java {
compileClasspath += main.output + test.output + test.compileClasspath
Expand All @@ -67,7 +112,9 @@ dependencies {
implementation('org.springframework.security.oauth.boot:spring-security-oauth2-autoconfigure:' + springOauth2AutoconfigureVersion)
implementation('org.springframework.security.oauth:spring-security-oauth2:' + springOauth2Version)
runtimeOnly("org.hibernate.validator:hibernate-validator:$hibernateValidatorVersion")
implementation("io.minio:minio:$minioVersion")
implementation("io.minio:minio:$minioVersion") {
exclude group: 'org.jetbrains.kotlin'
}

// Open API spec
implementation(group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: springDocVersion)
Expand All @@ -81,6 +128,7 @@ dependencies {
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombokVersion
implementation group: 'org.projectlombok', name: 'lombok', version: lombokVersion

kapt("org.springframework:spring-context-indexer:$springVersion")
annotationProcessor "org.springframework:spring-context-indexer:$springVersion"

// FCM Admin SDK
Expand All @@ -100,6 +148,16 @@ dependencies {
runtimeOnly group: 'org.springframework', name: 'spring-aop', version: springVersion
implementation(group: 'org.radarbase', name: 'radar-spring-auth', version: radarSpringAuthVersion)

//Kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonKotlinVersion"
implementation("org.jetbrains.kotlin:kotlin-reflect:1.9.25")
kapt("org.springframework.boot:spring-boot-configuration-processor")
implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation "io.ktor:ktor-client-cio:$ktorVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
testImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion"

testImplementation group: 'io.gatling.highcharts', name: 'gatling-charts-highcharts', version: '3.9.2'

implementation('org.liquibase.ext:liquibase-hibernate6:4.20.0')
Expand All @@ -118,6 +176,17 @@ dependencies {
gatlingImplementation('com.fasterxml.jackson.datatype:jackson-datatype-jsr310')
}

noArg {
annotation("org.radarbase.appserver.util.GenerateZeroArgs")
}

allOpen {
annotation("org.radarbase.appserver.util.OpenClass")
annotation("jakarta.persistence.MappedSuperclass")
annotation("jakarta.persistence.Entity")
annotation("jakarta.persistence.Embeddable")
}

javafx {
version = "19"
modules = [ 'javafx.controls' ]
Expand All @@ -137,7 +206,7 @@ javadoc {
}

wrapper {
gradleVersion '8.0.2'
gradleVersion '8.5'
}

test {
Expand All @@ -146,6 +215,14 @@ test {
}
}

tasks.withType(KotlinCompile).configureEach {
compilerOptions {
jvmTarget = JvmTarget.JVM_17
apiVersion = KotlinVersion.KOTLIN_1_9
languageVersion = KotlinVersion.KOTLIN_1_9
}
}

tasks.register('unpack', Copy) {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
dependsOn bootJar
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
15 changes: 10 additions & 5 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,10 +131,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
Expand Down Expand Up @@ -197,6 +198,10 @@ if "$cygwin" || "$msys" ; then
done
fi


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

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,16 @@ class BatchingApiGatlingSimulationTest extends Simulation {
.repeat(s"$numOfNotificationsPerUser", "nn") {
exec { session =>
session("fcmNotifications").validate[FcmNotifications].map(fcmNotifications =>
fcmNotifications.addNotification(new FcmNotificationDto().setScheduledTime(Instant.now().plus(Duration.ofDays(50)))
.setBody(getValue(notifBodyTemplate.apply(session)))
.setTitle(getValue(notifTitleTemplate.apply(session)))
.setFcmMessageId(getValue(notifMessageIdTemplate.apply(session)))
.setSourceId(getValue(notifSourceIdTemplate.apply(session)))
.setTtlSeconds(86400)
.setAppPackage("aRMT")
.setSourceType("aRMT")
.setType("ESM")
.setDelivered(false)
fcmNotifications.addNotification(new FcmNotificationDto().withScheduledTime(Instant.now().plus(Duration.ofDays(50)))
.withBody(getValue(notifBodyTemplate.apply(session)))
.withTitle(getValue(notifTitleTemplate.apply(session)))
.withFcmMessageId(getValue(notifMessageIdTemplate.apply(session)))
.withSourceId(getValue(notifSourceIdTemplate.apply(session)))
.withTtlSeconds(86400)
.withAppPackage("aRMT")
.withSourceType("aRMT")
.withType("ESM")
.withDelivered(false)
)
)

Expand Down
Loading
Loading