Skip to content

Commit 66f60c9

Browse files
committed
update end-to-end tests, tweak logging, silence "unused code" warnings
1 parent 0b6c25c commit 66f60c9

17 files changed

Lines changed: 253 additions & 57 deletions

File tree

gradle/libs.versions.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[plugins]
22
kotlin = { id = "org.jetbrains.kotlin.jvm", version = "2.2.21" }
3-
dokka = { id = "org.jetbrains.dokka", version = "2.1.0" }
3+
dokka-base = { id = "org.jetbrains.dokka", version = "2.1.0" }
4+
dokka-java = { id = "org.jetbrains.dokka-javadoc", version = "2.1.0" }
45

56
[libraries]
67
logging = { module = "org.slf4j:slf4j-api", version = "2.0.17" }

lib/build.gradle.kts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
22

33
plugins {
44
alias(libs.plugins.kotlin)
5-
alias(libs.plugins.dokka)
5+
alias(libs.plugins.dokka.base)
6+
alias(libs.plugins.dokka.java)
67
`maven-publish`
78
}
89

@@ -46,15 +47,17 @@ tasks.javadoc {
4647
exclude("module-info.java")
4748
}
4849

49-
tasks.dokkaHtml {
50-
outputDirectory.set(file("build/docs/dokka"))
51-
}
50+
dokka {
51+
dokkaPublications.html {
52+
outputDirectory.set(file("build/docs/dokka"))
53+
}
5254

53-
tasks.dokkaJavadoc {
54-
outputDirectory.set(file("build/docs/javadoc"))
55+
dokkaPublications.javadoc {
56+
outputDirectory.set(file("build/docs/javadoc"))
57+
}
5558
}
5659

57-
task("docs") {
60+
tasks.register("docs") {
5861
dependsOn("dokkaHtml", "dokkaJavadoc")
5962
}
6063

lib/src/main/kotlin/org/veupathdb/lib/compute/platform/config/AsyncDBConfig.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class AsyncDBConfig {
5555
*
5656
* @param dbName PostgreSQL database name.
5757
*/
58+
@Suppress("unused")
5859
constructor(dbName: String, username: String, password: String, host: String) :
5960
this(dbName, username, password, host, DefaultPort, DefaultPoolSize)
6061

@@ -73,6 +74,7 @@ class AsyncDBConfig {
7374
*
7475
* Defaults to `10`.
7576
*/
77+
@Suppress("unused")
7678
constructor(dbName: String, username: String, password: String, host: String, poolSize: Int) :
7779
this(dbName, username, password, host, DefaultPort, poolSize)
7880

lib/src/main/kotlin/org/veupathdb/lib/compute/platform/config/AsyncJobConfig.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class AsyncJobConfig {
3232
* @param executorFactory Provider for [JobExecutor] instances that will be
3333
* used to process individual jobs.
3434
*/
35+
@Suppress("unused")
3536
constructor(executorFactory: JobExecutorFactory) :
3637
this(executorFactory, DefaultExpirationDays)
3738

@@ -55,6 +56,7 @@ class AsyncJobConfig {
5556
* Creates and returns a new [Builder] instance.
5657
*/
5758
@JvmStatic
59+
@Suppress("unused")
5860
fun builder() = Builder()
5961

6062
@JvmStatic
@@ -86,6 +88,7 @@ class AsyncJobConfig {
8688
* Sets the provider for [JobExecutor] instances that will be used to
8789
* process individual jobs.
8890
*/
91+
@Suppress("unused")
8992
fun executorFactory(fac: JobExecutorFactory): Builder {
9093
executorFactory = fac
9194
return this
@@ -95,6 +98,7 @@ class AsyncJobConfig {
9598
* Sets the number of days a job can go without being accessed before being
9699
* considered expired and pruned.
97100
*/
101+
@Suppress("unused")
98102
fun expirationDays(d: Int): Builder {
99103
expirationDays = d
100104
return this
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
package org.veupathdb.lib.compute.platform.config
2+
3+
import org.veupathdb.lib.compute.platform.intern.minio.MinIOHax
4+
import kotlin.time.Duration
5+
6+
class AsyncMinIOConfig(
7+
host: String,
8+
port: Int,
9+
https: Boolean,
10+
bucket: String,
11+
accessToken: String,
12+
secretKey: String,
13+
rootPath: String,
14+
15+
maxDeleteAwaitTime: Duration,
16+
retrySleepTime: Duration,
17+
retryCount: Int,
18+
): AsyncS3Config(
19+
host = host,
20+
port = port,
21+
https = https,
22+
bucket = bucket,
23+
accessToken = accessToken,
24+
secretKey = secretKey,
25+
rootPath = rootPath,
26+
) {
27+
init {
28+
MinIOHax.MaxDeleteAwaitTime = maxDeleteAwaitTime
29+
MinIOHax.RetrySleepTime = retrySleepTime
30+
MinIOHax.RetryCount = retryCount
31+
}
32+
33+
@Suppress("unused")
34+
constructor(host: String, bucket: String, access: String, secret: String):
35+
this(host, DefaultPort, DefaultHTTPS, bucket, access, secret, DefaultRootPath)
36+
37+
@Suppress("unused")
38+
constructor(host: String, bucket: String, access: String, secret: String, root: String):
39+
this(host, DefaultPort, DefaultHTTPS, bucket, access, secret, root)
40+
41+
@Suppress("unused")
42+
private constructor(
43+
base: AsyncS3Config,
44+
maxDeleteAwaitTime: Duration,
45+
retrySleepTime: Duration,
46+
retryCount: Int,
47+
): this(
48+
base.host,
49+
base.port,
50+
base.https,
51+
base.bucket,
52+
base.accessToken,
53+
base.secretKey,
54+
base.rootPath,
55+
maxDeleteAwaitTime,
56+
retrySleepTime,
57+
retryCount,
58+
)
59+
60+
constructor(
61+
host: String,
62+
port: Int,
63+
https: Boolean,
64+
bucket: String,
65+
accessToken: String,
66+
secretKey: String,
67+
rootPath: String,
68+
): this (
69+
host = host,
70+
port = port,
71+
https = https,
72+
bucket = bucket,
73+
accessToken = accessToken,
74+
secretKey = secretKey,
75+
rootPath = rootPath,
76+
maxDeleteAwaitTime = MinIOHax.MaxDeleteAwaitTime,
77+
retrySleepTime = MinIOHax.RetrySleepTime,
78+
retryCount = MinIOHax.RetryCount,
79+
)
80+
81+
class Builder: AsyncS3Config.Builder() {
82+
var maxDeleteAwaitTime = MinIOHax.MaxDeleteAwaitTime
83+
var retrySleepTime = MinIOHax.RetrySleepTime
84+
var retryCount = MinIOHax.RetryCount
85+
86+
fun maxDeleteAwaitTime(value: Duration) =
87+
apply { maxDeleteAwaitTime = value }
88+
89+
fun retrySleepTime(value: Duration) =
90+
apply { retrySleepTime = value }
91+
92+
fun retryCount(value: Int) =
93+
apply { retryCount = value }
94+
95+
override fun build() =
96+
AsyncMinIOConfig(super.build(), maxDeleteAwaitTime, retrySleepTime, retryCount)
97+
}
98+
}

lib/src/main/kotlin/org/veupathdb/lib/compute/platform/config/AsyncPlatformConfig.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,15 @@ class AsyncPlatformConfig private constructor(
8686
/**
8787
* Adds the given queue configuration to this [Builder].
8888
*/
89+
@Suppress("unused")
8990
inline fun addQueue(fn: AsyncQueueConfig.Builder.() -> Unit) {
9091
queues.add(AsyncQueueConfig.build(fn))
9192
}
9293

9394
/**
9495
* Adds the given queue configurations to this [Builder].
9596
*/
97+
@Suppress("unused")
9698
fun addQueues(vararg conf: AsyncQueueConfig): Builder {
9799
conf.forEach(queues::add)
98100
return this
@@ -107,6 +109,7 @@ class AsyncPlatformConfig private constructor(
107109
return this
108110
}
109111

112+
@Suppress("unused")
110113
inline fun jobConfig(fn: AsyncJobConfig.Builder.() -> Unit) {
111114
jobConfig = AsyncJobConfig.build(fn)
112115
}
@@ -120,6 +123,7 @@ class AsyncPlatformConfig private constructor(
120123
return this
121124
}
122125

126+
@Suppress("unused")
123127
inline fun dbConfig(fn: AsyncDBConfig.Builder.() -> Unit) {
124128
dbConfig = AsyncDBConfig.build(fn)
125129
}
@@ -133,6 +137,7 @@ class AsyncPlatformConfig private constructor(
133137
return this
134138
}
135139

140+
@Suppress("unused")
136141
inline fun s3Config(fn: AsyncS3Config.Builder.() -> Unit) {
137142
s3Config = AsyncS3Config.build(fn)
138143
}

lib/src/main/kotlin/org/veupathdb/lib/compute/platform/config/AsyncQueueConfig.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class AsyncQueueConfig(
6767
*
6868
* @param host Hostname for the target RabbitMQ instance.
6969
*/
70+
@Suppress("unused")
7071
constructor(id: String, username: String, password: String, host: String) :
7172
this(id, username, password, host, DefaultRabbitMQPort, DefaultWorkerCount, DefaultMessageAckTimeoutMinutes.minutes)
7273

@@ -90,11 +91,13 @@ class AsyncQueueConfig(
9091
*
9192
* Default value is `5`.
9293
*/
94+
@Suppress("unused")
9395
constructor(id: String, username: String, password: String, host: String, workers: Int) :
9496
this(id, username, password, host, DefaultRabbitMQPort, workers, DefaultMessageAckTimeoutMinutes.minutes)
9597

9698
companion object {
9799
@JvmStatic
100+
@Suppress("unused")
98101
fun builder() = Builder()
99102

100103
@JvmStatic
@@ -170,6 +173,7 @@ class AsyncQueueConfig(
170173
/**
171174
* Sets the RabbitMQ credentials username for the queue.
172175
*/
176+
@Suppress("unused")
173177
fun username(username: String): Builder {
174178
this.username = username
175179
return this
@@ -178,6 +182,7 @@ class AsyncQueueConfig(
178182
/**
179183
* Sets the RabbitMQ credentials password for the queue.
180184
*/
185+
@Suppress("unused")
181186
fun password(password: String): Builder {
182187
this.password = password
183188
return this
@@ -194,6 +199,7 @@ class AsyncQueueConfig(
194199
/**
195200
* Sets the RabbitMQ host port for the queue.
196201
*/
202+
@Suppress("unused")
197203
fun port(port: Int): Builder {
198204
this.port = port
199205
return this
@@ -202,6 +208,7 @@ class AsyncQueueConfig(
202208
/**
203209
* Sets the number of worker threads to use as consumers for this queue.
204210
*/
211+
@Suppress("unused")
205212
fun workers(workers: Int): Builder {
206213
this.workers = workers
207214
return this
@@ -216,6 +223,7 @@ class AsyncQueueConfig(
216223
* Sets the [messageAckTimeout] value to a duration of the given value in
217224
* minutes.
218225
*/
226+
@Suppress("unused")
219227
fun messageAckTimeoutMinutes(timeout: Int) = apply { this.messageAckTimeout = timeout.minutes }
220228

221229
fun build(): AsyncQueueConfig {

0 commit comments

Comments
 (0)