feat(build): 阶段0 冒烟底座(ACM2-10 U01–U04)
- U01:接入 KSP(kotlin-ksp 2.3.0)+micronaut-inject-kotlin,Micronaut BeanDefinition 由 0→94 个生成; 移除 processing.annotations 业务包过滤(N23) - U02:补 Gradle wrapper(9.6.1);版本矩阵单一来源——micronaut 固定 5.1.3(gradle.properties micronaut.version,平台 BOM 最高发布版)、JDK25 口径统一、snakeyaml 版本入 catalog; 新增 .github/workflows/ci.yml 与 Dockerfile;.gitignore 补 .kotlin/.opencode/.zcode/.gradle-* - U03:application.yml 键位修正(datasources.default/flyway.datasources.default/kafka.producers.default), 移除 logstash 死配置块、logback env 统一 MSGX_LOGSTASH_*;新增 application-dev.yml(/env、/beans 仅开发放开);PipelineProps 四嵌套类补 @ConfigurationProperties;新增 PipelinePropsBindingTest (改值—回读离线验收,Micronaut Test 5.x 用 TestPropertyProvider) - U04:README「数据库初始化」与 V2.0.0 脚本头声明 CMINMSGS legacy 前置(全新库需先建旧表)
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
package com.gzzn.omms.msgexchange.nextgen.config
|
||||
|
||||
import io.micronaut.test.extensions.junit5.annotation.MicronautTest
|
||||
import io.micronaut.test.support.TestPropertyProvider
|
||||
import jakarta.inject.Inject
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Assertions.assertFalse
|
||||
import org.junit.jupiter.api.Assertions.assertTrue
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.TestInstance
|
||||
import java.time.Duration
|
||||
|
||||
/**
|
||||
* U03(N02)验收:msgx.* 嵌套键「改值—回读」离线化。
|
||||
* 四个嵌套类(Pipeline/Schd/Identity/ConsistencyCheck)须标注 @ConfigurationProperties 才会被绑定;
|
||||
* 未标注时下列覆盖值会静默回落 Kotlin 默认值(本测试即红)。仅注入配置 bean,不触碰仓储/DB。
|
||||
* 注:Micronaut Test 5.x 移除 @Property 注解,改以 TestPropertyProvider 注入测试属性(需 PER_CLASS)。
|
||||
*/
|
||||
@MicronautTest
|
||||
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
||||
class PipelinePropsBindingTest : TestPropertyProvider {
|
||||
|
||||
override fun getProperties(): Map<String, String> = mapOf(
|
||||
"msgx.pipeline.poll-interval" to "PT7S",
|
||||
"msgx.pipeline.max-attempts" to "9",
|
||||
"msgx.schd.flush-limit" to "321",
|
||||
"msgx.identity.include-day-boundary" to "true",
|
||||
"msgx.consistency-check.daily-sample-ratio" to "0.05",
|
||||
)
|
||||
|
||||
@Inject
|
||||
lateinit var props: PipelineProps
|
||||
|
||||
@Test
|
||||
fun `nested msgx keys bind from test properties`() {
|
||||
assertEquals(Duration.ofSeconds(7), props.pipeline.pollInterval)
|
||||
assertEquals(9, props.pipeline.maxAttempts)
|
||||
assertEquals(321, props.schd.flushLimit)
|
||||
assertTrue(props.identity.includeDayBoundary)
|
||||
assertEquals(0.05, props.consistencyCheck.dailySampleRatio, 1e-9)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `top-level scalars still bind`() {
|
||||
assertEquals(PipelineProps.Phase.A, props.phase)
|
||||
assertEquals("msgexchangeapi", props.serviceName)
|
||||
assertFalse(props.registerEureka) // application-test.yml 置 false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
# U03 配置绑定回归测试专用环境(@MicronautTest 默认 environment=test)
|
||||
# 目的:让 ApplicationContext 可无外部依赖启动(内存 datasource / 关闭迁移 / 关闭注册),
|
||||
# 以便以「注入 PipelineProps 断言」离线验证 msgx.* 嵌套键绑定(N02 验收),不依赖 /env 端点。
|
||||
datasources:
|
||||
default:
|
||||
url: jdbc:h2:mem:cfgtest;DB_CLOSE_DELAY=-1
|
||||
username: sa
|
||||
password: ""
|
||||
driver-class-name: org.h2.Driver
|
||||
|
||||
flyway:
|
||||
datasources:
|
||||
default:
|
||||
enabled: false
|
||||
|
||||
redis:
|
||||
uri: redis://127.0.0.1:6379
|
||||
|
||||
kafka:
|
||||
bootstrap:
|
||||
servers: 127.0.0.1:9092
|
||||
|
||||
msgx:
|
||||
register-eureka: false
|
||||
|
||||
micronaut:
|
||||
server:
|
||||
port: 0
|
||||
Reference in New Issue
Block a user