Skip to content

Commit f8f94b6

Browse files
Upgrade AWS DynamoDB Local to v2.6.0 (#222)
This adds support for linux/arm64 and removes the use of the unmaintained sqlite4java
1 parent 6c83654 commit f8f94b6

File tree

5 files changed

+3
-101
lines changed

5 files changed

+3
-101
lines changed

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ assertj = { module = "org.assertj:assertj-core", version = "3.23.1" }
77
aws2Dynamodb = { module = "software.amazon.awssdk:dynamodb", version = "2.25.11" }
88
aws2DynamodbEnhanced = { module = "software.amazon.awssdk:dynamodb-enhanced", version = "2.25.11" }
99
awsDynamodb = { module = "com.amazonaws:aws-java-sdk-dynamodb", version = "1.11.960" }
10-
awsDynamodbLocal = { module = "com.amazonaws:DynamoDBLocal", version = "1.13.5" }
10+
awsDynamodbLocal = { module = "com.amazonaws:DynamoDBLocal", version = "2.6.0" }
1111
clikt = { module = "com.github.ajalt:clikt", version = "2.8.0" }
1212
dokkaGradlePlugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version = "1.9.20" }
1313
dockerCore = { module = "com.github.docker-java:docker-java-core", version = "3.2.13" }

tempest-testing-jvm/build.gradle.kts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ dependencies {
1414
implementation(libs.awsDynamodbLocal)
1515
implementation(libs.kotlinStdLib)
1616

17-
// Needed for com.amazonaws:DynamoDBLocal to work on macOS Aarch64 machines
18-
implementation("io.github.ganadist.sqlite4java:libsqlite4java-osx-aarch64:1.0.392")
19-
2017
testImplementation(libs.assertj)
2118
testImplementation(libs.junitApi)
2219
testImplementation(libs.junitEngine)

tempest-testing-jvm/src/main/kotlin/app/cash/tempest/testing/JvmDynamoDbServer.kt

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -31,59 +31,13 @@ class JvmDynamoDbServer private constructor(
3131
private lateinit var server: DynamoDBProxyServer
3232

3333
override fun startUp() {
34-
val libraryFile = libsqlite4javaNativeLibrary()
35-
System.setProperty("sqlite4java.library.path", libraryFile.parent)
36-
3734
onBeforeStartup()
3835
server = ServerRunner.createServerFromCommandLineArgs(
39-
arrayOf("-inMemory", "-port", port.toString())
36+
arrayOf("-inMemory", "-disableTelemetry", "-port", port.toString())
4037
)
4138
server.start()
4239
}
4340

44-
private fun libsqlite4javaNativeLibrary(): File {
45-
val prefix = libsqlite4javaPrefix()
46-
val classpath = System.getProperty("java.class.path")
47-
val classpathElements = classpath.split(File.pathSeparator)
48-
for (element in classpathElements) {
49-
val file = File(element)
50-
if (file.name.startsWith(prefix)) {
51-
return file
52-
}
53-
}
54-
throw IllegalArgumentException("couldn't find native library for $prefix")
55-
}
56-
57-
/**
58-
* Returns the prefix of the sqlite4java native library for the current platform.
59-
*
60-
* Observed values of os.arch include:
61-
* * x86_64
62-
* * amd64
63-
* * aarch64
64-
*
65-
* Observed values of os.name include:
66-
* * Linux
67-
* * Mac OS X
68-
*
69-
* Available native versions of sqlite4java are:
70-
* * libsqlite4java-linux-amd64-1.0.392.so
71-
* * libsqlite4java-linux-i386-1.0.392.so
72-
* * libsqlite4java-osx-1.0.392.dylib
73-
* * sqlite4java-win32-x64-1.0.392.dll
74-
* * sqlite4java-win32-x86-1.0.392.dll
75-
*/
76-
private fun libsqlite4javaPrefix(): String {
77-
val osArch = System.getProperty("os.arch")
78-
val osName = System.getProperty("os.name")
79-
80-
return when {
81-
osName == "Linux" && osArch == "amd64" -> "libsqlite4java-linux-amd64-"
82-
osName == "Mac OS X" && osArch in listOf("x86_64", "aarch64") -> "libsqlite4java-osx-"
83-
else -> throw IllegalStateException("unexpected platform: os.name=$osName os.arch=$osArch")
84-
}
85-
}
86-
8741
override fun shutDown() {
8842
server.stop()
8943
}

tempest2-testing-jvm/build.gradle.kts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ dependencies {
1414
implementation(libs.awsDynamodbLocal)
1515
implementation(libs.kotlinStdLib)
1616

17-
// Needed for com.amazonaws:DynamoDBLocal to work on macOS Aarch64 machines
18-
implementation("io.github.ganadist.sqlite4java:libsqlite4java-osx-aarch64:1.0.392")
19-
2017
testImplementation(libs.assertj)
2118
testImplementation(libs.junitApi)
2219
testImplementation(libs.junitEngine)

tempest2-testing-jvm/src/main/kotlin/app/cash/tempest2/testing/JvmDynamoDbServer.kt

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -31,59 +31,13 @@ class JvmDynamoDbServer private constructor(
3131
private lateinit var server: DynamoDBProxyServer
3232

3333
override fun startUp() {
34-
val libraryFile = libsqlite4javaNativeLibrary()
35-
System.setProperty("sqlite4java.library.path", libraryFile.parent)
36-
3734
onBeforeStartup()
3835
server = ServerRunner.createServerFromCommandLineArgs(
39-
arrayOf("-inMemory", "-port", port.toString())
36+
arrayOf("-inMemory", "-disableTelemetry", "-port", port.toString())
4037
)
4138
server.start()
4239
}
4340

44-
private fun libsqlite4javaNativeLibrary(): File {
45-
val prefix = libsqlite4javaPrefix()
46-
val classpath = System.getProperty("java.class.path")
47-
val classpathElements = classpath.split(File.pathSeparator)
48-
for (element in classpathElements) {
49-
val file = File(element)
50-
if (file.name.startsWith(prefix)) {
51-
return file
52-
}
53-
}
54-
throw IllegalArgumentException("couldn't find native library for $prefix")
55-
}
56-
57-
/**
58-
* Returns the prefix of the sqlite4java native library for the current platform.
59-
*
60-
* Observed values of os.arch include:
61-
* * x86_64
62-
* * amd64
63-
* * aarch64
64-
*
65-
* Observed values of os.name include:
66-
* * Linux
67-
* * Mac OS X
68-
*
69-
* Available native versions of sqlite4java are:
70-
* * libsqlite4java-linux-amd64-1.0.392.so
71-
* * libsqlite4java-linux-i386-1.0.392.so
72-
* * libsqlite4java-osx-1.0.392.dylib
73-
* * sqlite4java-win32-x64-1.0.392.dll
74-
* * sqlite4java-win32-x86-1.0.392.dll
75-
*/
76-
private fun libsqlite4javaPrefix(): String {
77-
val osArch = System.getProperty("os.arch")
78-
val osName = System.getProperty("os.name")
79-
80-
return when {
81-
osName == "Linux" && osArch == "amd64" -> "libsqlite4java-linux-amd64-"
82-
osName == "Mac OS X" && osArch in listOf("x86_64", "aarch64") -> "libsqlite4java-osx-"
83-
else -> throw IllegalStateException("unexpected platform: os.name=$osName os.arch=$osArch")
84-
}
85-
}
86-
8741
override fun shutDown() {
8842
server.stop()
8943
}

0 commit comments

Comments
 (0)