diff --git a/.gitignore b/.gitignore index bf3e1b2..e330f16 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ bin/ ### Mac OS ### .DS_Store /.idea/ +.kotlin diff --git a/build.gradle.kts b/build.gradle.kts index 1a89f6b..3bf4078 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,7 +10,7 @@ import java.lang.System.getenv import java.net.URI plugins { - kotlin("jvm") version "2.0.21" + kotlin("jvm") version "2.0.21" apply false kotlin("plugin.serialization") version "1.9.23" apply false id("org.jlleitschuh.gradle.ktlint") version "12.1.0" id("org.jetbrains.kotlinx.kover") version "0.8.3" @@ -22,9 +22,9 @@ plugins { val springBootVersion by extra { "3.3.5" } -group = "ai.ancf.lmos" - subprojects { + group = "ai.ancf.lmos" + apply(plugin = "kotlin") apply(plugin = "kotlinx-serialization") apply(plugin = "org.cyclonedx.bom") @@ -50,29 +50,24 @@ subprojects { } } - kotlin { - jvmToolchain(17) - } - java { sourceCompatibility = JavaVersion.VERSION_17 - withSourcesJar() - withJavadocJar() } - tasks.named("javadocJar") { + val javadocJar: TaskProvider by tasks.registering(Jar::class) { dependsOn(tasks.dokkaJavadoc) from(tasks.dokkaJavadoc.flatMap { it.outputDirectory }) archiveClassifier.set("javadoc") } dependencies { - testImplementation(kotlin("test")) - testImplementation("io.mockk:mockk:1.13.13") + "testImplementation"("org.junit.jupiter:junit-jupiter:5.11.3") + "testImplementation"("org.assertj:assertj-core:3.26.3") + "testImplementation"("io.mockk:mockk:1.13.13") } - tasks.test { - useJUnitPlatform() + tasks.named("dokkaJavadoc") { + mustRunAfter("checksum") } tasks.withType { @@ -133,21 +128,6 @@ subprojects { } } -dependencies { - testImplementation(kotlin("test")) -} - -tasks.named("jar") { - enabled = false -} - -tasks.test { - useJUnitPlatform() -} -kotlin { - jvmToolchain(17) -} - repositories { mavenLocal() mavenCentral() diff --git a/lmos-router-hybrid-spring-boot-starter/src/test/kotlin/ai/ancf/lmos/router/hybrid/starter/SpringVectorSearchClientPropertiesTest.kt b/lmos-router-hybrid-spring-boot-starter/src/test/kotlin/ai/ancf/lmos/router/hybrid/starter/SpringVectorSearchClientPropertiesTest.kt index 9edd815..4c1ceee 100644 --- a/lmos-router-hybrid-spring-boot-starter/src/test/kotlin/ai/ancf/lmos/router/hybrid/starter/SpringVectorSearchClientPropertiesTest.kt +++ b/lmos-router-hybrid-spring-boot-starter/src/test/kotlin/ai/ancf/lmos/router/hybrid/starter/SpringVectorSearchClientPropertiesTest.kt @@ -5,10 +5,10 @@ package ai.ancf.lmos.router.hybrid.starter import io.mockk.junit5.MockKExtension +import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows import org.junit.jupiter.api.extension.ExtendWith -import kotlin.test.assertEquals -import kotlin.test.assertFailsWith @ExtendWith(MockKExtension::class) class SpringVectorSearchClientPropertiesTest { @@ -45,7 +45,7 @@ class SpringVectorSearchClientPropertiesTest { @Test fun `should throw an exception for invalid threshold`() { val exception = - assertFailsWith { + assertThrows { SpringVectorSearchClientProperties(threshold = -1.0) } assertEquals("threshold must be between 0.0 and 1.0", exception.message) @@ -54,7 +54,7 @@ class SpringVectorSearchClientPropertiesTest { @Test fun `should throw an exception for invalid topK`() { val exception = - assertFailsWith { + assertThrows { SpringVectorSearchClientProperties(topK = -1) } assertEquals("topK must be a positive integer", exception.message) diff --git a/lmos-router-hybrid/src/test/kotlin/ai/ancf/lmos/router/hybrid/ModelToVectorQueryConverterTest.kt b/lmos-router-hybrid/src/test/kotlin/ai/ancf/lmos/router/hybrid/ModelToVectorQueryConverterTest.kt index 014dbd6..aa0a393 100644 --- a/lmos-router-hybrid/src/test/kotlin/ai/ancf/lmos/router/hybrid/ModelToVectorQueryConverterTest.kt +++ b/lmos-router-hybrid/src/test/kotlin/ai/ancf/lmos/router/hybrid/ModelToVectorQueryConverterTest.kt @@ -9,8 +9,8 @@ import ai.ancf.lmos.router.vector.VectorSearchClientRequest import io.mockk.every import io.mockk.mockk import io.mockk.verify +import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test -import kotlin.test.assertEquals class ModelToVectorQueryConverterTest { @Test diff --git a/lmos-router-hybrid/src/test/kotlin/ai/ancf/lmos/router/hybrid/NoOpModelToVectorQueryConverterTest.kt b/lmos-router-hybrid/src/test/kotlin/ai/ancf/lmos/router/hybrid/NoOpModelToVectorQueryConverterTest.kt index 13cf544..80b6d4c 100644 --- a/lmos-router-hybrid/src/test/kotlin/ai/ancf/lmos/router/hybrid/NoOpModelToVectorQueryConverterTest.kt +++ b/lmos-router-hybrid/src/test/kotlin/ai/ancf/lmos/router/hybrid/NoOpModelToVectorQueryConverterTest.kt @@ -6,8 +6,8 @@ package ai.ancf.lmos.router.hybrid import ai.ancf.lmos.router.core.Context import io.mockk.mockk +import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test -import kotlin.test.assertEquals class NoOpModelToVectorQueryConverterTest { @Test diff --git a/lmos-router-llm-spring-boot-starter/src/test/kotlin/ai/ancf/lmos/router/llm/starter/LLMAgentRoutingSpecsResolverAutoConfigurationTest.kt b/lmos-router-llm-spring-boot-starter/src/test/kotlin/ai/ancf/lmos/router/llm/starter/LLMAgentRoutingSpecsResolverAutoConfigurationTest.kt index c403552..b91dd82 100644 --- a/lmos-router-llm-spring-boot-starter/src/test/kotlin/ai/ancf/lmos/router/llm/starter/LLMAgentRoutingSpecsResolverAutoConfigurationTest.kt +++ b/lmos-router-llm-spring-boot-starter/src/test/kotlin/ai/ancf/lmos/router/llm/starter/LLMAgentRoutingSpecsResolverAutoConfigurationTest.kt @@ -11,10 +11,10 @@ import ai.ancf.lmos.router.llm.LLMAgentRoutingSpecsResolver import ai.ancf.lmos.router.llm.ModelClient import ai.ancf.lmos.router.llm.ModelPromptProvider import io.mockk.mockk +import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test import org.springframework.ai.chat.model.ChatModel -import kotlin.test.assertEquals class LLMAgentRoutingSpecsResolverAutoConfigurationTest { private lateinit var properties: LLMAgentRoutingSpecsResolverProperties diff --git a/lmos-router-llm/src/test/kotlin/ai/ancf/lmos/router/llm/DefaultModelClientTest.kt b/lmos-router-llm/src/test/kotlin/ai/ancf/lmos/router/llm/DefaultModelClientTest.kt index 9e53468..0c7d716 100644 --- a/lmos-router-llm/src/test/kotlin/ai/ancf/lmos/router/llm/DefaultModelClientTest.kt +++ b/lmos-router-llm/src/test/kotlin/ai/ancf/lmos/router/llm/DefaultModelClientTest.kt @@ -15,9 +15,9 @@ import io.mockk.every import io.mockk.mockk import io.mockk.mockkConstructor import io.mockk.verify +import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import kotlin.test.assertEquals class DefaultModelClientTest { private lateinit var defaultModelClientProperties: DefaultModelClientProperties diff --git a/lmos-router-vector-spring-boot-starter/src/test/kotlin/ai/ancf/lmos/router/vector/starter/SpringVectorSearchClientPropertiesTest.kt b/lmos-router-vector-spring-boot-starter/src/test/kotlin/ai/ancf/lmos/router/vector/starter/SpringVectorSearchClientPropertiesTest.kt index 59d9c30..8e1b704 100644 --- a/lmos-router-vector-spring-boot-starter/src/test/kotlin/ai/ancf/lmos/router/vector/starter/SpringVectorSearchClientPropertiesTest.kt +++ b/lmos-router-vector-spring-boot-starter/src/test/kotlin/ai/ancf/lmos/router/vector/starter/SpringVectorSearchClientPropertiesTest.kt @@ -5,10 +5,10 @@ package ai.ancf.lmos.router.vector.starter import io.mockk.junit5.MockKExtension +import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows import org.junit.jupiter.api.extension.ExtendWith -import kotlin.test.assertEquals -import kotlin.test.assertFailsWith @ExtendWith(MockKExtension::class) class SpringVectorSearchClientPropertiesTest { @@ -45,7 +45,7 @@ class SpringVectorSearchClientPropertiesTest { @Test fun `should throw an exception for invalid threshold`() { val exception = - assertFailsWith { + assertThrows { SpringVectorSearchClientProperties(threshold = -1.0) } assertEquals("threshold must be between 0.0 and 1.0", exception.message) @@ -54,7 +54,7 @@ class SpringVectorSearchClientPropertiesTest { @Test fun `should throw an exception for invalid topK`() { val exception = - assertFailsWith { + assertThrows { SpringVectorSearchClientProperties(topK = -1) } assertEquals("topK must be a positive integer", exception.message) diff --git a/lmos-router-vector/src/test/kotlin/ai/ancf/lmos/router/vector/CosineSimilarityTest.kt b/lmos-router-vector/src/test/kotlin/ai/ancf/lmos/router/vector/CosineSimilarityTest.kt index f434496..494bc2a 100644 --- a/lmos-router-vector/src/test/kotlin/ai/ancf/lmos/router/vector/CosineSimilarityTest.kt +++ b/lmos-router-vector/src/test/kotlin/ai/ancf/lmos/router/vector/CosineSimilarityTest.kt @@ -4,10 +4,10 @@ package ai.ancf.lmos.router.vector +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.assertThrows import kotlin.math.sqrt -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertFailsWith class CosineSimilarityTest { @Test @@ -18,7 +18,7 @@ class CosineSimilarityTest { // When & Then val exception = - assertFailsWith { + assertThrows { vectorA.cosineSimilarity(vectorB) } assertEquals("Vectors must be of the same length", exception.message) diff --git a/lmos-router-vector/src/test/kotlin/ai/ancf/lmos/router/vector/VectorClientTest.kt b/lmos-router-vector/src/test/kotlin/ai/ancf/lmos/router/vector/VectorClientTest.kt index dbac503..7893d46 100644 --- a/lmos-router-vector/src/test/kotlin/ai/ancf/lmos/router/vector/VectorClientTest.kt +++ b/lmos-router-vector/src/test/kotlin/ai/ancf/lmos/router/vector/VectorClientTest.kt @@ -10,7 +10,7 @@ import kotlinx.serialization.json.Json import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test -import kotlin.test.assertFailsWith +import org.junit.jupiter.api.assertThrows class VectorSearchClientRequestTest { private lateinit var context: Context @@ -74,7 +74,7 @@ class VectorClientExceptionTest { val message = "An error occurred" val exception = - assertFailsWith { + assertThrows { throw VectorClientException(message) }