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

Upgrade to kotlin 2 #2054

Merged
merged 3 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ graphql-java = "22.1"
graalvm = "0.10.2"
jackson = "2.17.1"
# kotlin version has to match the compile-testing compiler version
kotlin = "1.9.24"
kotlin = "2.0.0"
kotlinx-benchmark = "0.4.11"
kotlinx-coroutines = "1.8.1"
# TODO kotlin 1.9 upgrade: fix GraphQLTestUtils and GenerateKotlinxClientIT
Expand All @@ -29,7 +29,7 @@ spring-boot = "3.2.7"
commons-codec = { strictly = "[1.13, 2[", prefer = "1.16.0" }

# test dependencies
compile-testing = "0.5.0"
compile-testing = "0.5.1"
icu = "75.1"
junit = "5.10.2"
logback = "1.5.6"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ internal class MetadataCapturingDataFetcherFactoryProvider(val scanResult: ScanR
// we need to capture enums
private val additionalTypes: MutableSet<String> = HashSet()

@OptIn(ExperimentalStdlibApi::class)
override fun functionDataFetcherFactory(target: Any?, kClass: KClass<*>, kFunction: KFunction<*>): DataFetcherFactory<Any?> {
val methodName = kFunction.javaMethod!!.name
val classMetadata = reflectMetadataMap.getOrPut(kClass.java.name) { MutableClassMetadata(name = kClass.java.name, methods = ArrayList()) }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import com.expediagroup.graphql.plugin.graalvm.MetadataCapturingDataFetcherFactoryProvider
import com.expediagroup.graphql.plugin.graalvm.enums.EnumQuery
import io.github.classgraph.ClassGraph
import io.github.classgraph.ScanResult
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import kotlin.reflect.KFunction

class MetadataCapturingDataFetcherFactoryProviderTest {

private lateinit var scanResult: ScanResult
private lateinit var provider: MetadataCapturingDataFetcherFactoryProvider

@BeforeEach
fun setup() {
scanResult = ClassGraph().enableAllInfo().acceptPackages("com.expediagroup.graphql.plugin.graalvm").scan()
provider = MetadataCapturingDataFetcherFactoryProvider(scanResult, listOf("com.expediagroup.graphql.plugin.graalvm"))

val kClass = EnumQuery::class
val kFunction = kClass.members.find { it.name == "enumArgQuery" } as KFunction<*>
provider.functionDataFetcherFactory(null, kClass, kFunction)
}

@Test
fun `reflectMetadata should not be empty`() {
val metadata = provider.reflectMetadata()

Assertions.assertNotNull(metadata)
Assertions.assertTrue(metadata.isNotEmpty(), "Reflect metadata should not be empty")
Assertions.assertEquals(listOf("com.expediagroup.graphql.plugin.graalvm"), provider.supportedPackages)
}
}
Loading