Skip to content

Commit 9d72356

Browse files
authored
fix: ddb mapper tests (#1453)
1 parent a02e514 commit 9d72356

File tree

20 files changed

+19
-9
lines changed

20 files changed

+19
-9
lines changed

gradle.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ kotlinx.atomicfu.enableJvmIrTransformation=true
1717
kotlinx.atomicfu.enableNativeIrTransformation=false
1818

1919
# https://github.com/google/ksp/blob/main/docs/ksp2.md
20-
ksp.useKSP2=true
20+
# Disable KSP2 due to a bug around subsequent invocations
21+
# https://github.com/google/dagger/issues/4181 / https://github.com/google/ksp/issues/1678
22+
ksp.useKSP2=false

hll/dynamodb-mapper/dynamodb-mapper/build.gradle.kts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ kotlin {
4040
commonTest {
4141
dependencies {
4242
implementation(libs.kotlinx.coroutines.test)
43-
implementation(libs.kotest.assertions.core)
44-
implementation(libs.kotest.runner.junit5)
4543
}
4644
}
4745

4846
jvmTest {
4947
dependencies {
5048
implementation(libs.mockk)
49+
implementation(libs.kotest.assertions.core)
50+
implementation(libs.kotest.runner.junit5)
5151
}
5252
}
5353
}
@@ -67,8 +67,9 @@ ksp {
6767
}
6868

6969
if (project.NATIVE_ENABLED) {
70-
// Configure KSP for commonMain source generation; https://github.com/google/ksp/issues/963#issuecomment-1894144639
71-
70+
// Configure KSP for multiplatform: https://kotlinlang.org/docs/ksp-multiplatform.html
71+
// https://github.com/google/ksp/issues/963#issuecomment-1894144639
72+
// https://github.com/google/ksp/issues/965
7273
dependencies.kspCommonMainMetadata(project(":hll:dynamodb-mapper:dynamodb-mapper-ops-codegen"))
7374

7475
kotlin.sourceSets.commonMain {

hll/dynamodb-mapper/dynamodb-mapper/common/src/aws/sdk/kotlin/hll/dynamodbmapper/expressions/Filter.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package aws.sdk.kotlin.hll.dynamodbmapper.expressions
66

77
import aws.sdk.kotlin.hll.dynamodbmapper.util.dynamicAttr
88
import aws.smithy.kotlin.runtime.ExperimentalApi
9+
import kotlin.jvm.JvmName
910

1011
/**
1112
* A DSL interface providing support for "low-level" filter expressions. Implementations of this interface provide

hll/dynamodb-mapper/dynamodb-mapper/common/src/aws/sdk/kotlin/hll/dynamodbmapper/expressions/LiteralExpr.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import aws.sdk.kotlin.hll.dynamodbmapper.expressions.internal.LiteralExprImpl
88
import aws.sdk.kotlin.hll.dynamodbmapper.util.attr
99
import aws.sdk.kotlin.services.dynamodb.model.AttributeValue
1010
import aws.smithy.kotlin.runtime.ExperimentalApi
11+
import kotlin.jvm.JvmName
1112

1213
/**
1314
* Represents an expression that consists of a single literal value

hll/dynamodb-mapper/dynamodb-mapper/common/src/aws/sdk/kotlin/hll/dynamodbmapper/expressions/SortKeyFilter.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package aws.sdk.kotlin.hll.dynamodbmapper.expressions
66

77
import aws.smithy.kotlin.runtime.ExperimentalApi
8+
import kotlin.jvm.JvmName
89

910
/**
1011
* Represents a sort key independent of schema

hll/dynamodb-mapper/dynamodb-mapper/common/src/aws/sdk/kotlin/hll/dynamodbmapper/internal/DynamoDbMapperImpl.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import aws.sdk.kotlin.services.dynamodb.withConfig
1414
import aws.smithy.kotlin.runtime.businessmetrics.emitBusinessMetric
1515
import aws.smithy.kotlin.runtime.client.RequestInterceptorContext
1616
import aws.smithy.kotlin.runtime.http.interceptors.HttpInterceptor
17+
import aws.smithy.kotlin.runtime.io.use
1718

1819
internal data class DynamoDbMapperImpl(
1920
override val client: DynamoDbClient,

hll/dynamodb-mapper/dynamodb-mapper/common/src/aws/sdk/kotlin/hll/dynamodbmapper/model/Item.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import aws.sdk.kotlin.hll.dynamodbmapper.model.internal.ItemImpl
88
import aws.sdk.kotlin.hll.dynamodbmapper.util.dynamicAttr
99
import aws.sdk.kotlin.services.dynamodb.model.AttributeValue
1010
import aws.smithy.kotlin.runtime.ExperimentalApi
11+
import kotlin.jvm.JvmName
1112

1213
/**
1314
* An immutable representation of a low-level item in a DynamoDB table. Items consist of attributes, each of which have

hll/dynamodb-mapper/dynamodb-mapper/common/src/aws/sdk/kotlin/hll/dynamodbmapper/util/AttributeValues.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package aws.sdk.kotlin.hll.dynamodbmapper.util
66

77
import aws.sdk.kotlin.services.dynamodb.model.AttributeValue
8+
import kotlin.jvm.JvmName
89

910
internal val NULL_ATTR = AttributeValue.Null(true)
1011

hll/dynamodb-mapper/dynamodb-mapper/common/src/aws/sdk/kotlin/hll/dynamodbmapper/values/scalars/TextConverters.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public object TextConverters {
1818
/**
1919
* Converts between [CharArray] and [String]
2020
*/
21-
public val CharArrayToStringConverter: Converter<CharArray, String> = Converter(::String, String::toCharArray)
21+
public val CharArrayToStringConverter: Converter<CharArray, String> = Converter(CharArray::concatToString, String::toCharArray)
2222

2323
/**
2424
* Converts between [Char] and [String]

hll/dynamodb-mapper/dynamodb-mapper/common/test/aws/sdk/kotlin/hll/dynamodbmapper/expressions/KeyFilterTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import aws.sdk.kotlin.hll.dynamodbmapper.items.ItemConverter
1010
import aws.sdk.kotlin.hll.dynamodbmapper.items.ItemSchema
1111
import aws.sdk.kotlin.hll.dynamodbmapper.items.KeySpec
1212
import aws.sdk.kotlin.hll.dynamodbmapper.model.Item
13-
import org.junit.jupiter.api.assertThrows
1413
import kotlin.test.Test
1514
import kotlin.test.assertEquals
15+
import kotlin.test.assertFailsWith
1616

1717
class KeyFilterTest {
1818
private val singleKeySchema = ItemSchema(DummyConverter, KeySpec.String("primary"))
@@ -31,7 +31,7 @@ class KeyFilterTest {
3131
fun testSingleKeySchemaWithErroneousSortKey() {
3232
val kf = KeyFilter("foo") { sortKey eq 2 }
3333

34-
assertThrows<IllegalArgumentException> {
34+
assertFailsWith<IllegalArgumentException> {
3535
kf.toExpression(singleKeySchema)
3636
}
3737
}

0 commit comments

Comments
 (0)