refactor: 리펙토링 진행중 의존성 gradle은 얇게 유지, 각 모듈에서 처리하고 있는 부분에 대해서 리펙토링
This commit is contained in:
@@ -77,8 +77,14 @@ different answers for the same question.
|
||||
- A capability that needs more than one configuration gets a root class holding the master switch,
|
||||
`@EnableConfigurationProperties`, and an `@Import` of the per-concern classes. Scan nothing:
|
||||
`@Import` from a gated root is what keeps the master switch load-bearing rather than advisory.
|
||||
`autoconfigure/redis/RedisCapabilityConfig` and `notification/NotificationRootAutoConfiguration`
|
||||
are the two worked examples.
|
||||
`autoconfigure/redis/RedisCapabilityConfig` is the bootstrap-owned example. Optional adapter
|
||||
capabilities that own reusable Spring composition publish their own root instead. Notification
|
||||
uses `adapter:outbound:notification`'s `NotificationPlatformAutoConfiguration`; JPA uses the
|
||||
package-private `PersistenceJpaAutoConfiguration` plus `PersistenceJpaRuntimeConfig` from
|
||||
`adapter:outbound:persistence-jpa`. `autoconfigure/jpa/` therefore contains only application
|
||||
startup/deployment policy layered over that leaf runtime — migration sequencing, resolved
|
||||
datasource validation, OSIV/DDL safety, and the management view.
|
||||
Mongo follows the same rule: the persistence-mongo leaf owns MongoRootAutoConfiguration and its internal health bridge; bootstrap owns no Mongo-specific production health configuration.
|
||||
- Shared helpers of a split capability get their own type named for what they are, not a `*Util`
|
||||
bucket — `autoconfigure/redis/RedisKeys` is the reference.
|
||||
|
||||
|
||||
+36
-33
@@ -12,7 +12,7 @@ SSOT 는 [CLAUDE.md](CLAUDE.md) 다.
|
||||
같은 runtime membership 목록을 다시 저장하지 않는다. `verifyRuntimeModuleRegistry`가 resolved
|
||||
`runtimeClasspath`에 registry 밖 project가 침투하지 않았는지만 검증한다.
|
||||
|
||||
`conditionalTransportTest`는 GraphQL/gRPC/WebSocket 세 leaf를 test-only classpath에서 함께 resolve하는
|
||||
`conditionalTransportBuildContractTest`는 GraphQL/gRPC/WebSocket 세 leaf를 test-only classpath에서 함께 resolve하는
|
||||
qualification composition이다. 현재 GraphQL은 app-bootstrap의 실제 dependency이고 master switch로
|
||||
활성화되며, gRPC/WebSocket은 production dependency가 아니다. optional leaf를 실제 app에 채택하려면
|
||||
`app-bootstrap/build.gradle`의 dependency, architecture의 `allowed_dependencies`, typed settings/보안
|
||||
@@ -279,11 +279,11 @@ refresh 완료 전에 실패시킨다.
|
||||
throw 하여 context 가 시작을 거부한다.
|
||||
- **prod 안전 토글은 잘못 켜져 있으면 PROFILE_MISMATCH(exit 71)로 죽인다.** prod 프로파일에서 내부
|
||||
상세 노출/요청 본문 캡처 토글이 켜져 있으면 구조화된 startup-failure 로그와 함께 부팅을 중단한다.
|
||||
- **multi-instance 가 켜지면 조율 bean 이 모두 존재해야 한다.** `APP_MULTI_INSTANCE_ENABLED=true`일
|
||||
때 `REQUIRED_MULTI_INSTANCE_BEANS`(distributed lock / cache stampede protection / outbox leader
|
||||
election / distributed rate limiter / migration startup job)가 하나라도 빠지면
|
||||
REQUIRED_ADAPTER_DISABLED(exit 72)로 실패시킨다. 이 bean 들은 각각 다른 브랜치가 소유하고, 이
|
||||
검증기는 존재 여부만 단언한다.
|
||||
- **multi-instance 가 켜지면 실제 cross-instance lock provider가 조립되어 있어야 한다.**
|
||||
`APP_MULTI_INSTANCE_ENABLED=true`일 때 `distributedLockProvider`가 없거나
|
||||
`DistributedLockPort` 타입이 아니면 REQUIRED_ADAPTER_DISABLED(exit 72)로 실패시킨다. cache refresh
|
||||
coordination은 optional efficiency이고, rate-limit/outbox는 각 capability가 켜졌을 때 자기 provider
|
||||
계약으로 검증하므로 이 전역 스위치가 사용하지 않는 capability까지 강제로 요구하지 않는다.
|
||||
- **prod 판정은 대소문자 무시다.** `SPRING_PROFILES_ACTIVE=PROD` 오타도 prod-safety 가드를
|
||||
발동시켜야 하므로 `equalsIgnoreCase`로 비교한다.
|
||||
|
||||
@@ -421,8 +421,11 @@ refresh 완료 전에 실패시킨다.
|
||||
inProcessDistributedLock`(in-process `DefaultLockRegistry`)이 그대로 선택된다.** 이 경로는 의도적
|
||||
으로 계측하지 않는다 — `lock.acquisition` 카운터는 인스턴스 간 분산 조율을 관측할 때만 의미가
|
||||
있고, JVM 안의 단순 뮤텍스에는 무의미하기 때문이다.
|
||||
- **빈 이름 `"distributedLockProvider"`는 `StartupSafetyValidator`가 이름으로 조회해 검증하는
|
||||
계약이다.** 절대 이름을 바꾸지 말 것.
|
||||
- **빈 이름 `"distributedLockProvider"`는 `StartupSafetyValidator`가 이름과
|
||||
`DistributedLockPort` 타입을 함께 검증하는 계약이다.** `APP_MULTI_INSTANCE_ENABLED=true`는 이
|
||||
cross-instance lock provider를 선택한다. cache refresh / rate-limit / outbox 같은 다른 capability의
|
||||
분산 보장은 각 capability가 켜졌을 때 자기 계약으로 검증하며, 이 스위치가 존재하지 않는 sibling
|
||||
capability까지 암묵적으로 켜지는 것으로 해석하지 않는다.
|
||||
|
||||
### MeteredDistributedLockPort
|
||||
- **`DistributedLockPort`를 감싸는 얇은 Micrometer 데코레이터다.** `tryAcquire` 호출마다
|
||||
@@ -467,10 +470,10 @@ refresh 완료 전에 실패시킨다.
|
||||
- **`outboxRelayScheduler` 빈은 `ca-skeleton.outbox.relay-enabled`로 게이팅한다(기본 true,
|
||||
`matchIfMissing=true`).** 릴레이를 끄고 싶을 때 빈 자체가 만들어지지 않게 하기 위함. 키가 없으면
|
||||
켜진 것으로 본다.
|
||||
- **`outboxLeaderElection` 토큰 빈은 조건 없이(unconditional) 항상 등록한다.** `StartupSafetyValidator`
|
||||
가 `APP_MULTI_INSTANCE_ENABLED=true`일 때 이 빈을 반드시 찾을 수 있어야 하기 때문이다. SKIP
|
||||
LOCKED 는 멀티 인스턴스 여부와 무관하게 언제나 릴레이의 리더십 메커니즘이라, `@ConditionalOnProperty`
|
||||
로 끌 수 있게 만들면 단순 조정 기능이 아니라 릴레이 정확성 자체가 깨진다.
|
||||
- **`outboxLeaderElection` 토큰 빈은 outbox capability 안에서 조건 없이 등록한다.** SKIP LOCKED 는
|
||||
멀티 인스턴스 전역 스위치와 무관하게 outbox relay 자체의 리더십/claim 메커니즘이라, outbox가 켜진
|
||||
상태에서 별도 하위 토글로 끌 수 있게 만들지 않는다. 이 토큰은 outbox 조립의 자기 설명용 marker이지
|
||||
`APP_MULTI_INSTANCE_ENABLED`의 전역 필수 빈이 아니다.
|
||||
- **`outboxMetrics` 빈은 `MeterRegistry`가 없을 때 no-op 이다.** Actuator 가 클래스패스에 없는
|
||||
환경에서도 와이어링이 깨지지 않도록 `ObjectProvider`로 레지스트리를 선택적으로 주입한다.
|
||||
|
||||
@@ -561,7 +564,7 @@ refresh 완료 전에 실패시킨다.
|
||||
이하만이라는 정책 때문이다. `INFO` 이하는 확률 `rate`로 보존하고 나머지는 `FilterReply.DENY`로
|
||||
버린다.
|
||||
- **단일 `rate` 노브로 제어한다.** `APP_LOG_SAMPLING_RATE`(logback `springProperty`)에서 주입되고,
|
||||
운영자가 프로파일별로 설정한다(prod `0.1` = INFO 10% 샘플링, staging/dev/local `1.0` = 전부 보존).
|
||||
운영자가 런타임별로 설정한다(prod `0.1` = INFO 10% 샘플링, dev/local `1.0` = 전부 보존).
|
||||
고트래픽 vs 일반 엔드포인트의 더 세밀한 분기는 이 전역 rate 위에 마커 기반 확장으로 문서화만 되어
|
||||
있고 여기서는 구현하지 않았다.
|
||||
- **검증은 "경고 후 기본값(warn-and-default)" 방식이다.** `rate`가 `[0.0, 1.0]` 범위를 벗어나면
|
||||
@@ -691,8 +694,8 @@ refresh 완료 전에 실패시킨다.
|
||||
`APP_TRACING_ENABLED` → `enabled`, `APP_TRACING_SAMPLE_RATE` → `sampleRate`,
|
||||
`OTEL_EXPORTER_OTLP_ENDPOINT` → `exporter.otlpEndpoint`.
|
||||
- **`sampleRate`가 blank 이면 숫자 검증을 건너뛴다.** blank 는 "값이 잘못됐다"가 아니라 "프로파일별
|
||||
기본값에 위임하라"는 신호이기 때문이다. 실제 프로파일별 기본값(prod=0.01, staging=0.10,
|
||||
dev/local=1.0)은 `TracingSampleRateResolver`가 소유하고, resolved 된 값은
|
||||
기본값에 위임하라"는 신호이기 때문이다. 실제 런타임별 기본값(prod=0.01, dev/local=1.0)은 `TracingSampleRateResolver`가 적용하고,
|
||||
profile vocabulary 자체는 `RuntimeEnvironment`가 소유한다. resolved 된 값은
|
||||
`TracingSamplingEnvironmentPostProcessor`가 Spring Boot 네이티브
|
||||
`management.tracing.sampling.probability`로 브리지한다.
|
||||
- **검증은 시작 시 fail-fast 다.** `sampleRate`가 non-blank 인데 [0.0, 1.0] float 이 아니면 시작이
|
||||
@@ -704,20 +707,19 @@ refresh 완료 전에 실패시킨다.
|
||||
위한 것이다.
|
||||
|
||||
### TracingSampleRateResolver
|
||||
- **프로파일별 트레이싱 샘플 비율 SSOT 다.** prod=0.01(1%), staging=0.10(10%), dev/local=1.0(100%),
|
||||
그 외=1.0. `APP_TRACING_SAMPLE_RATE`가 non-blank 이고 [0,1] float 로 파싱되면 프로파일 기본값을
|
||||
- **런타임별 트레이싱 샘플 정책을 적용한다.** prod=0.01(1%), dev/local=1.0(100%)이며,
|
||||
런타임 이름의 SSOT는 `RuntimeEnvironment`다. shipped runtime이 아닌 값은 1.0 안전값을 사용한다. `APP_TRACING_SAMPLE_RATE`가 non-blank 이고 [0,1] float 로 파싱되면 프로파일 기본값을
|
||||
override 한다.
|
||||
- **Spring 의존성이 전혀 없는 순수 Java 로 작성했다.** 어떤 컨텍스트도 없이 단위 테스트할 수 있고,
|
||||
`EnvironmentPostProcessor`(컨텍스트 생성 이전 단계)와 `TracingConfig`(빈 생성 단계) 양쪽에서 동일
|
||||
로직을 재사용하기 위함이다.
|
||||
|
||||
### TracingSamplingRateGauge
|
||||
- **`tracing.sampling.rate` 게이지를 등록한다.** metric 계약: type=gauge, tag=`profile`(prod/staging/
|
||||
dev/local 허용), value=resolved effective sample rate(double in [0.0, 1.0]).
|
||||
- **오직 active Spring profile 의 시리즈 하나만 방출하므로 cardinality 는 1이다.** tag 는 프로파일
|
||||
이름을 정규화하지 않고 그대로 쓴다. 따라서 비표준 프로파일(예: "qa")로 띄워도 시리즈 하나는 정상
|
||||
방출되고, 단지 4-value allowlist 를 벗어날 뿐이다 — 이는 런타임 에러가 아니라 레지스트리 문서상의
|
||||
관심사다.
|
||||
- **`tracing.sampling.rate` 게이지를 등록한다.** metric 계약: type=gauge, tag=`profile`(prod/dev/local
|
||||
허용), value=resolved effective sample rate(double in [0.0, 1.0]).
|
||||
- **deployable `RuntimeEnvironment`가 정확히 하나 해석될 때만 시리즈 하나를 방출한다.**
|
||||
test/profileless/unknown 컨텍스트를 `local`로 가장하지 않으며, shipped app은 그보다 앞선 profile
|
||||
validator에서 잘못된 런타임 환경을 거부한다.
|
||||
- **`MeterRegistry`를 `ObjectProvider`로 조회하며, Actuator 미탑재로 빈이 없으면 등록을 조용히
|
||||
건너뛴다.** 이는 `BackgroundJobMetrics` / `OutboxMetrics`의 선례를 그대로 따른다.
|
||||
|
||||
@@ -780,15 +782,16 @@ refresh 완료 전에 실패시킨다.
|
||||
책임 밖이라 여기서 중복 강제하지 않는다.
|
||||
|
||||
### RuntimeSafetySettings
|
||||
- **시작 시 `StartupSafetyValidator`가 강제하는 운영 안전 토글이다.** `ca-skeleton.runtime.*`
|
||||
바인딩(원천 `APP_ERROR_DETAIL_EXPOSURE_ENABLED`, `APP_LOG_BODY_CAPTURE_ENABLED`,
|
||||
`APP_MULTI_INSTANCE_ENABLED`, 모두 기본값 `false`).
|
||||
- **`errorDetailExposureEnabled` / `logBodyCaptureEnabled`는 prod-unsafe 토글이다.** `prod`
|
||||
프로파일에서 둘 중 하나라도 켜면 시작이 실패한다. 그래야 내부 에러 상세나 요청 본문 캡처가
|
||||
프로덕션에서 조용히 켜진 채 남는 일이 없다.
|
||||
- **`multiInstanceEnabled`가 `true`면 인스턴스 조율 capability 빈들(lock / cache-stampede / leader /
|
||||
rate-limit / migration)이 모두 존재하는지 단언하고, 하나라도 없으면 시작을 실패시킨다.** 멀티
|
||||
인스턴스 모드를 켜놓고 조율 인프라가 빠진 채 기동되는 위험한 상태를 막기 위함이다.
|
||||
- **시작 시 `StartupSafetyValidator`가 강제하는 운영 안전 설정이다.** 현재 구현된 runtime
|
||||
contract는 `APP_MULTI_INSTANCE_ENABLED`이며, 활성화 시 cross-instance `DistributedLockPort`가
|
||||
실제로 조립됐는지 검증한다.
|
||||
- 내부 error detail 노출과 request/response body logging은 shipped 구현이 없으므로 예약 토글도
|
||||
두지 않는다. body 로그 안전성은 `RequestLoggingFilter`가 body를 읽지 않는 계약으로 검증한다.
|
||||
- **`multiInstanceEnabled`가 `true`면 shipped cross-instance `DistributedLockPort`가 실제로
|
||||
조립됐는지 단언하고, 없거나 이름만 맞춘 잘못된 타입이면 시작을 실패시킨다.** 이 스위치는 JPA-backed
|
||||
distributed lock 선택자다. cache refresh coordination은 optional efficiency이고, rate-limit/outbox는
|
||||
각 capability의 활성화 계약이 자기 분산 보장을 검증하므로 여기서 사용하지 않는 기능까지 강제로
|
||||
요구하지 않는다.
|
||||
|
||||
---
|
||||
|
||||
@@ -829,7 +832,7 @@ app-bootstrap 은 합성 루트라 "왜 이 의존성이, 왜 이 scope 로" 결
|
||||
JPA/Hikari 가 compile 경로로 오지 않는다. outbox contract 테스트가 minimal Spring context 를 직접
|
||||
만들어 이들이 컴파일 시점에 필요하다.
|
||||
- **`spring-integration-jdbc`** — `JdbcLockRegistry`/`DefaultLockRepository`도 rdbms 의
|
||||
`implementation`이라 안 샌다. `DistributedLockProviderContractTest`가 같은 Testcontainers PG
|
||||
`implementation`이라 안 샌다. `PostgreSqlDistributedLockIntegrationTest`가 persistence-jpa Testcontainers PG
|
||||
DataSource 에 대해 독립 registry 두 개(= 두 인스턴스 시뮬레이션)를 직접 만들어 상호배제·리스 만료를
|
||||
검증한다. 테스트 전용 — production 와이어링은 전부 `DistributedLockPersistenceConfig`(rdbms) 소유.
|
||||
- **`spring-boot-starter-json`** — `JacksonAutoConfiguration`은 jackson-databind 가 test 경로에 있어야
|
||||
|
||||
@@ -38,8 +38,10 @@ auxiliarySourceSets {
|
||||
strictTestLanes {
|
||||
lane('integrationTest') {
|
||||
integration()
|
||||
description = 'Testcontainers-backed real-PostgreSQL integration contracts.'
|
||||
description = 'Runs composition-root integration checks against real required providers.'
|
||||
sourceSet = 'integrationTest'
|
||||
requires 'dev.caskeleton.bootstrap.integration.fileserver.FileserverCompositionIntegrationTest'
|
||||
requires 'dev.caskeleton.bootstrap.integration.objectstorage.ObjectStorageCompositionIntegrationTest'
|
||||
}
|
||||
lane('architectureTest') {
|
||||
architecture()
|
||||
@@ -60,14 +62,18 @@ strictTestLanes {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named('check') {
|
||||
dependsOn tasks.named('systemTestLaneCheck')
|
||||
}
|
||||
|
||||
// architectureTest and systemTest compile against test fixtures but intentionally mirror
|
||||
// the ordinary test runtime rather than their compile classpath. `runtimeFrom 'test'` above keeps
|
||||
// testCompileOnly analysis dependencies out of these behavioral lanes.
|
||||
|
||||
sourceSets {
|
||||
conditionalTransportTest {
|
||||
java.srcDir 'src/conditionalTransportTest/java'
|
||||
resources.srcDir 'src/conditionalTransportTest/resources'
|
||||
conditionalTransportBuildContractTest {
|
||||
java.srcDir 'src/conditionalTransportBuildContractTest/java'
|
||||
resources.srcDir 'src/conditionalTransportBuildContractTest/resources'
|
||||
compileClasspath += sourceSets.main.output
|
||||
runtimeClasspath += sourceSets.main.output
|
||||
}
|
||||
@@ -76,6 +82,8 @@ sourceSets {
|
||||
dependencies {
|
||||
implementation project(':domain-core')
|
||||
implementation project(':application-core')
|
||||
implementation project(':application-notification')
|
||||
implementation project(':application-fileserver')
|
||||
implementation project(':adapter:outbound:persistence-jpa')
|
||||
|
||||
// The JPA rule pack, for the production architecture suite. Test scope only: the rules are
|
||||
@@ -108,6 +116,7 @@ dependencies {
|
||||
// MessagingMembershipQualificationTest holds that distinction so it cannot be forgotten.
|
||||
implementation project(':messaging:messaging-spring-boot-starter')
|
||||
implementation project(':adapter:outbound:cache-redis')
|
||||
implementation project(':adapter:outbound:redis-runtime')
|
||||
implementation project(':adapter:outbound:notification')
|
||||
implementation project(':adapter:outbound:fileserver')
|
||||
implementation project(':adapter:outbound:httpclient')
|
||||
@@ -145,6 +154,7 @@ dependencies {
|
||||
implementation 'org.springframework.boot:spring-boot-starter-security'
|
||||
|
||||
// test-only: ArchUnit needs actuator types to verify the health-shape guardrail. See README.
|
||||
testImplementation project(':adapter:outbound:messaging-kafka')
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-actuator'
|
||||
// test-only: @WithMockUser for the actuator security authorization tests. See README.
|
||||
testImplementation 'org.springframework.security:spring-security-test'
|
||||
@@ -153,6 +163,13 @@ dependencies {
|
||||
// so `:app-bootstrap:test` cannot start a container — the source-set boundary is what enforces
|
||||
// BOOT-014, and a dependency left on the test classpath would let the boundary be crossed back
|
||||
// by a single import.
|
||||
integrationTestImplementation project(':adapter:outbound:objectstorage')
|
||||
integrationTestImplementation project(':application-objectstorage')
|
||||
// objectstorage intentionally imports the AWS SDK BOM only at its own module scope. This
|
||||
// qualification composition consumes the leaf from a separate source set, so it repeats the
|
||||
// platform here rather than widening app-bootstrap's production dependency-management surface.
|
||||
integrationTestImplementation platform("software.amazon.awssdk:bom:${libs.versions.awsSdk.get()}")
|
||||
integrationTestImplementation 'org.testcontainers:testcontainers'
|
||||
integrationTestImplementation 'org.testcontainers:testcontainers-postgresql'
|
||||
integrationTestImplementation 'org.testcontainers:testcontainers-junit-jupiter'
|
||||
// test-only, compile-only: TestcontainersUsingFixture declares a PostgreSQLContainer *field type*
|
||||
@@ -168,10 +185,6 @@ dependencies {
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||
testImplementation 'com.zaxxer:HikariCP'
|
||||
|
||||
// integration-lane-only: JdbcLockRegistry for the distributed-lock contract test (two simulated
|
||||
// instances). Nothing under src/test imports org.springframework.integration.
|
||||
integrationTestImplementation 'org.springframework.integration:spring-integration-jdbc'
|
||||
|
||||
testImplementation libs.archunit.junit5
|
||||
// test-only: jackson-databind for the deserialization-policy boundary test. See README.
|
||||
testImplementation 'org.springframework.boot:spring-boot-starter-json'
|
||||
@@ -213,13 +226,13 @@ dependencies {
|
||||
testImplementation 'org.junit.platform:junit-platform-testkit'
|
||||
// Explicit qualification-only composition. These projects remain absent from main
|
||||
// api/implementation/compileOnly/runtimeOnly and therefore from both shipped runtime graphs.
|
||||
conditionalTransportTestImplementation project(':adapter:inbound:graphql')
|
||||
conditionalTransportTestImplementation project(':adapter:inbound:grpc')
|
||||
conditionalTransportTestImplementation project(':adapter:inbound:websocket')
|
||||
conditionalTransportTestImplementation 'org.junit.jupiter:junit-jupiter'
|
||||
conditionalTransportTestImplementation 'org.assertj:assertj-core'
|
||||
conditionalTransportTestImplementation 'org.yaml:snakeyaml'
|
||||
conditionalTransportTestRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||
conditionalTransportBuildContractTestImplementation project(':adapter:inbound:graphql')
|
||||
conditionalTransportBuildContractTestImplementation project(':adapter:inbound:grpc')
|
||||
conditionalTransportBuildContractTestImplementation project(':adapter:inbound:websocket')
|
||||
conditionalTransportBuildContractTestImplementation 'org.junit.jupiter:junit-jupiter'
|
||||
conditionalTransportBuildContractTestImplementation 'org.assertj:assertj-core'
|
||||
conditionalTransportBuildContractTestImplementation 'org.yaml:snakeyaml'
|
||||
conditionalTransportBuildContractTestRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||
}
|
||||
|
||||
def repositoryRootForContractTests = rootProject.projectDir.parentFile.absolutePath
|
||||
@@ -243,10 +256,10 @@ tasks.named('test', Test) {
|
||||
|
||||
|
||||
def conditionalTransportCompositionQualification = extensions.getByName('strictQualification').register(
|
||||
'conditionalTransportCompositionTest',
|
||||
sourceSets.conditionalTransportTest,
|
||||
'conditionalTransportBuildContractTest',
|
||||
sourceSets.conditionalTransportBuildContractTest,
|
||||
[
|
||||
'dev.caskeleton.bootstrap.transport.ConditionalTransportCompositionContractTest'
|
||||
'dev.caskeleton.bootstrap.transport.ConditionalTransportBuildContractTest'
|
||||
],
|
||||
'Proves the explicit test-only GraphQL/gRPC/WebSocket opt-in classpath.'
|
||||
)
|
||||
|
||||
+155
-135
@@ -2,57 +2,57 @@
|
||||
# Manual edits can break the build and are not advised.
|
||||
# This file is expected to be part of source control.
|
||||
aopalliance:aopalliance:1.0=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
at.yawk.lz4:lz4-java:1.10.1=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
at.yawk.lz4:lz4-java:1.10.1=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
biz.aQute.bnd:biz.aQute.bnd.annotation:7.1.0=architectureTestCompileClasspath,compileClasspath,integrationTestCompileClasspath,systemTestCompileClasspath,testCompileClasspath
|
||||
ch.qos.logback:logback-classic:1.5.38=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
ch.qos.logback:logback-core:1.5.38=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
ch.qos.logback:logback-classic:1.5.38=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
ch.qos.logback:logback-core:1.5.38=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
com.approvaltests:approvaltests-util:31.0.0=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
com.approvaltests:approvaltests:31.0.0=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
com.ethlo.time:itu:1.14.0=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
com.fasterxml.jackson.core:jackson-annotations:2.21=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
com.fasterxml.jackson.core:jackson-annotations:2.21=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
com.fasterxml.jackson.core:jackson-core:2.21.5=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
com.fasterxml.jackson.core:jackson-databind:2.21.5=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.21.5=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.21.5=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
com.fasterxml.jackson:jackson-bom:2.21.5=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
com.fasterxml:classmate:1.7.3=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
com.github.ben-manes.caffeine:caffeine:3.2.4=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.fasterxml:classmate:1.7.3=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
com.github.ben-manes.caffeine:caffeine:3.2.4=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportBuildContractTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.github.docker-java:docker-java-api:3.7.1=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
com.github.docker-java:docker-java-transport-zerodep:3.7.1=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
com.github.docker-java:docker-java-transport:3.7.1=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
com.github.kevinstern:software-and-algorithms:1.0=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.github.luben:zstd-jni:1.5.6-10=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
com.github.kevinstern:software-and-algorithms:1.0=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportBuildContractTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.github.luben:zstd-jni:1.5.6-10=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
com.github.spotbugs:spotbugs-annotations:4.10.2=spotbugs
|
||||
com.github.spotbugs:spotbugs:4.10.2=spotbugs
|
||||
com.github.stephenc.jcip:jcip-annotations:1.0-1=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,spotbugs,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
com.google.android:annotations:4.1.1.4=conditionalTransportTestRuntimeClasspath
|
||||
com.google.api.grpc:proto-google-common-protos:2.41.0=conditionalTransportTestRuntimeClasspath
|
||||
com.google.auto.service:auto-service-annotations:1.0.1=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.google.auto.value:auto-value-annotations:1.9=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.google.auto:auto-common:1.2.2=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.google.code.findbugs:jsr305:3.0.2=checkstyle,conditionalTransportTestRuntimeClasspath,spotbugs
|
||||
com.google.code.gson:gson:2.13.2=architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestRuntimeClasspath,spotbugs,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
com.google.errorprone:error_prone_annotation:2.49.0=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.google.android:annotations:4.1.1.4=conditionalTransportBuildContractTestRuntimeClasspath
|
||||
com.google.api.grpc:proto-google-common-protos:2.41.0=conditionalTransportBuildContractTestRuntimeClasspath
|
||||
com.google.auto.service:auto-service-annotations:1.0.1=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportBuildContractTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.google.auto.value:auto-value-annotations:1.9=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportBuildContractTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.google.auto:auto-common:1.2.2=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportBuildContractTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.google.code.findbugs:jsr305:3.0.2=checkstyle,conditionalTransportBuildContractTestRuntimeClasspath,spotbugs
|
||||
com.google.code.gson:gson:2.13.2=architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestRuntimeClasspath,spotbugs,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
com.google.errorprone:error_prone_annotation:2.49.0=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportBuildContractTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.google.errorprone:error_prone_annotations:2.38.0=architectureTestCompileClasspath,compileClasspath,integrationTestCompileClasspath,systemTestCompileClasspath,testCompileClasspath
|
||||
com.google.errorprone:error_prone_annotations:2.41.0=architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestRuntimeClasspath,spotbugs,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
com.google.errorprone:error_prone_annotations:2.41.0=architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestRuntimeClasspath,spotbugs,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
com.google.errorprone:error_prone_annotations:2.47.0=checkstyle
|
||||
com.google.errorprone:error_prone_annotations:2.49.0=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.google.errorprone:error_prone_check_api:2.49.0=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.google.errorprone:error_prone_core:2.49.0=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.google.googlejavaformat:google-java-format:1.35.0=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.google.guava:failureaccess:1.0.2=conditionalTransportTestRuntimeClasspath
|
||||
com.google.guava:failureaccess:1.0.3=annotationProcessor,architectureTestAnnotationProcessor,checkstyle,conditionalTransportTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.google.guava:guava:33.2.1-jre=conditionalTransportTestRuntimeClasspath
|
||||
com.google.guava:guava:33.5.0-jre=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.google.errorprone:error_prone_annotations:2.49.0=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportBuildContractTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.google.errorprone:error_prone_check_api:2.49.0=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportBuildContractTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.google.errorprone:error_prone_core:2.49.0=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportBuildContractTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.google.googlejavaformat:google-java-format:1.35.0=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportBuildContractTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.google.guava:failureaccess:1.0.2=conditionalTransportBuildContractTestRuntimeClasspath
|
||||
com.google.guava:failureaccess:1.0.3=annotationProcessor,architectureTestAnnotationProcessor,checkstyle,conditionalTransportBuildContractTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.google.guava:guava:33.2.1-jre=conditionalTransportBuildContractTestRuntimeClasspath
|
||||
com.google.guava:guava:33.5.0-jre=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportBuildContractTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.google.guava:guava:33.6.0-jre=checkstyle
|
||||
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=annotationProcessor,architectureTestAnnotationProcessor,checkstyle,conditionalTransportTestAnnotationProcessor,conditionalTransportTestRuntimeClasspath,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.google.j2objc:j2objc-annotations:2.8=conditionalTransportTestRuntimeClasspath
|
||||
com.google.j2objc:j2objc-annotations:3.1=annotationProcessor,architectureTestAnnotationProcessor,checkstyle,conditionalTransportTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.google.protobuf:protobuf-java-util:3.25.5=conditionalTransportTestRuntimeClasspath
|
||||
com.google.protobuf:protobuf-java:3.25.5=conditionalTransportTestRuntimeClasspath
|
||||
com.google.protobuf:protobuf-java:4.33.2=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.graphql-java:graphql-java:25.0=architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
com.graphql-java:java-dataloader:6.0.0=architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=annotationProcessor,architectureTestAnnotationProcessor,checkstyle,conditionalTransportBuildContractTestAnnotationProcessor,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.google.j2objc:j2objc-annotations:2.8=conditionalTransportBuildContractTestRuntimeClasspath
|
||||
com.google.j2objc:j2objc-annotations:3.1=annotationProcessor,architectureTestAnnotationProcessor,checkstyle,conditionalTransportBuildContractTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.google.protobuf:protobuf-java-util:3.25.5=conditionalTransportBuildContractTestRuntimeClasspath
|
||||
com.google.protobuf:protobuf-java:3.25.5=conditionalTransportBuildContractTestRuntimeClasspath
|
||||
com.google.protobuf:protobuf-java:4.33.2=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportBuildContractTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
com.graphql-java:graphql-java:25.0=architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
com.graphql-java:java-dataloader:6.0.0=architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
com.h2database:h2:2.4.240=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
com.h3xstream.findsecbugs:findsecbugs-plugin:1.14.0=spotbugsPlugins
|
||||
com.jayway.jsonpath:json-path:2.10.0=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
@@ -62,7 +62,6 @@ com.nimbusds:lang-tag:1.7=architectureTestCompileClasspath,architectureTestRunti
|
||||
com.nimbusds:nimbus-jose-jwt:10.4=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
com.nimbusds:oauth2-oidc-sdk:11.26.1=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
com.puppycrawl.tools:checkstyle:13.5.0=checkstyle
|
||||
com.rabbitmq:amqp-client:5.27.1=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
com.squareup.okhttp3:okhttp-jvm:5.2.1=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
com.squareup.okhttp3:okhttp:5.2.1=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
com.squareup.okio:okio-jvm:3.16.1=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
@@ -80,14 +79,14 @@ commons-codec:commons-codec:1.19.0=architectureTestCompileClasspath,architecture
|
||||
commons-collections:commons-collections:3.2.2=checkstyle
|
||||
commons-io:commons-io:2.20.0=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
commons-io:commons-io:2.21.0=spotbugs
|
||||
commons-logging:commons-logging:1.3.6=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
commons-logging:commons-logging:1.3.6=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
eu.rekawek.toxiproxy:toxiproxy-java:2.1.11=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
info.picocli:picocli:4.7.7=checkstyle
|
||||
io.cloudevents:cloudevents-api:4.0.1=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
io.cloudevents:cloudevents-core:4.0.1=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
io.github.cdimascio:dotenv-java:3.0.0=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
io.github.eisop:dataflow-errorprone:3.41.0-eisop1=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
io.github.java-diff-utils:java-diff-utils:4.12=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
io.github.eisop:dataflow-errorprone:3.41.0-eisop1=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportBuildContractTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
io.github.java-diff-utils:java-diff-utils:4.12=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportBuildContractTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
io.github.resilience4j:resilience4j-bulkhead:2.2.0=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
io.github.resilience4j:resilience4j-circuitbreaker:2.2.0=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
io.github.resilience4j:resilience4j-core:2.2.0=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
@@ -95,21 +94,21 @@ io.github.resilience4j:resilience4j-micrometer:2.2.0=architectureTestRuntimeClas
|
||||
io.github.resilience4j:resilience4j-ratelimiter:2.2.0=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
io.github.resilience4j:resilience4j-retry:2.2.0=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
io.github.resilience4j:resilience4j-timelimiter:2.2.0=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
io.grpc:grpc-api:1.68.1=conditionalTransportTestRuntimeClasspath
|
||||
io.grpc:grpc-context:1.68.1=conditionalTransportTestRuntimeClasspath
|
||||
io.grpc:grpc-core:1.68.1=conditionalTransportTestRuntimeClasspath
|
||||
io.grpc:grpc-netty-shaded:1.68.1=conditionalTransportTestRuntimeClasspath
|
||||
io.grpc:grpc-protobuf-lite:1.68.1=conditionalTransportTestRuntimeClasspath
|
||||
io.grpc:grpc-protobuf:1.68.1=conditionalTransportTestRuntimeClasspath
|
||||
io.grpc:grpc-services:1.68.1=conditionalTransportTestRuntimeClasspath
|
||||
io.grpc:grpc-stub:1.68.1=conditionalTransportTestRuntimeClasspath
|
||||
io.grpc:grpc-util:1.68.1=conditionalTransportTestRuntimeClasspath
|
||||
io.grpc:grpc-api:1.68.1=conditionalTransportBuildContractTestRuntimeClasspath
|
||||
io.grpc:grpc-context:1.68.1=conditionalTransportBuildContractTestRuntimeClasspath
|
||||
io.grpc:grpc-core:1.68.1=conditionalTransportBuildContractTestRuntimeClasspath
|
||||
io.grpc:grpc-netty-shaded:1.68.1=conditionalTransportBuildContractTestRuntimeClasspath
|
||||
io.grpc:grpc-protobuf-lite:1.68.1=conditionalTransportBuildContractTestRuntimeClasspath
|
||||
io.grpc:grpc-protobuf:1.68.1=conditionalTransportBuildContractTestRuntimeClasspath
|
||||
io.grpc:grpc-services:1.68.1=conditionalTransportBuildContractTestRuntimeClasspath
|
||||
io.grpc:grpc-stub:1.68.1=conditionalTransportBuildContractTestRuntimeClasspath
|
||||
io.grpc:grpc-util:1.68.1=conditionalTransportBuildContractTestRuntimeClasspath
|
||||
io.lettuce:lettuce-core:6.8.2.RELEASE=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
io.micrometer:context-propagation:1.2.1=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
io.micrometer:micrometer-commons:1.16.7=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
io.micrometer:context-propagation:1.2.1=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
io.micrometer:micrometer-commons:1.16.7=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
io.micrometer:micrometer-core:1.16.7=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
io.micrometer:micrometer-jakarta9:1.16.7=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
io.micrometer:micrometer-observation:1.16.7=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
io.micrometer:micrometer-observation:1.16.7=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
io.micrometer:micrometer-registry-prometheus:1.16.7=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
io.micrometer:micrometer-tracing-bridge-otel:1.6.7=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
io.micrometer:micrometer-tracing:1.6.7=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
@@ -121,11 +120,11 @@ io.netty:netty-codec-dns:4.2.17.Final=architectureTestRuntimeClasspath,integrati
|
||||
io.netty:netty-codec-http2:4.2.17.Final=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
io.netty:netty-codec-http3:4.2.17.Final=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
io.netty:netty-codec-http:4.2.17.Final=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
io.netty:netty-codec-marshalling:4.2.17.Final=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
io.netty:netty-codec-marshalling:4.2.17.Final=integrationTestRuntimeClasspath
|
||||
io.netty:netty-codec-native-quic:4.2.17.Final=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
io.netty:netty-codec-protobuf:4.2.17.Final=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
io.netty:netty-codec-protobuf:4.2.17.Final=integrationTestRuntimeClasspath
|
||||
io.netty:netty-codec-socks:4.2.17.Final=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
io.netty:netty-codec:4.2.17.Final=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
io.netty:netty-codec:4.2.17.Final=integrationTestRuntimeClasspath
|
||||
io.netty:netty-common:4.2.17.Final=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
io.netty:netty-handler-proxy:4.2.17.Final=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
io.netty:netty-handler:4.2.17.Final=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
@@ -152,10 +151,10 @@ io.opentelemetry:opentelemetry-sdk-logs:1.55.0=architectureTestCompileClasspath,
|
||||
io.opentelemetry:opentelemetry-sdk-metrics:1.55.0=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
io.opentelemetry:opentelemetry-sdk-trace:1.55.0=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
io.opentelemetry:opentelemetry-sdk:1.55.0=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
io.perfmark:perfmark-api:0.27.0=conditionalTransportTestRuntimeClasspath
|
||||
io.perfmark:perfmark-api:0.27.0=conditionalTransportBuildContractTestRuntimeClasspath
|
||||
io.projectreactor.netty:reactor-netty-core:1.3.7=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
io.projectreactor.netty:reactor-netty-http:1.3.7=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
io.projectreactor:reactor-core:3.8.7=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
io.projectreactor:reactor-core:3.8.7=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
io.prometheus:prometheus-metrics-config:1.4.3=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
io.prometheus:prometheus-metrics-core:1.4.3=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
io.prometheus:prometheus-metrics-exposition-formats:1.4.3=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
@@ -167,21 +166,21 @@ io.swagger.core.v3:swagger-annotations-jakarta:2.2.38=architectureTestRuntimeCla
|
||||
io.swagger.core.v3:swagger-core-jakarta:2.2.38=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
io.swagger.core.v3:swagger-models-jakarta:2.2.38=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
jakarta.activation:jakarta.activation-api:2.1.4=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
jakarta.annotation:jakarta.annotation-api:3.0.0=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
jakarta.annotation:jakarta.annotation-api:3.0.0=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
jakarta.inject:jakarta.inject-api:2.0.1=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
jakarta.mail:jakarta.mail-api:2.1.5=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
jakarta.persistence:jakarta.persistence-api:3.2.0=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
jakarta.servlet:jakarta.servlet-api:6.1.0=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
jakarta.transaction:jakarta.transaction-api:2.0.1=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
jakarta.validation:jakarta.validation-api:3.1.1=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
jakarta.validation:jakarta.validation-api:3.1.1=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
jakarta.websocket:jakarta.websocket-api:2.2.0=architectureTestCompileClasspath,integrationTestCompileClasspath,systemTestCompileClasspath,testCompileClasspath
|
||||
jakarta.ws.rs:jakarta.ws.rs-api:4.0.0=architectureTestCompileClasspath,integrationTestCompileClasspath,systemTestCompileClasspath,testCompileClasspath
|
||||
jakarta.xml.bind:jakarta.xml.bind-api:4.0.5=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
javax.inject:javax.inject:1=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
javax.inject:javax.inject:1=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportBuildContractTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
jaxen:jaxen:2.0.6=spotbugs
|
||||
me.paulschwarz:spring-dotenv:4.0.0=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
net.bytebuddy:byte-buddy-agent:1.17.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
net.bytebuddy:byte-buddy:1.17.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestCompileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
net.bytebuddy:byte-buddy:1.17.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestCompileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
net.java.dev.jna:jna:5.18.1=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
net.logstash.logback:logstash-logback-encoder:8.0=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
net.minidev:accessors-smart:2.6.0=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
@@ -199,28 +198,28 @@ org.apache.groovy:groovy:5.0.8=architectureTestCompileClasspath,integrationTestC
|
||||
org.apache.httpcomponents.client5:httpclient5:5.5.2=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.apache.httpcomponents.core5:httpcore5-h2:5.3.6=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.apache.httpcomponents.core5:httpcore5:5.3.6=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.apache.httpcomponents:httpclient:4.5.13=checkstyle
|
||||
org.apache.httpcomponents:httpcore:4.4.16=checkstyle
|
||||
org.apache.kafka:kafka-clients:4.1.2=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.apache.logging.log4j:log4j-api:2.25.5=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,spotbugs,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.apache.httpcomponents:httpclient:4.5.13=checkstyle,integrationTestRuntimeClasspath
|
||||
org.apache.httpcomponents:httpcore:4.4.16=checkstyle,integrationTestRuntimeClasspath
|
||||
org.apache.kafka:kafka-clients:4.1.2=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.apache.logging.log4j:log4j-api:2.25.5=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,spotbugs,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.apache.logging.log4j:log4j-core:2.25.5=spotbugs
|
||||
org.apache.logging.log4j:log4j-to-slf4j:2.25.5=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.apache.logging.log4j:log4j-to-slf4j:2.25.5=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.apache.maven.doxia:doxia-core:1.12.0=checkstyle
|
||||
org.apache.maven.doxia:doxia-logging-api:1.12.0=checkstyle
|
||||
org.apache.maven.doxia:doxia-module-xdoc:1.12.0=checkstyle
|
||||
org.apache.maven.doxia:doxia-sink-api:1.12.0=checkstyle
|
||||
org.apache.tomcat.embed:tomcat-embed-core:11.0.24=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.apache.tomcat.embed:tomcat-embed-el:11.0.24=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.apache.tomcat.embed:tomcat-embed-websocket:11.0.24=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.apache.tomcat.embed:tomcat-embed-core:11.0.24=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.apache.tomcat.embed:tomcat-embed-el:11.0.24=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.apache.tomcat.embed:tomcat-embed-websocket:11.0.24=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.apache.xbean:xbean-reflect:3.7=checkstyle
|
||||
org.apiguardian:apiguardian-api:1.1.2=architectureTestCompileClasspath,conditionalTransportTestCompileClasspath,integrationTestCompileClasspath,systemTestCompileClasspath,testCompileClasspath
|
||||
org.apiguardian:apiguardian-api:1.1.2=architectureTestCompileClasspath,conditionalTransportBuildContractTestCompileClasspath,integrationTestCompileClasspath,systemTestCompileClasspath,testCompileClasspath
|
||||
org.aspectj:aspectjweaver:1.9.25.1=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.assertj:assertj-core:3.27.7=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestCompileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.assertj:assertj-core:3.27.7=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestCompileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.attoparser:attoparser:2.0.7.RELEASE=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.awaitility:awaitility:4.3.0=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.checkerframework:checker-qual:3.42.0=conditionalTransportTestRuntimeClasspath
|
||||
org.checkerframework:checker-qual:3.42.0=conditionalTransportBuildContractTestRuntimeClasspath
|
||||
org.checkerframework:checker-qual:3.55.1=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.codehaus.mojo:animal-sniffer-annotations:1.24=conditionalTransportTestRuntimeClasspath
|
||||
org.codehaus.mojo:animal-sniffer-annotations:1.24=conditionalTransportBuildContractTestRuntimeClasspath
|
||||
org.codehaus.plexus:plexus-classworlds:2.6.0=checkstyle
|
||||
org.codehaus.plexus:plexus-component-annotations:2.1.0=checkstyle
|
||||
org.codehaus.plexus:plexus-container-default:2.1.0=checkstyle
|
||||
@@ -228,13 +227,6 @@ org.codehaus.plexus:plexus-utils:3.3.0=checkstyle
|
||||
org.dom4j:dom4j:2.2.0=spotbugs
|
||||
org.eclipse.angus:angus-activation:2.0.3=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.eclipse.angus:angus-mail:2.0.5=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.eclipse.jetty.compression:jetty-compression-common:12.1.12=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.eclipse.jetty.compression:jetty-compression-gzip:12.1.12=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.eclipse.jetty:jetty-alpn-client:12.1.12=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.eclipse.jetty:jetty-client:12.1.12=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.eclipse.jetty:jetty-http:12.1.12=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.eclipse.jetty:jetty-io:12.1.12=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.eclipse.jetty:jetty-util:12.1.12=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.flywaydb:flyway-core:11.14.1=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.flywaydb:flyway-database-postgresql:11.14.1=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.glassfish.jaxb:jaxb-core:4.0.9=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
@@ -245,23 +237,23 @@ org.hdrhistogram:HdrHistogram:2.2.2=architectureTestRuntimeClasspath,integration
|
||||
org.hibernate.models:hibernate-models:1.0.1=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.hibernate.orm:hibernate-core:7.2.24.Final=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.hibernate.orm:hibernate-envers:7.2.24.Final=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.hibernate.validator:hibernate-validator:9.0.1.Final=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.hibernate.validator:hibernate-validator:9.0.1.Final=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.javassist:javassist:3.28.0-GA=checkstyle
|
||||
org.javassist:javassist:3.29.0-GA=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.jboss.logging:jboss-logging:3.6.3.Final=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.jboss.logging:jboss-logging:3.6.3.Final=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.jetbrains.kotlin:kotlin-stdlib:2.2.21=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.jetbrains:annotations:13.0=productionRuntimeClasspath,runtimeClasspath
|
||||
org.jetbrains:annotations:17.0.0=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.jspecify:jspecify:1.0.1=annotationProcessor,architectureTestAnnotationProcessor,architectureTestCompileClasspath,architectureTestRuntimeClasspath,checkstyle,compileClasspath,conditionalTransportTestAnnotationProcessor,conditionalTransportTestCompileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestAnnotationProcessor,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestAnnotationProcessor,systemTestCompileClasspath,systemTestRuntimeClasspath,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath
|
||||
org.junit.jupiter:junit-jupiter-api:6.0.3=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestCompileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.junit.jupiter:junit-jupiter-engine:6.0.3=architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestRuntimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.junit.jupiter:junit-jupiter-params:6.0.3=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestCompileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.junit.jupiter:junit-jupiter:6.0.3=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestCompileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.junit.platform:junit-platform-commons:6.0.3=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestCompileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.junit.platform:junit-platform-engine:6.0.3=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.junit.platform:junit-platform-launcher:6.0.3=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.jspecify:jspecify:1.0.1=annotationProcessor,architectureTestAnnotationProcessor,architectureTestCompileClasspath,architectureTestRuntimeClasspath,checkstyle,compileClasspath,conditionalTransportBuildContractTestAnnotationProcessor,conditionalTransportBuildContractTestCompileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestAnnotationProcessor,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestAnnotationProcessor,systemTestCompileClasspath,systemTestRuntimeClasspath,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath
|
||||
org.junit.jupiter:junit-jupiter-api:6.0.3=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestCompileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.junit.jupiter:junit-jupiter-engine:6.0.3=architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestRuntimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.junit.jupiter:junit-jupiter-params:6.0.3=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestCompileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.junit.jupiter:junit-jupiter:6.0.3=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestCompileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.junit.platform:junit-platform-commons:6.0.3=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestCompileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.junit.platform:junit-platform-engine:6.0.3=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.junit.platform:junit-platform-launcher:6.0.3=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.junit.platform:junit-platform-testkit:6.0.3=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.junit:junit-bom:6.0.3=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestCompileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.junit:junit-bom:6.0.3=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestCompileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.junit:junit-bom:6.1.0=spotbugs
|
||||
org.latencyutils:LatencyUtils:2.0.3=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.mockito:mockito-core:5.20.0=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,mockitoAgent,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
@@ -272,7 +264,7 @@ org.mongodb:mongodb-driver-core:5.6.5=architectureTestRuntimeClasspath,integrati
|
||||
org.mongodb:mongodb-driver-sync:5.6.5=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.objenesis:objenesis:3.3=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.openapitools:jackson-databind-nullable:0.2.6=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.opentest4j:opentest4j:1.3.0=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestCompileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.opentest4j:opentest4j:1.3.0=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestCompileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.osgi:org.osgi.annotation.bundle:2.0.0=architectureTestCompileClasspath,compileClasspath,integrationTestCompileClasspath,systemTestCompileClasspath,testCompileClasspath
|
||||
org.osgi:org.osgi.annotation.versioning:1.1.2=architectureTestCompileClasspath,compileClasspath,integrationTestCompileClasspath,systemTestCompileClasspath,testCompileClasspath
|
||||
org.osgi:org.osgi.resource:1.0.0=architectureTestCompileClasspath,compileClasspath,integrationTestCompileClasspath,systemTestCompileClasspath,testCompileClasspath
|
||||
@@ -283,34 +275,32 @@ org.ow2.asm:asm-tree:9.10.1=spotbugs
|
||||
org.ow2.asm:asm-util:9.10.1=spotbugs
|
||||
org.ow2.asm:asm:9.10.1=spotbugs
|
||||
org.ow2.asm:asm:9.7.1=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.pcollections:pcollections:4.0.1=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
org.pcollections:pcollections:4.0.1=annotationProcessor,architectureTestAnnotationProcessor,conditionalTransportBuildContractTestAnnotationProcessor,integrationTestAnnotationProcessor,systemTestAnnotationProcessor,testAnnotationProcessor
|
||||
org.postgresql:postgresql:42.7.13=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.reactivestreams:reactive-streams:1.0.4=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.reactivestreams:reactive-streams:1.0.4=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.reflections:reflections:0.10.2=checkstyle
|
||||
org.rnorth.duct-tape:duct-tape:1.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.skyscreamer:jsonassert:1.5.3=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.slf4j:jul-to-slf4j:2.0.18=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.slf4j:slf4j-api:2.0.18=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,spotbugs,spotbugsSlf4j,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.slf4j:jul-to-slf4j:2.0.18=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.slf4j:slf4j-api:2.0.18=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,spotbugs,spotbugsSlf4j,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.slf4j:slf4j-simple:2.0.17=spotbugsSlf4j
|
||||
org.slf4j:slf4j-simple:2.0.18=checkstyle
|
||||
org.springdoc:springdoc-openapi-starter-common:3.0.0=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springdoc:springdoc-openapi-starter-webmvc-api:3.0.0=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.amqp:spring-amqp:4.0.5=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.amqp:spring-rabbit:4.0.5=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-actuator-autoconfigure:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-actuator:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-autoconfigure:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-autoconfigure:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-configuration-processor:4.0.8=annotationProcessor
|
||||
org.springframework.boot:spring-boot-data-commons:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-data-jpa-test:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-data-jpa:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-data-mongodb:4.0.8=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-flyway:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-graphql:4.0.8=architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-graphql:4.0.8=architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-health:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-hibernate:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-http-converter:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-jackson:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-http-converter:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-jackson:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-jdbc-test:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-jdbc:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-jpa-test:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
@@ -320,54 +310,53 @@ org.springframework.boot:spring-boot-micrometer-metrics:4.0.8=architectureTestCo
|
||||
org.springframework.boot:spring-boot-micrometer-observation:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-mongodb:4.0.8=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-persistence:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-reactor:4.0.8=architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-reactor:4.0.8=architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-resttestclient:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-security-oauth2-resource-server:4.0.8=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-security:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-servlet:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-servlet:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-sql:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-actuator:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-data-jpa:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-data-mongodb:4.0.8=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-flyway:4.0.8=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-graphql:4.0.8=architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-graphql:4.0.8=architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-jackson-test:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-jackson:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-jackson:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-jdbc:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-json:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-logging:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-logging:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-mail:4.0.8=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-micrometer-metrics:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-mongodb:4.0.8=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-oauth2-resource-server:4.0.8=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-security:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-test:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-tomcat-runtime:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-tomcat:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-validation:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-tomcat-runtime:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-tomcat:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-validation:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-web:4.0.8=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-webmvc-test:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-webmvc:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-websocket:4.0.8=conditionalTransportTestRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-webmvc:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter-websocket:4.0.8=conditionalTransportBuildContractTestRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-starter:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-test-autoconfigure:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-test:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-tomcat:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-tomcat:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-transaction:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-validation:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-web-server:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-validation:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-web-server:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-webmvc-test:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-webmvc:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-websocket:4.0.8=conditionalTransportTestRuntimeClasspath
|
||||
org.springframework.boot:spring-boot:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-webmvc:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.boot:spring-boot-websocket:4.0.8=conditionalTransportBuildContractTestRuntimeClasspath
|
||||
org.springframework.boot:spring-boot:4.0.8=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.cloud:spring-cloud-context:4.1.4=architectureTestCompileClasspath,integrationTestCompileClasspath,systemTestCompileClasspath,testCompileClasspath
|
||||
org.springframework.data:spring-data-commons:4.0.7=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.data:spring-data-jpa:4.0.7=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.data:spring-data-mongodb:5.0.7=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.graphql:spring-graphql:2.0.5=architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.integration:spring-integration-core:7.0.6=architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.integration:spring-integration-jdbc:7.0.6=architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.kafka:spring-kafka:4.0.7=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.graphql:spring-graphql:2.0.5=architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.integration:spring-integration-core:7.0.6=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.integration:spring-integration-jdbc:7.0.6=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework.security:spring-security-config:7.0.7=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.security:spring-security-core:7.0.7=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.security:spring-security-crypto:7.0.7=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
@@ -378,22 +367,22 @@ org.springframework.security:spring-security-oauth2-resource-server:7.0.7=archit
|
||||
org.springframework.security:spring-security-test:7.0.7=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.security:spring-security-web:7.0.7=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework.session:spring-session-core:4.0.5=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-aop:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-aop:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-aspects:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-beans:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-beans:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-context-support:7.0.9=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-context:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-core:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-expression:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-context:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-core:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-expression:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-jdbc:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-messaging:7.0.9=architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-messaging:7.0.9=architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-orm:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-test:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-tx:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-web:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-webflux:7.0.9=architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-webmvc:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-websocket:7.0.9=architectureTestCompileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,systemTestCompileClasspath,testCompileClasspath
|
||||
org.springframework:spring-web:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-webflux:7.0.9=architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-webmvc:7.0.9=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.springframework:spring-websocket:7.0.9=architectureTestCompileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,systemTestCompileClasspath,testCompileClasspath
|
||||
org.testcontainers:testcontainers-database-commons:2.0.5=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.testcontainers:testcontainers-jdbc:2.0.5=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.testcontainers:testcontainers-junit-jupiter:2.0.5=architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
@@ -402,12 +391,43 @@ org.testcontainers:testcontainers-toxiproxy:2.0.5=architectureTestRuntimeClasspa
|
||||
org.testcontainers:testcontainers:2.0.5=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.thymeleaf:thymeleaf:3.1.5.RELEASE=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.unbescape:unbescape:1.1.6.RELEASE=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.xerial.snappy:snappy-java:1.1.10.7=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.xerial.snappy:snappy-java:1.1.10.7=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
org.xmlresolver:xmlresolver:5.3.3=checkstyle,spotbugs
|
||||
org.xmlunit:xmlunit-core:2.10.4=architectureTestCompileClasspath,architectureTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.yaml:snakeyaml:2.5=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportTestCompileClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
org.yaml:snakeyaml:2.5=architectureTestCompileClasspath,architectureTestRuntimeClasspath,compileClasspath,conditionalTransportBuildContractTestCompileClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
redis.clients.authentication:redis-authx-core:0.1.1-beta2=architectureTestRuntimeClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestRuntimeClasspath,testRuntimeClasspath
|
||||
tools.jackson.core:jackson-core:3.1.5=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
tools.jackson.core:jackson-databind:3.1.5=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
tools.jackson:jackson-bom:3.1.5=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
software.amazon.awssdk:annotations:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:apache-client:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:arns:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:auth:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:aws-core:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:aws-query-protocol:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:aws-xml-protocol:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:bom:2.30.0=integrationTestCompileClasspath,integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:checksums-spi:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:checksums:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:crt-core:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:endpoints-spi:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:http-auth-aws-eventstream:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:http-auth-aws:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:http-auth-spi:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:http-auth:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:http-client-spi:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:identity-spi:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:json-utils:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:metrics-spi:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:netty-nio-client:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:profiles:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:protocol-core:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:regions:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:retries-spi:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:retries:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:s3:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:sdk-core:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:third-party-jackson-core:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.awssdk:utils:2.30.0=integrationTestRuntimeClasspath
|
||||
software.amazon.eventstream:eventstream:1.0.1=integrationTestRuntimeClasspath
|
||||
tools.jackson.core:jackson-core:3.1.5=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
tools.jackson.core:jackson-databind:3.1.5=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
tools.jackson:jackson-bom:3.1.5=architectureTestCompileClasspath,architectureTestRuntimeClasspath,conditionalTransportBuildContractTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,productionRuntimeClasspath,runtimeClasspath,systemTestCompileClasspath,systemTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
|
||||
empty=developmentOnly,testAndDevelopmentOnly
|
||||
|
||||
+98
@@ -780,6 +780,104 @@ class ApplicationBoundaryArchitectureTest {
|
||||
};
|
||||
}
|
||||
|
||||
@ArchTest
|
||||
static final ArchRule APPLICATION_FILESERVER_TYPES_DO_NOT_OWN_HTTP_TRANSPORT =
|
||||
classes()
|
||||
.that()
|
||||
.resideInAPackage("dev.caskeleton.application.fileserver..")
|
||||
.should(notOwnFileserverHttpTransportVocabulary())
|
||||
.as(
|
||||
"fileserver application types keep only transport-neutral file/range semantics; "
|
||||
+ "HTTP headers, status, validators and named wire protocols belong to inbound adapters")
|
||||
.allowEmptyShould(true);
|
||||
|
||||
private static ArchCondition<JavaClass> notOwnFileserverHttpTransportVocabulary() {
|
||||
Set<String> forbiddenTypes =
|
||||
Set.of(
|
||||
"ConditionalRequest",
|
||||
"ConditionalRequestEvaluator",
|
||||
"DefaultConditionalRequestEvaluator",
|
||||
"HttpRangeResolver",
|
||||
"DefaultHttpRangeResolver",
|
||||
"ContentDispositionFactory",
|
||||
"DownloadDecision",
|
||||
"UploadProtocol");
|
||||
Set<String> forbiddenFields =
|
||||
Set.of(
|
||||
"contentDisposition",
|
||||
"cacheControl",
|
||||
"ifMatch",
|
||||
"ifNoneMatch",
|
||||
"ifModifiedSince",
|
||||
"ifUnmodifiedSince",
|
||||
"ifRange",
|
||||
"range",
|
||||
"strongEtag",
|
||||
"expectedEtag",
|
||||
"TUS_1_0",
|
||||
"HTTPBIS_DRAFT12");
|
||||
return new ArchCondition<>("not own HTTP-shaped fileserver transport vocabulary") {
|
||||
@Override
|
||||
public void check(JavaClass item, ConditionEvents events) {
|
||||
if (forbiddenTypes.contains(item.getSimpleName())) {
|
||||
events.add(
|
||||
SimpleConditionEvent.violated(
|
||||
item,
|
||||
item.getName()
|
||||
+ " is HTTP transport policy implemented inside application-core"));
|
||||
}
|
||||
item.getFields().stream()
|
||||
.filter(
|
||||
field ->
|
||||
forbiddenFields.contains(field.getName())
|
||||
|| ("status".equals(field.getName())
|
||||
&& item.getPackageName().contains(".fileserver.download")))
|
||||
.forEach(
|
||||
field ->
|
||||
events.add(
|
||||
SimpleConditionEvent.violated(
|
||||
field,
|
||||
item.getName()
|
||||
+ " declares HTTP transport field "
|
||||
+ field.getName()
|
||||
+ "; translate it at the inbound boundary")));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ArchTest
|
||||
static final ArchRule APPLICATION_CALLBACK_TYPES_DO_NOT_OWN_RAW_HTTP_TRANSPORT =
|
||||
classes()
|
||||
.that()
|
||||
.resideInAPackage("dev.caskeleton.application.notification.platform..")
|
||||
.and()
|
||||
.haveSimpleNameContaining("Callback")
|
||||
.should(notDeclareCallbackHttpTransportFields())
|
||||
.as(
|
||||
"provider callback URL, HTTP method, headers and content type stop at the adapter "
|
||||
+ "boundary; application callback types receive only verified semantic data")
|
||||
.allowEmptyShould(true);
|
||||
|
||||
private static ArchCondition<JavaClass> notDeclareCallbackHttpTransportFields() {
|
||||
Set<String> forbidden = Set.of("externalUrl", "httpMethod", "headers", "contentType");
|
||||
return new ArchCondition<>("not declare raw provider-callback HTTP transport fields") {
|
||||
@Override
|
||||
public void check(JavaClass item, ConditionEvents events) {
|
||||
item.getFields().stream()
|
||||
.filter(field -> forbidden.contains(field.getName()))
|
||||
.forEach(
|
||||
field ->
|
||||
events.add(
|
||||
SimpleConditionEvent.violated(
|
||||
field,
|
||||
item.getName()
|
||||
+ " declares transport field "
|
||||
+ field.getName()
|
||||
+ "; raw HTTP belongs to an adapter")));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ArchTest
|
||||
static final ArchRule APPLICATION_METHODS_DO_NOT_ACCEPT_WEB_DTOS =
|
||||
methods()
|
||||
|
||||
+4
@@ -76,8 +76,11 @@ class ArchRuleDiscoveryContractTest {
|
||||
*/
|
||||
private static final List<String> DECLARED_RULES =
|
||||
List.of(
|
||||
"ACTIVE_PROFILES_ARE_READ_ONLY_BY_THE_SNAPSHOT_BRIDGE",
|
||||
"AGGREGATE_ROOT_SETTERS_ARE_NOT_PUBLIC",
|
||||
"APPLICATION_AND_DOMAIN_DO_NOT_DEPEND_ON_SPRING_SECURITY",
|
||||
"APPLICATION_CALLBACK_TYPES_DO_NOT_OWN_RAW_HTTP_TRANSPORT",
|
||||
"APPLICATION_FILESERVER_TYPES_DO_NOT_OWN_HTTP_TRANSPORT",
|
||||
"APPLICATION_DOES_NOT_DEPEND_ON_ADAPTERS_OR_TRANSPORT",
|
||||
"APPLICATION_DOES_NOT_DEPEND_ON_APPLICATION_CONTEXT",
|
||||
"APPLICATION_DOES_NOT_DEPEND_ON_OPTIONAL_ADAPTERS",
|
||||
@@ -99,6 +102,7 @@ class ArchRuleDiscoveryContractTest {
|
||||
"DOMAIN_EVENTS_ARE_TRANSPORT_FREE",
|
||||
"DOMAIN_HAS_NO_LOGGER",
|
||||
"DOMAIN_IS_PURE",
|
||||
"FILESERVER_CONFIGURATIONS_DECLARE_AT_MOST_EIGHT_BEANS",
|
||||
"EXTERNAL_OUTBOUND_CALLS_REQUIRE_EXTERNAL_OUTBOUND_ALLOWED_CAPABILITY",
|
||||
"IDENTIFIER_ADAPTER_DOES_NOT_DEPEND_ON_OTHER_ADAPTERS_OR_BOOTSTRAP",
|
||||
"INBOUND_ADAPTERS_DEPEND_ON_PORTS_NOT_APPLICATION_SERVICES",
|
||||
|
||||
+1
-2
@@ -34,8 +34,7 @@ import org.junit.jupiter.api.Test;
|
||||
*
|
||||
* <p>Without this layer, a rule that silently no-matches in production (e.g. a predicate
|
||||
* referencing a package nothing in the codebase happens to populate) would pass vacuously — exactly
|
||||
* the regression caught in {@code
|
||||
* raw/errors/archunit-test-scope-sample-ticket-inclusion-2026-05-28}.
|
||||
* the regression this violations-as-data fixture layer exists to prevent.
|
||||
*
|
||||
* <p>Pattern reference: Spring Modulith's {@code modules.detectViolations().getMessages()} on an
|
||||
* {@code example/ninvalid} fixture package ({@code
|
||||
|
||||
+2
-14
@@ -2,6 +2,7 @@ package dev.caskeleton.bootstrap.architecture;
|
||||
|
||||
import com.tngtech.archunit.base.DescribedPredicate;
|
||||
import com.tngtech.archunit.core.domain.JavaClass;
|
||||
import dev.caskeleton.adapter.inbound.web.testkit.arch.WebControllerPredicates;
|
||||
|
||||
/**
|
||||
* Predicates and matchers used by more than one of the split architecture suites.
|
||||
@@ -27,20 +28,7 @@ final class CleanArchitectureRuleSupport {
|
||||
* the endpoint an external provider posts to.
|
||||
*/
|
||||
static final DescribedPredicate<JavaClass> ARE_CONTROLLERS =
|
||||
new DescribedPredicate<>("annotated as a Spring controller, or filed as one") {
|
||||
@Override
|
||||
public boolean test(JavaClass candidate) {
|
||||
return candidate.isAnnotatedWith("org.springframework.web.bind.annotation.RestController")
|
||||
|| candidate.isAnnotatedWith("org.springframework.stereotype.Controller")
|
||||
|| candidate.isMetaAnnotatedWith(
|
||||
"org.springframework.web.bind.annotation.RestController")
|
||||
// The package stays in the predicate as well as the annotation. A class filed under
|
||||
// ..controller.. is claiming the role whether or not Spring is currently routing to
|
||||
// it, and dropping the package would narrow a rule this change exists to widen.
|
||||
|| (candidate.getPackageName().contains(".adapter.inbound.web")
|
||||
&& candidate.getPackageName().contains(".controller"));
|
||||
}
|
||||
};
|
||||
WebControllerPredicates.ARE_CONTROLLERS;
|
||||
|
||||
static boolean matches(Object value, String mediaType) {
|
||||
if (value == null) {
|
||||
|
||||
+4
-4
@@ -31,10 +31,10 @@ import com.tngtech.archunit.lang.ArchRule;
|
||||
* composition root is a legitimate participant in rather than a consumer of. Extending the rule
|
||||
* there would forbid the composition root from implementing contracts that exist for it.
|
||||
*
|
||||
* <p>Bootstrap-local interfaces are also outside it. {@code EnvironmentSecretSource} implements
|
||||
* {@code dev.caskeleton.bootstrap.runtime.SecretSource}, a port this leaf declares and owns; a
|
||||
* strategy over a leaf's own interface is not a misplaced adapter, and an earlier reading that
|
||||
* counted it as one was simply wrong about where the interface lived.
|
||||
* <p>Secret resolution now follows the same boundary. {@code SecretSourcePort} is application-owned
|
||||
* and the Spring Environment implementation lives in {@code adapter:outbound:support}; bootstrap
|
||||
* selects that implementation but does not implement the port. The explicit decorator allowlist
|
||||
* below is therefore the only production exception to this rule.
|
||||
*/
|
||||
@AnalyzeClasses(
|
||||
packages = "dev.caskeleton.bootstrap",
|
||||
|
||||
+56
-16
@@ -3,6 +3,8 @@ package dev.caskeleton.bootstrap.architecture;
|
||||
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.methods;
|
||||
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses;
|
||||
|
||||
import com.tngtech.archunit.core.domain.Dependency;
|
||||
import com.tngtech.archunit.core.domain.JavaClass;
|
||||
import com.tngtech.archunit.core.domain.JavaMethod;
|
||||
import com.tngtech.archunit.junit.AnalyzeClasses;
|
||||
import com.tngtech.archunit.junit.ArchTest;
|
||||
@@ -10,13 +12,15 @@ import com.tngtech.archunit.lang.ArchCondition;
|
||||
import com.tngtech.archunit.lang.ArchRule;
|
||||
import com.tngtech.archunit.lang.ConditionEvents;
|
||||
import com.tngtech.archunit.lang.SimpleConditionEvent;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* feature-integration-adapter-templates Layer 2 (D3 / §구현 가이드 §3) — static isolation + gating guard
|
||||
* for the optional integration adapters (Kafka / Redis / Slack / Google Email / Fileserver). Owner:
|
||||
* this branch.
|
||||
*
|
||||
* <p>What this layer statically guarantees, and its documented limit (branch-note L111 / D3 Open
|
||||
* <p>What this layer statically guarantees, and its documented limit (design record L111 / D3 Open
|
||||
* Risk): ArchUnit can prove (1) the application layer never imports an optional adapter package,
|
||||
* and (2) every resource-owning optional-adapter {@code @Bean} is gated by
|
||||
* {@code @ConditionalOnProperty}. Redis's exact resource-free observation and zero-binding registry
|
||||
@@ -33,16 +37,24 @@ import com.tngtech.archunit.lang.SimpleConditionEvent;
|
||||
class DisabledAdapterArchitectureTest {
|
||||
|
||||
private static final String[] OPTIONAL_ADAPTER_PACKAGES = {
|
||||
"..adapter.outbound.messaging.kafka..",
|
||||
"..adapter.outbound.messaging..",
|
||||
"..adapter.outbound.cache.redis..",
|
||||
"..adapter.outbound.notification.slack..",
|
||||
"..adapter.outbound.notification.email..",
|
||||
"..adapter.outbound.fileserver.."
|
||||
"..adapter.outbound.notification..",
|
||||
"..adapter.outbound.fileserver..",
|
||||
"..adapter.outbound.httpclient..",
|
||||
"..adapter.outbound.mongo..",
|
||||
"..adapter.outbound.objectstorage..",
|
||||
"..adapter.outbound.persistence..",
|
||||
"..adapter.inbound.graphql..",
|
||||
"..adapter.inbound.websocket..",
|
||||
"..adapter.inbound.grpc.."
|
||||
};
|
||||
|
||||
private static final String BEAN = "org.springframework.context.annotation.Bean";
|
||||
private static final String CONDITIONAL_ON_PROPERTY =
|
||||
"org.springframework.boot.autoconfigure.condition.ConditionalOnProperty";
|
||||
private static final String CONDITIONAL_ON_PROPERTIES =
|
||||
"org.springframework.boot.autoconfigure.condition.ConditionalOnProperties";
|
||||
|
||||
/**
|
||||
* Layer 2 isolation — the application layer must never import an optional adapter package, so a
|
||||
@@ -58,11 +70,11 @@ class DisabledAdapterArchitectureTest {
|
||||
.dependOnClassesThat()
|
||||
.resideInAnyPackage(OPTIONAL_ADAPTER_PACKAGES)
|
||||
.as(
|
||||
"D3 APPLICATION_DOES_NOT_DEPEND_ON_OPTIONAL_ADAPTERS: the application layer must "
|
||||
+ "not import an optional adapter package "
|
||||
+ "(Kafka/Redis/Slack/Google Email/Fileserver) — "
|
||||
+ "the static half of the disabled-adapter detection. Runtime activity is "
|
||||
+ "delegated to Layer 3 (feature-integration-adapter-templates D3)")
|
||||
"D3 APPLICATION_DOES_NOT_DEPEND_ON_OPTIONAL_ADAPTERS: the application layer must not"
|
||||
+ " import an optional adapter package"
|
||||
+ " (messaging/cache/notification/fileserver/httpclient/persistence/objectstorage/GraphQL/WebSocket/gRPC)"
|
||||
+ " — the static half of the disabled-adapter detection. Runtime activity is"
|
||||
+ " delegated to Layer 3 (feature-integration-adapter-templates D3)")
|
||||
.allowEmptyShould(true);
|
||||
|
||||
/**
|
||||
@@ -82,8 +94,9 @@ class DisabledAdapterArchitectureTest {
|
||||
.should(beGatedByAConditionalOnProperty())
|
||||
.as(
|
||||
"D3 OPTIONAL_ADAPTER_BEANS_ARE_GATED_BY_CONDITIONAL_ON_PROPERTY: every @Bean in an"
|
||||
+ " optional adapter package (Kafka/Redis/Slack/Google Email/Fileserver) must"
|
||||
+ " declare @ConditionalOnProperty(app.<domain>.<adapter>.enabled) — Layer 1"
|
||||
+ " optional adapter package"
|
||||
+ " (messaging/cache/notification/fileserver/httpclient/persistence/objectstorage/GraphQL/WebSocket/gRPC)"
|
||||
+ " must declare @ConditionalOnProperty(app.<domain>.<adapter>.enabled) — Layer 1"
|
||||
+ " disabled-default must not be bypassable by an ungated bean. ArchUnit reaches"
|
||||
+ " the annotation presence only; runtime activation is Layer 3's job"
|
||||
+ " (feature-integration-adapter-templates D3, L111)")
|
||||
@@ -98,14 +111,41 @@ class DisabledAdapterArchitectureTest {
|
||||
* be accidentally left ungated. Requiring the annotation on every method instead would push
|
||||
* adapters towards repeating the switch per bean, which is how the copies drift apart.
|
||||
*/
|
||||
private static boolean isStructurallyGated(JavaClass type, Set<String> visited) {
|
||||
if (!visited.add(type.getName())) {
|
||||
return false;
|
||||
}
|
||||
if (type.isAnnotatedWith(CONDITIONAL_ON_PROPERTY)
|
||||
|| type.isAnnotatedWith(CONDITIONAL_ON_PROPERTIES)) {
|
||||
return true;
|
||||
}
|
||||
if (type.getEnclosingClass()
|
||||
.filter(enclosing -> isStructurallyGated(enclosing, visited))
|
||||
.isPresent()) {
|
||||
return true;
|
||||
}
|
||||
for (Dependency dependency : type.getDirectDependenciesToSelf()) {
|
||||
JavaClass origin = dependency.getOriginClass();
|
||||
if (!origin.getName().startsWith("dev.caskeleton.")) {
|
||||
continue;
|
||||
}
|
||||
if (isStructurallyGated(origin, new HashSet<>(visited))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static ArchCondition<JavaMethod> beGatedByAConditionalOnProperty() {
|
||||
return new ArchCondition<>(
|
||||
"be gated by @ConditionalOnProperty on the method or its declaring configuration class") {
|
||||
"be gated directly or reachable only through a gated production configuration") {
|
||||
@Override
|
||||
public void check(JavaMethod method, ConditionEvents events) {
|
||||
boolean gatedOnMethod = method.isAnnotatedWith(CONDITIONAL_ON_PROPERTY);
|
||||
boolean gatedOnClass = method.getOwner().isAnnotatedWith(CONDITIONAL_ON_PROPERTY);
|
||||
if (gatedOnMethod || gatedOnClass) {
|
||||
boolean gatedOnMethod =
|
||||
method.isAnnotatedWith(CONDITIONAL_ON_PROPERTY)
|
||||
|| method.isAnnotatedWith(CONDITIONAL_ON_PROPERTIES);
|
||||
boolean structurallyGated = isStructurallyGated(method.getOwner(), new HashSet<>());
|
||||
if (gatedOnMethod || structurallyGated) {
|
||||
return;
|
||||
}
|
||||
events.add(
|
||||
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package dev.caskeleton.bootstrap.architecture;
|
||||
|
||||
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes;
|
||||
|
||||
import com.tngtech.archunit.core.domain.JavaClass;
|
||||
import com.tngtech.archunit.core.domain.JavaMethod;
|
||||
import com.tngtech.archunit.junit.AnalyzeClasses;
|
||||
import com.tngtech.archunit.junit.ArchTest;
|
||||
import com.tngtech.archunit.lang.ArchCondition;
|
||||
import com.tngtech.archunit.lang.ArchRule;
|
||||
import com.tngtech.archunit.lang.ConditionEvents;
|
||||
import com.tngtech.archunit.lang.SimpleConditionEvent;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
/** BOOT-007: Fileserver composition stays split by concern instead of regrowing god configs. */
|
||||
@AnalyzeClasses(
|
||||
packages = "dev.caskeleton.bootstrap.autoconfigure.fileserver",
|
||||
importOptions = ProductionClassImportOption.class)
|
||||
class FileserverCompositionArchitectureTest {
|
||||
|
||||
@ArchTest
|
||||
static final ArchRule FILESERVER_CONFIGURATIONS_DECLARE_AT_MOST_EIGHT_BEANS =
|
||||
classes()
|
||||
.that()
|
||||
.resideInAPackage("dev.caskeleton.bootstrap.autoconfigure.fileserver")
|
||||
.should(declareAtMostEightBeanMethods())
|
||||
.as(
|
||||
"BOOT-007: one Fileserver composition class declares at most eight @Bean methods; "
|
||||
+ "larger or mixed port families split into package-private concern configs")
|
||||
.allowEmptyShould(true);
|
||||
|
||||
private static ArchCondition<JavaClass> declareAtMostEightBeanMethods() {
|
||||
return new ArchCondition<>("declare at most eight @Bean methods") {
|
||||
@Override
|
||||
public void check(JavaClass item, ConditionEvents events) {
|
||||
long count =
|
||||
item.getMethods().stream()
|
||||
.filter(FileserverCompositionArchitectureTest::isBeanMethod)
|
||||
.count();
|
||||
if (count > 8) {
|
||||
events.add(
|
||||
SimpleConditionEvent.violated(
|
||||
item, item.getFullName() + " declares " + count + " @Bean methods"));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static boolean isBeanMethod(JavaMethod method) {
|
||||
return method.isAnnotatedWith(Bean.class);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -67,7 +67,7 @@ class ForbiddenApiArchitectureTest {
|
||||
// tenancy.shared package of its own and only began tripping this rule when that leaf
|
||||
// joined the composition root's analysis scope.
|
||||
"dev.caskeleton.adapter.outbound.mongo.advanced.tenancy.shared",
|
||||
// The five master switches and their strict parse. Operational rather than domain:
|
||||
// The registered master switches and their strict parse. Operational rather than domain:
|
||||
// it names environment keys and rejects unreadable values, and it lives here because
|
||||
// the environment post-processor needs it before a Spring context exists, so it must
|
||||
// not depend on Spring.
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package dev.caskeleton.bootstrap.architecture;
|
||||
|
||||
import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses;
|
||||
|
||||
import com.tngtech.archunit.junit.AnalyzeClasses;
|
||||
import com.tngtech.archunit.junit.ArchTest;
|
||||
import com.tngtech.archunit.lang.ArchRule;
|
||||
import dev.caskeleton.bootstrap.runtime.RuntimeProfileSnapshot;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
/** BOOT-002: Spring active-profile extraction has one composition-root owner. */
|
||||
@AnalyzeClasses(
|
||||
packages = "dev.caskeleton.bootstrap",
|
||||
importOptions = ProductionClassImportOption.class)
|
||||
class RuntimeProfileAccessArchitectureTest {
|
||||
|
||||
@ArchTest
|
||||
static final ArchRule ACTIVE_PROFILES_ARE_READ_ONLY_BY_THE_SNAPSHOT_BRIDGE =
|
||||
noClasses()
|
||||
.that()
|
||||
.resideInAPackage("dev.caskeleton.bootstrap..")
|
||||
.and()
|
||||
.doNotHaveFullyQualifiedName(RuntimeProfileSnapshot.class.getName())
|
||||
.should()
|
||||
.callMethod(Environment.class, "getActiveProfiles")
|
||||
.as(
|
||||
"BOOT-002: app-bootstrap production code must read Spring active profiles through "
|
||||
+ "RuntimeProfileSnapshot; RuntimeEnvironment remains the vocabulary/semantics "
|
||||
+ "SSOT and direct Environment#getActiveProfiles calls re-create profile-policy "
|
||||
+ "drift.")
|
||||
.allowEmptyShould(true);
|
||||
}
|
||||
+1
-14
@@ -54,14 +54,6 @@ class StartupFailureContractArchitectureTest {
|
||||
private static final String TRACING_SETTINGS =
|
||||
"dev.caskeleton.bootstrap.autoconfigure.tracing.TracingSettings";
|
||||
|
||||
/**
|
||||
* {@code HttpClientEnvironmentKeys} — an internal invariant. Its unreachable branch says the
|
||||
* environment-variable template cannot express a list nested three deep; no settings record nests
|
||||
* that far, and a deployment cannot cause it.
|
||||
*/
|
||||
private static final String HTTP_CLIENT_ENVIRONMENT_KEYS =
|
||||
"dev.caskeleton.bootstrap.autoconfigure.httpclient.HttpClientEnvironmentKeys";
|
||||
|
||||
/**
|
||||
* {@code RedisKeys} — two JCE invariants ("HmacSHA256 must be available", "a Mac must be
|
||||
* cloneable"). A JVM without HmacSHA256 is not a misconfigured deployment.
|
||||
@@ -103,12 +95,7 @@ class StartupFailureContractArchitectureTest {
|
||||
private static final DescribedPredicate<JavaClass> ALLOWLISTED =
|
||||
new DescribedPredicate<>("allowlisted from the StartupFailures contract") {
|
||||
private final List<String> prefixes =
|
||||
List.of(
|
||||
TRACING_SETTINGS,
|
||||
HTTP_CLIENT_ENVIRONMENT_KEYS,
|
||||
REDIS_KEYS,
|
||||
STARTUP_FAILURES,
|
||||
STARTUP_FAILURE_EXCEPTION);
|
||||
List.of(TRACING_SETTINGS, REDIS_KEYS, STARTUP_FAILURES, STARTUP_FAILURE_EXCEPTION);
|
||||
|
||||
@Override
|
||||
public boolean test(JavaClass candidate) {
|
||||
|
||||
+18
-5
@@ -16,7 +16,7 @@ import org.junit.jupiter.api.Test;
|
||||
* shipped deliberately and is controlled by its master switch. Runtime behavior is proven by the
|
||||
* named compose qualification lanes.
|
||||
*/
|
||||
class ConditionalTransportCompositionContractTest {
|
||||
class ConditionalTransportBuildContractTest {
|
||||
|
||||
/** Transports that must not reach any runtime: no membership, and no composition-root edge. */
|
||||
private static final Map<String, String> BUILD_ONLY_TRANSPORTS =
|
||||
@@ -60,9 +60,22 @@ class ConditionalTransportCompositionContractTest {
|
||||
assertThat(bootstrapBuild).contains("project(':adapter:inbound:graphql')");
|
||||
SWITCH_GATED_TRANSPORTS
|
||||
.values()
|
||||
.forEach(ConditionalTransportCompositionContractTest::assertThatCodeLoads);
|
||||
.forEach(ConditionalTransportBuildContractTest::assertThatCodeLoads);
|
||||
assertThat(shippedApplicationYaml()).contains("classpath:config/graphql.yml");
|
||||
assertThat(shippedGraphQlYaml()).contains("${APP_GRAPHQL_ENABLED:false}");
|
||||
assertThat(shippedGraphQlYaml())
|
||||
.contains("${APP_GRAPHQL_ENABLED:false}")
|
||||
.contains("${APP_GRAPHQL_DEPLOYMENT_MODE:}")
|
||||
.contains("${APP_GRAPHQL_EXECUTION_PROFILE:BLOCKING_MVC}")
|
||||
.contains("${APP_GRAPHQL_VALIDATION_POLICY_VERSION:v1}")
|
||||
.contains("${APP_GRAPHQL_OBSERVED_OPERATION_NAMES:}")
|
||||
.contains("${APP_GRAPHQL_GRAPHIQL_ENABLED:false}")
|
||||
.contains("${APP_GRAPHQL_INTROSPECTION_ENABLED:false}")
|
||||
.contains("${APP_GRAPHQL_MAXIMUM_PAGE_SIZE:100}")
|
||||
.contains("${APP_GRAPHQL_MAXIMUM_COMPLEXITY:10000}")
|
||||
.contains("${APP_GRAPHQL_PREPARSED_CACHE_ENTRIES:1000}")
|
||||
.contains("${APP_GRAPHQL_PREPARSED_CACHE_WEIGHT:10000000}")
|
||||
.contains("${APP_GRAPHQL_PREPARSED_CACHE_EXPIRE_AFTER_ACCESS:30m}")
|
||||
.doesNotContain("APP_GRAPHQL_CURSOR_KEY_IDS");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -74,8 +87,8 @@ class ConditionalTransportCompositionContractTest {
|
||||
|
||||
assertThat(lanes)
|
||||
.as(
|
||||
"a switch-gated transport's real proof is a running application with the switch off and "
|
||||
+ "the route absent; this file is where those lanes are declared, and they are "
|
||||
"a switch-gated transport's real proof is a running application with the switch off and"
|
||||
+ " the route absent; this file is where those lanes are declared, and they are "
|
||||
+ "blocking")
|
||||
.contains("\"off-local\"")
|
||||
.contains("\"off-dev\"")
|
||||
-454
@@ -1,454 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.integration;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatCode;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import dev.caskeleton.adapter.outbound.persistence.lock.DistributedLockPersistenceConfig;
|
||||
import dev.caskeleton.adapter.outbound.persistence.lock.LockRegistryDistributedLockAdapter;
|
||||
import dev.caskeleton.adapter.outbound.persistence.lock.LockSettings;
|
||||
import dev.caskeleton.application.lock.DistributedLock;
|
||||
import dev.caskeleton.application.lock.DistributedLockPort;
|
||||
import dev.caskeleton.application.lock.LockAcquisitionTimeoutException;
|
||||
import dev.caskeleton.bootstrap.autoconfigure.lock.DistributedLockConfig;
|
||||
import dev.caskeleton.bootstrap.autoconfigure.lock.MeteredDistributedLockPort;
|
||||
import io.micrometer.core.instrument.MeterRegistry;
|
||||
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
|
||||
import java.time.Duration;
|
||||
import java.util.ConcurrentModificationException;
|
||||
import java.util.Map;
|
||||
import javax.sql.DataSource;
|
||||
import org.flywaydb.core.Flyway;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.Assumptions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.MapPropertySource;
|
||||
import org.springframework.integration.jdbc.lock.DefaultLockRepository;
|
||||
import org.springframework.integration.jdbc.lock.JdbcLockRegistry;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
import org.testcontainers.DockerClientFactory;
|
||||
import org.testcontainers.postgresql.PostgreSQLContainer;
|
||||
|
||||
/**
|
||||
* Testcontainers contract test for {@code distributedLockProvider} bean wiring and distributed-lock
|
||||
* behavioral guarantees (feature-distributed-lock-contract).
|
||||
*
|
||||
* <h2>Scope</h2>
|
||||
*
|
||||
* <ul>
|
||||
* <li><b>D1 bean presence</b> — with {@code multi-instance-enabled=true}, a bean named {@code
|
||||
* distributedLockProvider} of type {@link DistributedLockPort} must exist; with the flag
|
||||
* false/absent, {@code inProcessDistributedLock} exists and {@code distributedLockProvider}
|
||||
* does NOT.
|
||||
* <li><b>D3 mutual exclusion</b> — two independent lock instances over the same container
|
||||
* DataSource cannot hold the same key simultaneously.
|
||||
* <li><b>D5 lease expiry</b> — after the lease TTL elapses, the second instance can acquire a key
|
||||
* that was held by a crashed first instance.
|
||||
* <li><b>D4 release ordering</b> — {@code close()} on the handle releases the lock so a
|
||||
* subsequent acquire by another instance succeeds.
|
||||
* <li><b>SI-LOCK-C5 lease-expiry close() handling</b> — after the lease TTL expires, (a) the raw
|
||||
* adapter's {@code close()} throws {@link java.util.ConcurrentModificationException}, and (b)
|
||||
* the {@link MeteredDistributedLockPort} absorbs it and increments {@code lock.lease.expired}
|
||||
* without re-throwing.
|
||||
* </ul>
|
||||
*
|
||||
* <p>The whole class is guarded by {@link #assumeDockerAvailable()} so it SKIPs (not fails) in
|
||||
* environments without Docker. The behavioral D3/D5 tests construct two independent {@link
|
||||
* LockRegistryDistributedLockAdapter} instances directly (two {@link DefaultLockRepository} +
|
||||
* {@link JdbcLockRegistry} over the SAME DataSource), simulating two application instances without
|
||||
* Spring context overhead.
|
||||
*
|
||||
* <p>Note on compile classpath: {@code spring-integration-jdbc} is an {@code implementation} dep of
|
||||
* {@code adapter-persistence}. Since the D3/D5 tests need to construct SI objects directly, {@code
|
||||
* spring-integration-jdbc} is added as {@code testImplementation} in {@code
|
||||
* app-bootstrap/build.gradle}.
|
||||
*/
|
||||
class DistributedLockProviderContractTest {
|
||||
|
||||
static final String PG_IMAGE = "postgres:16-alpine";
|
||||
|
||||
// Shared container — started once for all tests in this class.
|
||||
static PostgreSQLContainer pg;
|
||||
static HikariDataSource sharedDataSource;
|
||||
|
||||
@BeforeAll
|
||||
static void startContainer() {
|
||||
assumeDockerAvailable();
|
||||
pg = PostgreSqlTestContainer.create(PG_IMAGE);
|
||||
pg.start();
|
||||
|
||||
sharedDataSource = hikari(pg);
|
||||
|
||||
// Flyway migrates V1 (idempotency), V2 (legacy work_log migration on
|
||||
// app-bootstrap test classpath), V3 (outbox), V4 (INT_LOCK).
|
||||
Flyway.configure()
|
||||
.dataSource(sharedDataSource)
|
||||
.locations("classpath:db/migration/postgresql")
|
||||
.load()
|
||||
.migrate();
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
static void stopContainer() {
|
||||
if (sharedDataSource != null) {
|
||||
sharedDataSource.close();
|
||||
}
|
||||
if (pg != null) {
|
||||
pg.stop();
|
||||
}
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
// D1 — bean presence: multi-instance=true provides distributedLockProvider
|
||||
// ======================================================================
|
||||
|
||||
@Test
|
||||
void d1MultiInstanceTrueProvidesDistributedLockProviderBean() {
|
||||
try (AnnotationConfigApplicationContext ctx = buildContext(true)) {
|
||||
assertThat(ctx.containsBean("distributedLockProvider"))
|
||||
.as("distributedLockProvider bean must exist when multi-instance-enabled=true (D1)")
|
||||
.isTrue();
|
||||
assertThat(ctx.getBean("distributedLockProvider"))
|
||||
.as("distributedLockProvider must implement DistributedLockPort")
|
||||
.isInstanceOf(DistributedLockPort.class);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void d1MultiInstanceFalseProvidesInProcessDistributedLockNotDistributedLockProvider() {
|
||||
try (AnnotationConfigApplicationContext ctx = buildContext(false)) {
|
||||
assertThat(ctx.containsBean("inProcessDistributedLock"))
|
||||
.as("inProcessDistributedLock bean must exist when multi-instance-enabled=false")
|
||||
.isTrue();
|
||||
assertThat(ctx.containsBean("distributedLockProvider"))
|
||||
.as(
|
||||
"distributedLockProvider must NOT exist when multi-instance-enabled=false (in-process default)")
|
||||
.isFalse();
|
||||
}
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
// D3 — mutual exclusion: two independent adapters over the same DataSource
|
||||
// ======================================================================
|
||||
|
||||
@Test
|
||||
void d3MutualExclusionSecondAcquireOnSameKeyThrowsTimeout() throws Exception {
|
||||
// Two independent DefaultLockRepository + JdbcLockRegistry instances over the
|
||||
// same DataSource simulate two application instances.
|
||||
Duration ttl = Duration.ofSeconds(30);
|
||||
DefaultLockRepository repoA = buildRepository(sharedDataSource);
|
||||
DefaultLockRepository repoB = buildRepository(sharedDataSource);
|
||||
try {
|
||||
LockRegistryDistributedLockAdapter adapterA =
|
||||
new LockRegistryDistributedLockAdapter(new JdbcLockRegistry(repoA, ttl), ttl);
|
||||
LockRegistryDistributedLockAdapter adapterB =
|
||||
new LockRegistryDistributedLockAdapter(new JdbcLockRegistry(repoB, ttl), ttl);
|
||||
|
||||
String key = "d3-mutual-exclusion-" + System.nanoTime();
|
||||
Duration shortWait = Duration.ofMillis(100);
|
||||
|
||||
// A acquires.
|
||||
DistributedLock lockA = adapterA.tryAcquire(key, Duration.ofSeconds(1), ttl);
|
||||
try {
|
||||
// B must time out while A holds the lock.
|
||||
assertThatThrownBy(() -> adapterB.tryAcquire(key, shortWait, ttl))
|
||||
.as("D3: second instance must not acquire key held by first instance")
|
||||
.isInstanceOf(LockAcquisitionTimeoutException.class);
|
||||
} finally {
|
||||
lockA.close();
|
||||
}
|
||||
|
||||
// D4 release ordering: after A releases, B can acquire.
|
||||
DistributedLock lockB = adapterB.tryAcquire(key, Duration.ofSeconds(1), ttl);
|
||||
assertThat(lockB)
|
||||
.as("D4: after close(), another instance must be able to acquire the key")
|
||||
.isNotNull();
|
||||
lockB.close();
|
||||
} finally {
|
||||
repoA.stop();
|
||||
repoB.stop();
|
||||
}
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
// D5 — lease expiry: expired row is reclaimed by another instance
|
||||
// ======================================================================
|
||||
|
||||
@Test
|
||||
void d5LeaseExpiryAllowsSecondInstanceToAcquireAfterTtl() throws Exception {
|
||||
// Short TTL (1 s) so the lease expires quickly.
|
||||
Duration shortTtl = Duration.ofSeconds(1);
|
||||
DefaultLockRepository repoA = buildRepository(sharedDataSource);
|
||||
DefaultLockRepository repoB = buildRepository(sharedDataSource);
|
||||
try {
|
||||
LockRegistryDistributedLockAdapter adapterA =
|
||||
new LockRegistryDistributedLockAdapter(new JdbcLockRegistry(repoA, shortTtl), shortTtl);
|
||||
LockRegistryDistributedLockAdapter adapterB =
|
||||
new LockRegistryDistributedLockAdapter(new JdbcLockRegistry(repoB, shortTtl), shortTtl);
|
||||
|
||||
String key = "d5-lease-expiry-" + System.nanoTime();
|
||||
|
||||
// A acquires and does NOT release (simulating a crash — intentional discard).
|
||||
@SuppressWarnings("unused")
|
||||
DistributedLock crashedLockA = adapterA.tryAcquire(key, Duration.ofSeconds(1), shortTtl);
|
||||
// crashedLockA is intentionally not closed — simulates a JVM crash that never
|
||||
// calls close(). The TTL is the only mechanism that frees the row.
|
||||
|
||||
// Sleep past the TTL boundary so the lease has elapsed.
|
||||
Thread.sleep(shortTtl.toMillis() + 500);
|
||||
|
||||
// Bounded poll: try to acquire B until success or the bound is hit.
|
||||
// Polls up to shortTtl × 4 total, in 200 ms increments, to avoid a single
|
||||
// post-sleep attempt that is fragile under slow CI environments.
|
||||
Duration pollBound = shortTtl.multipliedBy(4);
|
||||
long pollDeadline = System.currentTimeMillis() + pollBound.toMillis();
|
||||
DistributedLock lockB = null;
|
||||
LockAcquisitionTimeoutException lastTimeout = null;
|
||||
while (lockB == null && System.currentTimeMillis() < pollDeadline) {
|
||||
try {
|
||||
lockB = adapterB.tryAcquire(key, Duration.ofMillis(200), shortTtl);
|
||||
} catch (LockAcquisitionTimeoutException e) {
|
||||
lastTimeout = e;
|
||||
Thread.sleep(100);
|
||||
}
|
||||
}
|
||||
if (lockB == null) {
|
||||
throw new AssertionError(
|
||||
"D5: adapterB could not acquire key '"
|
||||
+ key
|
||||
+ "' within "
|
||||
+ pollBound
|
||||
+ " after TTL expiry",
|
||||
lastTimeout);
|
||||
}
|
||||
lockB.close();
|
||||
} finally {
|
||||
repoA.stop();
|
||||
repoB.stop();
|
||||
}
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
// SI-LOCK-C5 — lease-expiry close() handling
|
||||
// ======================================================================
|
||||
|
||||
/**
|
||||
* (a) Documents the raw SI behavior: after TTL expires, the raw adapter handle's {@code close()}
|
||||
* throws {@link java.util.ConcurrentModificationException} because the INT_LOCK row was
|
||||
* reclaimed.
|
||||
*
|
||||
* <p>This test <em>intentionally</em> verifies the exception the decorator must absorb
|
||||
* (branch-note §Edge / SI-LOCK-C5).
|
||||
*/
|
||||
@Test
|
||||
void siLockC5RawAdapterCloseThrowsCMEAfterLeaseExpires() throws Exception {
|
||||
Duration shortTtl = Duration.ofSeconds(1);
|
||||
DefaultLockRepository repoA = buildRepository(sharedDataSource);
|
||||
try {
|
||||
LockRegistryDistributedLockAdapter adapterA =
|
||||
new LockRegistryDistributedLockAdapter(new JdbcLockRegistry(repoA, shortTtl), shortTtl);
|
||||
|
||||
String key = "c5-raw-cme-" + System.nanoTime();
|
||||
DistributedLock handle = adapterA.tryAcquire(key, Duration.ofSeconds(1), shortTtl);
|
||||
|
||||
// Let the lease expire — another instance can reclaim the row.
|
||||
Thread.sleep(shortTtl.toMillis() + 500);
|
||||
|
||||
// Acquire from a second adapter to reclaim the row (makes CME deterministic).
|
||||
DefaultLockRepository repoB = buildRepository(sharedDataSource);
|
||||
try {
|
||||
LockRegistryDistributedLockAdapter adapterB =
|
||||
new LockRegistryDistributedLockAdapter(new JdbcLockRegistry(repoB, shortTtl), shortTtl);
|
||||
// Intentional discard — we only need B to reclaim the row, not track the handle.
|
||||
@SuppressWarnings("unused")
|
||||
DistributedLock reclaimHandle = adapterB.tryAcquire(key, Duration.ofSeconds(2), shortTtl);
|
||||
} finally {
|
||||
repoB.stop();
|
||||
}
|
||||
|
||||
// Now closing A's handle should throw CME (row was reclaimed by B).
|
||||
assertThatThrownBy(handle::close)
|
||||
.as(
|
||||
"SI-LOCK-C5: raw adapter close() must throw ConcurrentModificationException "
|
||||
+ "when the lease expired and the row was reclaimed")
|
||||
.isInstanceOf(ConcurrentModificationException.class);
|
||||
} finally {
|
||||
repoA.stop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* (b) Verifies the {@link MeteredDistributedLockPort} absorbs the {@link
|
||||
* java.util.ConcurrentModificationException} from lease expiry: the metered handle's {@code
|
||||
* close()} does NOT throw, and the {@code lock.lease.expired} counter increments by 1.
|
||||
*/
|
||||
@Test
|
||||
void siLockC5MeteredPortSwallowsCMEAndIncrementsLeaseExpiredCounter() throws Exception {
|
||||
Duration shortTtl = Duration.ofSeconds(1);
|
||||
DefaultLockRepository repoA = buildRepository(sharedDataSource);
|
||||
|
||||
SimpleMeterRegistry meterRegistry = new SimpleMeterRegistry();
|
||||
LockRegistryDistributedLockAdapter rawAdapter =
|
||||
new LockRegistryDistributedLockAdapter(new JdbcLockRegistry(repoA, shortTtl), shortTtl);
|
||||
MeteredDistributedLockPort meteredPort =
|
||||
new MeteredDistributedLockPort(rawAdapter, providerOf(meterRegistry));
|
||||
|
||||
try {
|
||||
String key = "c5-metered-" + System.nanoTime();
|
||||
DistributedLock handle = meteredPort.tryAcquire(key, Duration.ofSeconds(1), shortTtl);
|
||||
|
||||
// Let the lease expire.
|
||||
Thread.sleep(shortTtl.toMillis() + 500);
|
||||
|
||||
// Acquire from a second adapter to reclaim the row (makes CME deterministic).
|
||||
DefaultLockRepository repoB = buildRepository(sharedDataSource);
|
||||
try {
|
||||
LockRegistryDistributedLockAdapter adapterB =
|
||||
new LockRegistryDistributedLockAdapter(new JdbcLockRegistry(repoB, shortTtl), shortTtl);
|
||||
// Intentional discard — only need to reclaim the row.
|
||||
@SuppressWarnings("unused")
|
||||
DistributedLock reclaimHandle = adapterB.tryAcquire(key, Duration.ofSeconds(2), shortTtl);
|
||||
} finally {
|
||||
repoB.stop();
|
||||
}
|
||||
|
||||
// The metered handle must NOT throw (SI-LOCK-C5 — 정상 흐름 복귀).
|
||||
assertThatCode(handle::close)
|
||||
.as("SI-LOCK-C5: MeteredDistributedLockPort.close() must not throw when lease expired")
|
||||
.doesNotThrowAnyException();
|
||||
|
||||
// The lease-expired counter must have incremented.
|
||||
// Use the literal "lock.lease.expired" (metrics.yaml §Distributed lock) — the constant
|
||||
// is package-private in MeteredDistributedLockPort; the pinning test in
|
||||
// MeteredDistributedLockPortTest.lock_lease_expired_constant_matches_registry_name()
|
||||
// ensures the constant value stays in sync with this literal.
|
||||
assertThat(meterRegistry.get("lock.lease.expired").counter().count())
|
||||
.as("lock.lease.expired counter must be 1 after one CME on close()")
|
||||
.isEqualTo(1.0);
|
||||
} finally {
|
||||
repoA.stop();
|
||||
}
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
// helpers
|
||||
// ======================================================================
|
||||
|
||||
private static void assumeDockerAvailable() {
|
||||
Assumptions.assumeTrue(
|
||||
DockerClientFactory.instance().isDockerAvailable(),
|
||||
"Docker not available — skipping Testcontainers-based distributed lock contract test");
|
||||
}
|
||||
|
||||
private static HikariDataSource hikari(PostgreSQLContainer pg) {
|
||||
HikariConfig config = new HikariConfig();
|
||||
config.setJdbcUrl(pg.getJdbcUrl());
|
||||
config.setUsername(pg.getUsername());
|
||||
config.setPassword(pg.getPassword());
|
||||
config.setMaximumPoolSize(10);
|
||||
config.setMinimumIdle(2);
|
||||
return new HikariDataSource(config);
|
||||
}
|
||||
|
||||
private static DefaultLockRepository buildRepository(DataSource dataSource) {
|
||||
DefaultLockRepository repo = new DefaultLockRepository(dataSource);
|
||||
// INT_LOCK is provisioned by Flyway V4 — skip the DDL check.
|
||||
repo.setCheckDatabaseOnStart(false);
|
||||
// DefaultLockRepository implements InitializingBean (afterPropertiesSet) AND
|
||||
// SmartInitializingSingleton (afterSingletonsInstantiated). The transaction templates
|
||||
// (readCommittedTransactionTemplate etc.) are built in afterSingletonsInstantiated —
|
||||
// that lifecycle callback fires automatically in a Spring context but must be invoked
|
||||
// explicitly when constructing outside one. We set the transaction manager first so
|
||||
// afterSingletonsInstantiated can wire it without needing an ApplicationContext.
|
||||
repo.setTransactionManager(new DataSourceTransactionManager(dataSource));
|
||||
repo.afterPropertiesSet();
|
||||
repo.afterSingletonsInstantiated();
|
||||
repo.start();
|
||||
return repo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a minimal Spring context with {@link DistributedLockPersistenceConfig}, {@link
|
||||
* DistributedLockConfig}, {@link LockSettings}, the Testcontainers DataSource, and a {@link
|
||||
* DataSourceTransactionManager}.
|
||||
*
|
||||
* <p>The DataSource lifecycle is owned by the test ({@code sharedDataSource}); the context's
|
||||
* destroy method is suppressed for the DataSource bean.
|
||||
*/
|
||||
private static AnnotationConfigApplicationContext buildContext(boolean multiInstanceEnabled) {
|
||||
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
|
||||
|
||||
// Register DataSource (no destroy — owned by the test).
|
||||
ctx.registerBean(
|
||||
"dataSource", DataSource.class, () -> sharedDataSource, bd -> bd.setDestroyMethodName(""));
|
||||
|
||||
// PlatformTransactionManager (required by DefaultLockRepository).
|
||||
ctx.registerBean(
|
||||
"transactionManager",
|
||||
DataSourceTransactionManager.class,
|
||||
() -> new DataSourceTransactionManager(sharedDataSource));
|
||||
|
||||
// LockSettings: default values (3s wait, 30s TTL).
|
||||
ctx.register(LockSettingsPropertiesConfig.class);
|
||||
|
||||
// adapter-persistence config (creates inProcessDistributedLock or jdbcDistributedLock).
|
||||
ctx.register(DistributedLockPersistenceConfig.class);
|
||||
|
||||
// app-bootstrap config (creates distributedLockProvider when multi-instance=true).
|
||||
ctx.register(DistributedLockConfig.class);
|
||||
|
||||
// Set the multi-instance flag.
|
||||
ctx.getEnvironment()
|
||||
.getPropertySources()
|
||||
.addFirst(
|
||||
new MapPropertySource(
|
||||
"test-props",
|
||||
Map.of(
|
||||
"ca-skeleton.runtime.multi-instance-enabled",
|
||||
String.valueOf(multiInstanceEnabled))));
|
||||
|
||||
ctx.refresh();
|
||||
return ctx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a real Spring {@link ObjectProvider}; a null registry yields the no-op (absent) case.
|
||||
*/
|
||||
private static ObjectProvider<MeterRegistry> providerOf(MeterRegistry registry) {
|
||||
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
|
||||
if (registry != null) {
|
||||
beanFactory.registerSingleton("meterRegistry", registry);
|
||||
}
|
||||
return beanFactory.getBeanProvider(MeterRegistry.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimal @Configuration that enables LockSettings binding. {@code LockSettings} uses default
|
||||
* values when no ca-skeleton.lock.* properties are bound, so no explicit property values are
|
||||
* needed.
|
||||
*/
|
||||
@Configuration
|
||||
@EnableConfigurationProperties(LockSettings.class)
|
||||
static class LockSettingsPropertiesConfig {
|
||||
|
||||
/**
|
||||
* Provide an empty {@link MeterRegistry} provider so {@link MeteredDistributedLockPort}
|
||||
* resolves to a no-op (Micrometer is on compile classpath but no registry bean is wired in this
|
||||
* minimal context).
|
||||
*/
|
||||
@Bean
|
||||
ObjectProvider<MeterRegistry> meterRegistryProvider() {
|
||||
DefaultListableBeanFactory empty = new DefaultListableBeanFactory();
|
||||
return empty.getBeanProvider(MeterRegistry.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
-131
@@ -1,131 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.integration;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import javax.sql.DataSource;
|
||||
import org.flywaydb.core.Flyway;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.Assumptions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
import org.testcontainers.DockerClientFactory;
|
||||
import org.testcontainers.postgresql.PostgreSQLContainer;
|
||||
|
||||
/**
|
||||
* Migration compatibility contracts for already-applied PostgreSQL development schemas.
|
||||
*
|
||||
* <p>This class guards against mutating an applied Flyway version in place. The startup migrator
|
||||
* validates checksums before serving traffic, so an edited versioned migration fails existing
|
||||
* databases even when a fresh Testcontainers database still passes.
|
||||
*/
|
||||
class FlywayMigrationCompatibilityContractTest {
|
||||
|
||||
private static final String OLD_V4_INT_LOCK =
|
||||
"""
|
||||
-- feature-distributed-lock-contract — Spring Integration JDBC LockRegistry backing table.
|
||||
-- DDL is the SI 6.5 PostgreSQL schema verbatim; provenance and TTL notes in module README.
|
||||
|
||||
CREATE TABLE INT_LOCK (
|
||||
LOCK_KEY CHAR(36) NOT NULL,
|
||||
REGION VARCHAR(100) NOT NULL,
|
||||
CLIENT_ID CHAR(36),
|
||||
CREATED_DATE TIMESTAMP NOT NULL,
|
||||
constraint INT_LOCK_PK primary key (LOCK_KEY, REGION)
|
||||
);
|
||||
""";
|
||||
|
||||
private static PostgreSQLContainer pg;
|
||||
private static HikariDataSource dataSource;
|
||||
|
||||
@AfterAll
|
||||
static void stopContainer() {
|
||||
if (dataSource != null) {
|
||||
dataSource.close();
|
||||
}
|
||||
if (pg != null) {
|
||||
pg.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void existingDatabaseWithOriginalV4MigratesForwardToExpiredAfterColumn(@TempDir Path tempDir)
|
||||
throws Exception {
|
||||
assumeDockerAvailable();
|
||||
startContainer();
|
||||
|
||||
Path oldLocation = migrationLocation(tempDir.resolve("old"), OLD_V4_INT_LOCK, null);
|
||||
Flyway.configure().dataSource(dataSource).locations(flywayPath(oldLocation)).load().migrate();
|
||||
|
||||
Path currentLocation =
|
||||
migrationLocation(
|
||||
tempDir.resolve("current"),
|
||||
resourceText("/db/migration/postgresql/V4__int_lock.sql"),
|
||||
resourceText("/db/migration/postgresql/V5__int_lock_expired_after.sql"));
|
||||
Flyway.configure()
|
||||
.dataSource(dataSource)
|
||||
.locations(flywayPath(currentLocation))
|
||||
.load()
|
||||
.migrate();
|
||||
|
||||
assertThat(hasExpiredAfterColumn(dataSource)).isTrue();
|
||||
}
|
||||
|
||||
private static void assumeDockerAvailable() {
|
||||
Assumptions.assumeTrue(
|
||||
DockerClientFactory.instance().isDockerAvailable(),
|
||||
"Docker not available — skipping Testcontainers-based migration compatibility test");
|
||||
}
|
||||
|
||||
private static void startContainer() {
|
||||
if (pg != null) {
|
||||
return;
|
||||
}
|
||||
pg = PostgreSqlTestContainer.create();
|
||||
pg.start();
|
||||
|
||||
HikariConfig config = new HikariConfig();
|
||||
config.setJdbcUrl(pg.getJdbcUrl());
|
||||
config.setUsername(pg.getUsername());
|
||||
config.setPassword(pg.getPassword());
|
||||
dataSource = new HikariDataSource(config);
|
||||
}
|
||||
|
||||
private static Path migrationLocation(Path directory, String v4, String v5) throws IOException {
|
||||
Files.createDirectories(directory);
|
||||
Files.writeString(directory.resolve("V4__int_lock.sql"), v4, StandardCharsets.UTF_8);
|
||||
if (v5 != null) {
|
||||
Files.writeString(
|
||||
directory.resolve("V5__int_lock_expired_after.sql"), v5, StandardCharsets.UTF_8);
|
||||
}
|
||||
return directory;
|
||||
}
|
||||
|
||||
private static String resourceText(String path) throws IOException {
|
||||
try (InputStream stream =
|
||||
FlywayMigrationCompatibilityContractTest.class.getResourceAsStream(path)) {
|
||||
assertThat(stream).as("migration resource %s", path).isNotNull();
|
||||
return new String(stream.readAllBytes(), StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
|
||||
private static String flywayPath(Path path) {
|
||||
return "filesystem:" + path.toAbsolutePath();
|
||||
}
|
||||
|
||||
private static boolean hasExpiredAfterColumn(DataSource dataSource) throws SQLException {
|
||||
try (var connection = dataSource.getConnection();
|
||||
ResultSet columns =
|
||||
connection.getMetaData().getColumns(null, null, "int_lock", "expired_after")) {
|
||||
return columns.next();
|
||||
}
|
||||
}
|
||||
}
|
||||
-223
@@ -1,223 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.integration;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import dev.caskeleton.adapter.outbound.persistence.failure.PersistenceExceptionTranslator;
|
||||
import dev.caskeleton.adapter.outbound.persistence.failure.StandardSqlStateErrorMapping;
|
||||
import dev.caskeleton.adapter.outbound.persistence.postgresql.PostgreSqlSqlStateErrorMapping;
|
||||
import dev.caskeleton.shared.error.OperationalError;
|
||||
import dev.caskeleton.shared.error.PersistenceFailureException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import javax.sql.DataSource;
|
||||
import org.flywaydb.core.Flyway;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.Assumptions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.testcontainers.DockerClientFactory;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
import org.testcontainers.postgresql.PostgreSQLContainer;
|
||||
|
||||
/**
|
||||
* PostgreSQL contract test that pins the DDL → unique-scope → SQLState → error-code chain for
|
||||
* {@code idempotency_record} (feature-persistence-multi-db-extensibility, commit E).
|
||||
*
|
||||
* <h2>Coverage gap this test fills</h2>
|
||||
*
|
||||
* <ul>
|
||||
* <li>Outbox claim and distributed lock are already verified by real-PostgreSQL Testcontainers
|
||||
* tests (OutboxRowLifecycleContractTest, OutboxPublisherLeaderElectionContractTest,
|
||||
* OutboxAppendTransactionalContractTest, DistributedLockProviderContractTest).
|
||||
* <li>This test fills the remaining gap: the {@code uq_idempotency_scope} unique constraint
|
||||
* (columns: {@code tenant, principal, idempotency_key, use_case_name}, defined in {@code
|
||||
* V1__idempotency_record.sql}) is exercised against a real PostgreSQL instance so that a
|
||||
* duplicate insert provably produces SQLState {@code 23505}, and the production {@link
|
||||
* PersistenceExceptionTranslator} chain maps it to {@link
|
||||
* OperationalError#DB_UNIQUE_VIOLATION}.
|
||||
* </ul>
|
||||
*
|
||||
* <h2>Scope (non-speculative)</h2>
|
||||
*
|
||||
* This test verifies the PostgreSQL vendor's actual behaviour — it is not a shared-fixture
|
||||
* abstraction. A DB-neutral shared fixture would require a second RDBMS vendor on the test
|
||||
* classpath to have any validation value; that is deferred until a second vendor is added (C-1:
|
||||
* avoid paying the abstraction cost before the validator exists).
|
||||
*
|
||||
* <h2>Translator composition</h2>
|
||||
*
|
||||
* The {@link PersistenceExceptionTranslator} is constructed with {@code List.of(new
|
||||
* StandardSqlStateErrorMapping(), new PostgreSqlSqlStateErrorMapping())} — the same composition
|
||||
* used at production runtime and mirrored in {@link
|
||||
* dev.caskeleton.bootstrap.contract.PersistenceFailureMappingContractTest}. This exercises the "DDL
|
||||
* unique constraint → PG SQLState 23505 → DB_UNIQUE_VIOLATION" end-to-end chain with a real
|
||||
* PostgreSQL error.
|
||||
*/
|
||||
@Testcontainers
|
||||
class IdempotencyUniqueScopeContractTest {
|
||||
|
||||
@Container static final PostgreSQLContainer PG = PostgreSqlTestContainer.create();
|
||||
|
||||
private static HikariDataSource sharedDataSource;
|
||||
|
||||
/**
|
||||
* Production TRANSLATOR composition: standard core rows + PostgreSQL vendor rows. Mirrors the
|
||||
* composition used in {@link
|
||||
* dev.caskeleton.bootstrap.contract.PersistenceFailureMappingContractTest}.
|
||||
*/
|
||||
private static final PersistenceExceptionTranslator TRANSLATOR =
|
||||
new PersistenceExceptionTranslator(
|
||||
List.of(new StandardSqlStateErrorMapping(), new PostgreSqlSqlStateErrorMapping()));
|
||||
|
||||
@BeforeAll
|
||||
static void setup() {
|
||||
Assumptions.assumeTrue(
|
||||
DockerClientFactory.instance().isDockerAvailable(),
|
||||
"Docker not available — skipping Testcontainers-based idempotency unique-scope contract test");
|
||||
|
||||
sharedDataSource = hikari(PG);
|
||||
|
||||
// V1 (idempotency_record) + V2 (sample work_log) + V3 (outbox_event) + V4 (int_lock)
|
||||
// are all under classpath:db/migration (from adapter:outbound:persistence-jpa on the test
|
||||
// classpath via implementation project(':adapter:outbound:persistence-jpa')).
|
||||
Flyway.configure()
|
||||
.dataSource(sharedDataSource)
|
||||
.locations("classpath:db/migration/postgresql")
|
||||
.load()
|
||||
.migrate();
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
static void teardown() {
|
||||
if (sharedDataSource != null) {
|
||||
sharedDataSource.close();
|
||||
}
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// Contract 1 — DDL unique constraint fires as SQLState 23505
|
||||
// =========================================================================
|
||||
|
||||
/**
|
||||
* Inserting a second row with the same (tenant, principal, idempotency_key, use_case_name) scope
|
||||
* must cause PostgreSQL to report SQLState {@code 23505} (unique_violation). This pins the DDL
|
||||
* side of the "DDL → SQLState → error-code" chain.
|
||||
*
|
||||
* <p>The insert uses plain JDBC so the {@link SQLException} is observed directly, without any ORM
|
||||
* exception-translation layer in between. This keeps the contract readable and avoids sensitivity
|
||||
* to Hibernate's own exception-wrapping behaviour.
|
||||
*/
|
||||
@Test
|
||||
void duplicateScopeInsertProducesSqlstate23505() throws Exception {
|
||||
String nonce = uniqueNonce();
|
||||
insertRow(sharedDataSource, nonce); // first row — must succeed
|
||||
|
||||
SQLException caught = null;
|
||||
try {
|
||||
insertRow(sharedDataSource, nonce); // duplicate scope — must fail
|
||||
} catch (SQLException ex) {
|
||||
caught = ex;
|
||||
}
|
||||
|
||||
assertThat((Throwable) caught).as("duplicate scope insert must throw SQLException").isNotNull();
|
||||
assertThat(caught.getSQLState())
|
||||
.as("SQLState must be 23505 (PostgreSQL unique_violation)")
|
||||
.isEqualTo("23505");
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// Contract 2 — DDL 23505 → DB_UNIQUE_VIOLATION (full chain)
|
||||
// =========================================================================
|
||||
|
||||
/**
|
||||
* A {@link DataIntegrityViolationException} wrapping a {@link SQLException} with SQLState {@code
|
||||
* 23505} (as Spring Data JPA produces at the repository boundary in production) must classify to
|
||||
* {@link OperationalError#DB_UNIQUE_VIOLATION} via the production {@link
|
||||
* PersistenceExceptionTranslator}. This pins the complete "DDL unique constraint → PG SQLState
|
||||
* 23505 → DB_UNIQUE_VIOLATION" chain.
|
||||
*
|
||||
* <p>The {@link SQLException} is obtained from a real PostgreSQL duplicate-insert so the SQLState
|
||||
* comes from the actual driver, not a fabricated fixture.
|
||||
*/
|
||||
@Test
|
||||
void duplicateScopeClassifiesToDbUniqueViolation() throws Exception {
|
||||
String nonce = uniqueNonce();
|
||||
insertRow(sharedDataSource, nonce); // first row
|
||||
|
||||
SQLException pgEx = null;
|
||||
try {
|
||||
insertRow(sharedDataSource, nonce); // duplicate — harvests the real PG exception
|
||||
} catch (SQLException ex) {
|
||||
pgEx = ex;
|
||||
}
|
||||
|
||||
assertThat((Throwable) pgEx)
|
||||
.as("duplicate insert must throw a real PostgreSQL SQLException")
|
||||
.isNotNull();
|
||||
assertThat(pgEx.getSQLState()).as("real PG SQLState must be 23505").isEqualTo("23505");
|
||||
|
||||
// Wrap it the same way Spring Data JPA does at the repository boundary.
|
||||
DataIntegrityViolationException springWrapped =
|
||||
new DataIntegrityViolationException("unique constraint violation", pgEx);
|
||||
|
||||
Optional<PersistenceFailureException> result = TRANSLATOR.translate(springWrapped);
|
||||
assertThat(result)
|
||||
.as("TRANSLATOR must classify the wrapped 23505 to a PersistenceFailureException")
|
||||
.isPresent();
|
||||
assertThat(result.get().errorCode())
|
||||
.as(
|
||||
"SQLState 23505 from idempotency_record unique scope must classify to DB_UNIQUE_VIOLATION")
|
||||
.isEqualTo(OperationalError.DB_UNIQUE_VIOLATION);
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// helpers
|
||||
// =========================================================================
|
||||
|
||||
/** Returns a unique nonce so each test method gets its own scope bucket. */
|
||||
private static String uniqueNonce() {
|
||||
return String.valueOf(System.nanoTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts one {@code idempotency_record} row via plain JDBC. The scope columns ({@code tenant},
|
||||
* {@code principal}, {@code idempotency_key}, {@code use_case_name}) are keyed to {@code nonce}.
|
||||
* The PK ({@code id}) is always a fresh UUID so only the unique scope constraint, not the PK, can
|
||||
* fire on a duplicate call.
|
||||
*
|
||||
* @throws SQLException propagated directly so the test can inspect the SQLState
|
||||
*/
|
||||
private static void insertRow(DataSource ds, String nonce) throws SQLException {
|
||||
String sql =
|
||||
"INSERT INTO idempotency_record "
|
||||
+ "(id, tenant, principal, idempotency_key, use_case_name, "
|
||||
+ " request_hash, status, created_at, expires_at) "
|
||||
+ "VALUES (?, '', ?, ?, 'TestUseCase', ?, 'PENDING', now(), now() + interval '1 hour')";
|
||||
try (Connection conn = ds.getConnection();
|
||||
PreparedStatement ps = conn.prepareStatement(sql)) {
|
||||
ps.setObject(1, UUID.randomUUID());
|
||||
ps.setString(2, "test-principal-" + nonce);
|
||||
ps.setString(3, "test-key-" + nonce);
|
||||
ps.setString(4, "a".repeat(64));
|
||||
ps.executeUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
private static HikariDataSource hikari(PostgreSQLContainer pg) {
|
||||
HikariConfig cfg = new HikariConfig();
|
||||
cfg.setJdbcUrl(pg.getJdbcUrl());
|
||||
cfg.setUsername(pg.getUsername());
|
||||
cfg.setPassword(pg.getPassword());
|
||||
cfg.setMaximumPoolSize(5);
|
||||
cfg.setMinimumIdle(1);
|
||||
return new HikariDataSource(cfg);
|
||||
}
|
||||
}
|
||||
+6
-68
@@ -2,7 +2,6 @@ package dev.caskeleton.bootstrap.integration.fileserver;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.head;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
|
||||
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.mapper.RawUploadRequestMapper;
|
||||
@@ -33,7 +32,6 @@ import java.util.stream.Stream;
|
||||
import org.flywaydb.core.Flyway;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.EnabledIf;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.SpringBootConfiguration;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
@@ -51,7 +49,6 @@ import org.springframework.test.context.DynamicPropertySource;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.MvcResult;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.testcontainers.DockerClientFactory;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
import org.testcontainers.postgresql.PostgreSQLContainer;
|
||||
@@ -59,7 +56,7 @@ import tools.jackson.databind.JsonNode;
|
||||
import tools.jackson.databind.ObjectMapper;
|
||||
|
||||
/**
|
||||
* Proves the Fileserver's seams against real infrastructure: HTTP in, real filesystem, real
|
||||
* Proves the Fileserver composition against real infrastructure: HTTP in, real filesystem, real
|
||||
* PostgreSQL, HTTP out.
|
||||
*
|
||||
* <h2>Why this test exists</h2>
|
||||
@@ -69,8 +66,8 @@ import tools.jackson.databind.ObjectMapper;
|
||||
* against a real database, the web layer against standalone MockMvc. None of that exercises the
|
||||
* joins. A content key written by the metadata store and read by the download gateway, a digest
|
||||
* computed while streaming and compared against the persisted column, an ETag minted at publish and
|
||||
* matched on a conditional request: each of those crosses two modules that were only ever proven
|
||||
* separately.
|
||||
* returned by the assembled download path: each of those crosses modules that are otherwise proven
|
||||
* separately. HTTP range/conditional/HEAD semantics stay owned by adapter:inbound:web.
|
||||
*
|
||||
* <h2>Why a focused context rather than a full application boot</h2>
|
||||
*
|
||||
@@ -91,7 +88,7 @@ import tools.jackson.databind.ObjectMapper;
|
||||
*/
|
||||
@Testcontainers
|
||||
@SpringBootTest(
|
||||
classes = FileserverRoundTripContractTest.FileserverRuntime.class,
|
||||
classes = FileserverCompositionIntegrationTest.FileserverRuntime.class,
|
||||
properties = {
|
||||
// No configuration file carries this name, so application.yml is never loaded and the
|
||||
// environment is exactly the list below.
|
||||
@@ -116,11 +113,7 @@ import tools.jackson.databind.ObjectMapper;
|
||||
})
|
||||
@AutoConfigureMockMvc(addFilters = false)
|
||||
@WithMockUser(authorities = {"ROLE_FILE_READ", "ROLE_FILE_WRITE"})
|
||||
@EnabledIf(
|
||||
value = "dockerAvailable",
|
||||
disabledReason =
|
||||
"Docker not available — skipping the real-infrastructure Fileserver round trip")
|
||||
class FileserverRoundTripContractTest {
|
||||
class FileserverCompositionIntegrationTest {
|
||||
|
||||
private static final String CORE_CAPABILITY = "jpa-flyway-migration";
|
||||
private static final String FILESERVER_CAPABILITY = "jpa-fileserver-metadata-v1";
|
||||
@@ -142,10 +135,6 @@ class FileserverRoundTripContractTest {
|
||||
|
||||
@Autowired private ObjectMapper objectMapper;
|
||||
|
||||
static boolean dockerAvailable() {
|
||||
return DockerClientFactory.instance().isDockerAvailable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the operator-owned schema streams and points the runtime at the container.
|
||||
*
|
||||
@@ -174,7 +163,7 @@ class FileserverRoundTripContractTest {
|
||||
}
|
||||
try (Stream<Path> tree = Files.walk(STORAGE_ROOT)) {
|
||||
tree.sorted(Comparator.reverseOrder())
|
||||
.forEach(FileserverRoundTripContractTest::deleteQuietly);
|
||||
.forEach(FileserverCompositionIntegrationTest::deleteQuietly);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,57 +220,6 @@ class FileserverRoundTripContractTest {
|
||||
.isEqualTo(uploaded.get("etag").stringValue());
|
||||
}
|
||||
|
||||
/** A {@code HEAD} answers the same headers as the {@code GET} and no body. */
|
||||
@Test
|
||||
void headAnswersTheDownloadHeadersWithoutABody() throws Exception {
|
||||
String fileId = upload(CONTENT, "head.txt").get("fileId").stringValue();
|
||||
|
||||
MvcResult body = mockMvc.perform(get("/v1/files/{fileId}/content", fileId)).andReturn();
|
||||
MvcResult headers = mockMvc.perform(head("/v1/files/{fileId}/content", fileId)).andReturn();
|
||||
|
||||
assertThat(headers.getResponse().getStatus()).isEqualTo(200);
|
||||
assertThat(headers.getResponse().getContentAsByteArray()).isEmpty();
|
||||
assertThat(headers.getResponse().getHeader(HttpHeaders.ETAG))
|
||||
.isEqualTo(body.getResponse().getHeader(HttpHeaders.ETAG));
|
||||
assertThat(headers.getResponse().getHeader(HttpHeaders.CONTENT_LENGTH))
|
||||
.isEqualTo(body.getResponse().getHeader(HttpHeaders.CONTENT_LENGTH));
|
||||
}
|
||||
|
||||
/** A range request serves the exact interior slice, sourced from the real file on disk. */
|
||||
@Test
|
||||
void rangeRequestServesTheExactSlice() throws Exception {
|
||||
String fileId = upload(CONTENT, "ranged.txt").get("fileId").stringValue();
|
||||
|
||||
MvcResult sliced =
|
||||
mockMvc
|
||||
.perform(
|
||||
get("/v1/files/{fileId}/content", fileId).header(HttpHeaders.RANGE, "bytes=6-19"))
|
||||
.andReturn();
|
||||
|
||||
assertThat(sliced.getResponse().getStatus()).isEqualTo(206);
|
||||
assertThat(sliced.getResponse().getContentAsByteArray())
|
||||
.isEqualTo(java.util.Arrays.copyOfRange(CONTENT, 6, 20));
|
||||
assertThat(sliced.getResponse().getHeader(HttpHeaders.CONTENT_RANGE))
|
||||
.isEqualTo("bytes 6-19/" + CONTENT.length);
|
||||
}
|
||||
|
||||
/** The ETag the upload minted is the one a conditional request matches. */
|
||||
@Test
|
||||
void conditionalRequestWithTheMintedEtagIsNotModified() throws Exception {
|
||||
JsonNode uploaded = upload(CONTENT, "conditional.txt");
|
||||
String fileId = uploaded.get("fileId").stringValue();
|
||||
|
||||
MvcResult unchanged =
|
||||
mockMvc
|
||||
.perform(
|
||||
get("/v1/files/{fileId}/content", fileId)
|
||||
.header(HttpHeaders.IF_NONE_MATCH, uploaded.get("etag").stringValue()))
|
||||
.andReturn();
|
||||
|
||||
assertThat(unchanged.getResponse().getStatus()).isEqualTo(304);
|
||||
assertThat(unchanged.getResponse().getContentAsByteArray()).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* A caller without the read role is refused.
|
||||
*
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
package dev.caskeleton.bootstrap.integration.objectstorage;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.objectstorage.config.ObjectStorageCapabilityConfig;
|
||||
import dev.caskeleton.application.storage.ObjectStoragePort;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.SpringBootConfiguration;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.test.context.DynamicPropertyRegistry;
|
||||
import org.springframework.test.context.DynamicPropertySource;
|
||||
import org.testcontainers.containers.GenericContainer;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
import org.testcontainers.utility.DockerImageName;
|
||||
|
||||
/**
|
||||
* Composition-level object-storage contract against real MinIO.
|
||||
*
|
||||
* <p>The default bootJar intentionally does not ship the object-storage leaf. This test is the
|
||||
* explicit integration composition that proves the leaf can be selected, enabled and used through
|
||||
* its application port without adding a test-only HTTP endpoint to production.
|
||||
*/
|
||||
@Testcontainers
|
||||
@SpringBootTest(
|
||||
classes = ObjectStorageCompositionIntegrationTest.ObjectStorageRuntime.class,
|
||||
properties = {
|
||||
"spring.config.name=object-storage-composition",
|
||||
"spring.main.banner-mode=off",
|
||||
"app.object-storage.enabled=false",
|
||||
"app.object-storage.legacy.enabled=true",
|
||||
"app.object-storage.legacy.backend=s3",
|
||||
"app.object-storage.legacy.bucket=composition-contract",
|
||||
"app.object-storage.legacy.region=us-east-1",
|
||||
"app.object-storage.legacy.access-key=caskeleton",
|
||||
"app.object-storage.legacy.secret-key=caskeleton-secret",
|
||||
"app.object-storage.legacy.path-style-access=true",
|
||||
"app.object-storage.legacy.auto-create-bucket=true"
|
||||
})
|
||||
@SuppressWarnings("removal")
|
||||
class ObjectStorageCompositionIntegrationTest {
|
||||
|
||||
private static final DockerImageName MINIO_IMAGE =
|
||||
DockerImageName.parse(
|
||||
"minio/minio@sha256:4c4a4876193f030c81f57aabb22bcb9a73462010eb61fcab66908e03e5484af8");
|
||||
|
||||
@Container
|
||||
static final GenericContainer<?> MINIO =
|
||||
new GenericContainer<>(MINIO_IMAGE)
|
||||
.withExposedPorts(9000)
|
||||
.withEnv("MINIO_ROOT_USER", "caskeleton")
|
||||
.withEnv("MINIO_ROOT_PASSWORD", "caskeleton-secret")
|
||||
.withCommand("server", "/data");
|
||||
|
||||
@Autowired private ObjectStoragePort objects;
|
||||
|
||||
@DynamicPropertySource
|
||||
static void minioEndpoint(DynamicPropertyRegistry registry) {
|
||||
registry.add(
|
||||
"app.object-storage.legacy.endpoint",
|
||||
() -> "http://" + MINIO.getHost() + ":" + MINIO.getMappedPort(9000));
|
||||
}
|
||||
|
||||
@Test
|
||||
void selectedObjectStorageLeafRoundTripsThroughTheApplicationPort() {
|
||||
String key = "composition/round-trip.txt";
|
||||
byte[] body = "object-storage composition round trip".getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
var stored = objects.put(key, body, "text/plain");
|
||||
|
||||
assertThat(stored.key()).isEqualTo(key);
|
||||
assertThat(stored.size()).isEqualTo(body.length);
|
||||
assertThat(objects.exists(key)).isTrue();
|
||||
assertThat(objects.get(key)).contains(body);
|
||||
|
||||
objects.delete(key);
|
||||
|
||||
assertThat(objects.exists(key)).isFalse();
|
||||
assertThat(objects.get(key)).isEmpty();
|
||||
}
|
||||
|
||||
@SpringBootConfiguration
|
||||
@EnableAutoConfiguration
|
||||
@Import(ObjectStorageCapabilityConfig.class)
|
||||
static class ObjectStorageRuntime {}
|
||||
}
|
||||
-124
@@ -1,124 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.integration.outbox;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.persistence.outbox.OutboxEventJpaRepository;
|
||||
import dev.caskeleton.application.outbox.LegacyOutboxAppendPort;
|
||||
import dev.caskeleton.application.outbox.NewOutboxEvent;
|
||||
import dev.caskeleton.application.transaction.TransactionPort;
|
||||
import dev.caskeleton.bootstrap.integration.PostgreSqlTestContainer;
|
||||
import java.time.Clock;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneOffset;
|
||||
import javax.sql.DataSource;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
import org.testcontainers.postgresql.PostgreSQLContainer;
|
||||
|
||||
/**
|
||||
* Integration test #2 — dual-write prohibition: outbox append participates in the caller's
|
||||
* transaction; on rollback the outbox row is absent.
|
||||
*
|
||||
* <p>Proves the no-dual-write guarantee (D2): if the business transaction rolls back, the outbox
|
||||
* row vanishes with it — there is no separate out-of-band insert.
|
||||
*/
|
||||
@Testcontainers
|
||||
class OutboxAppendTransactionalContractTest {
|
||||
|
||||
@Container
|
||||
static final PostgreSQLContainer PG =
|
||||
PostgreSqlTestContainer.create(OutboxContainerTestSupport.PG_IMAGE);
|
||||
|
||||
private static DataSource sharedDataSource;
|
||||
|
||||
@BeforeAll
|
||||
static void setup() {
|
||||
OutboxContainerTestSupport.assumeDockerAvailable();
|
||||
sharedDataSource = OutboxContainerTestSupport.dataSource(PG);
|
||||
OutboxContainerTestSupport.migrate(sharedDataSource);
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
static void cleanup() throws Exception {
|
||||
if (sharedDataSource instanceof AutoCloseable ac) {
|
||||
ac.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void sameTransactionAppendRollbackRemovesOutboxRowCharacterization() {
|
||||
Clock clock = Clock.fixed(Instant.now(), ZoneOffset.UTC);
|
||||
|
||||
try (AnnotationConfigApplicationContext ctx =
|
||||
OutboxContainerTestSupport.buildContext(sharedDataSource, e -> {}, clock)) {
|
||||
|
||||
TransactionPort tx = ctx.getBean(TransactionPort.class);
|
||||
LegacyOutboxAppendPort append = ctx.getBean(LegacyOutboxAppendPort.class);
|
||||
|
||||
String eventId = "txn-rollback-" + System.nanoTime();
|
||||
|
||||
// Append inside a transaction that rolls back by throwing
|
||||
try {
|
||||
tx.inWrite(
|
||||
() -> {
|
||||
append.append(
|
||||
new NewOutboxEvent(
|
||||
eventId,
|
||||
"TestEvent",
|
||||
"agg-rollback-" + eventId,
|
||||
"{\"rollback\":true}",
|
||||
clock.instant(),
|
||||
"corr-" + eventId,
|
||||
eventId));
|
||||
// Force rollback
|
||||
throw new RuntimeException("intentional rollback");
|
||||
});
|
||||
} catch (RuntimeException ignored) {
|
||||
// expected
|
||||
}
|
||||
|
||||
// Query specifically for this eventId via the store adapter's JPA repo
|
||||
OutboxEventJpaRepository repo = ctx.getBean(OutboxEventJpaRepository.class);
|
||||
assertThat(repo.findById(eventId))
|
||||
.as("outbox row must not exist after transaction rollback (D2 dual-write prohibition)")
|
||||
.isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void outboxRowIsPresentWhenTransactionCommits() {
|
||||
Clock clock = Clock.fixed(Instant.now(), ZoneOffset.UTC);
|
||||
|
||||
try (AnnotationConfigApplicationContext ctx =
|
||||
OutboxContainerTestSupport.buildContext(sharedDataSource, e -> {}, clock)) {
|
||||
|
||||
TransactionPort tx = ctx.getBean(TransactionPort.class);
|
||||
LegacyOutboxAppendPort append = ctx.getBean(LegacyOutboxAppendPort.class);
|
||||
|
||||
String eventId = "txn-commit-" + System.nanoTime();
|
||||
|
||||
tx.inWrite(
|
||||
() -> {
|
||||
append.append(
|
||||
new NewOutboxEvent(
|
||||
eventId,
|
||||
"TestEvent",
|
||||
"agg-commit-" + eventId,
|
||||
"{\"committed\":true}",
|
||||
clock.instant(),
|
||||
"corr-" + eventId,
|
||||
eventId));
|
||||
return null;
|
||||
});
|
||||
|
||||
OutboxEventJpaRepository repo = ctx.getBean(OutboxEventJpaRepository.class);
|
||||
assertThat(repo.findById(eventId))
|
||||
.as("outbox row must exist after successful transaction commit")
|
||||
.isPresent();
|
||||
}
|
||||
}
|
||||
}
|
||||
-231
@@ -1,231 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.integration.outbox;
|
||||
|
||||
import com.zaxxer.hikari.HikariConfig;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import dev.caskeleton.adapter.outbound.persistence.outbox.OutboxClaimRepository;
|
||||
import dev.caskeleton.adapter.outbound.persistence.outbox.OutboxEventJpaRepository;
|
||||
import dev.caskeleton.adapter.outbound.persistence.outbox.OutboxStoreAdapter;
|
||||
import dev.caskeleton.adapter.outbound.persistence.postgresql.PostgreSqlOutboxClaimRepository;
|
||||
import dev.caskeleton.adapter.outbound.persistence.transaction.SpringTransactionPort;
|
||||
import dev.caskeleton.application.outbox.OutboxBackoffPolicy;
|
||||
import dev.caskeleton.application.outbox.OutboxMessagePublishPort;
|
||||
import dev.caskeleton.application.outbox.PublishPendingOutboxEventsUseCase;
|
||||
import dev.caskeleton.application.transaction.TransactionPort;
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
import java.time.Clock;
|
||||
import java.time.Duration;
|
||||
import java.util.Properties;
|
||||
import java.util.random.RandomGenerator;
|
||||
import javax.sql.DataSource;
|
||||
import org.flywaydb.core.Flyway;
|
||||
import org.junit.jupiter.api.Assumptions;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.event.ContextClosedEvent;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||
import org.springframework.orm.jpa.SharedEntityManagerCreator;
|
||||
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
|
||||
import org.testcontainers.DockerClientFactory;
|
||||
import org.testcontainers.postgresql.PostgreSQLContainer;
|
||||
|
||||
/**
|
||||
* Shared Testcontainers + Spring context support for outbox integration tests
|
||||
* (feature-domain-event-outbox-contract Task E).
|
||||
*
|
||||
* <p>Does NOT boot the full {@code CaSkeletonApplication}. Builds a minimal {@link
|
||||
* AnnotationConfigApplicationContext} with only the JPA / outbox persistence beans needed for the
|
||||
* outbox integration tests.
|
||||
*/
|
||||
final class OutboxContainerTestSupport {
|
||||
|
||||
static final String PG_IMAGE = "postgres:16-alpine";
|
||||
static final int BATCH_SIZE_CONTRACT = 50;
|
||||
static final Duration IN_FLIGHT_TIMEOUT = Duration.ofSeconds(30);
|
||||
|
||||
private OutboxContainerTestSupport() {}
|
||||
|
||||
/** Guard: skip the test if Docker is unavailable (CI without Docker daemon). */
|
||||
static void assumeDockerAvailable() {
|
||||
Assumptions.assumeTrue(
|
||||
DockerClientFactory.instance().isDockerAvailable(),
|
||||
"Docker not available — skipping Testcontainers-based outbox integration test");
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs Flyway migrations against the given DataSource. All three migrations (V1 idempotency, V2
|
||||
* legacy work_log migration, V3 outbox_event) are applied.
|
||||
*/
|
||||
static void migrate(DataSource dataSource) {
|
||||
Flyway.configure()
|
||||
.dataSource(dataSource)
|
||||
.locations("classpath:db/migration/postgresql")
|
||||
.load()
|
||||
.migrate();
|
||||
}
|
||||
|
||||
/** Creates a HikariDataSource pointing to the given PostgreSQL container. */
|
||||
static HikariDataSource dataSource(PostgreSQLContainer pg) {
|
||||
HikariConfig config = new HikariConfig();
|
||||
config.setJdbcUrl(pg.getJdbcUrl());
|
||||
config.setUsername(pg.getUsername());
|
||||
config.setPassword(pg.getPassword());
|
||||
config.setMaximumPoolSize(10);
|
||||
config.setMinimumIdle(2);
|
||||
return new HikariDataSource(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a minimal Spring context containing JPA + outbox persistence beans.
|
||||
*
|
||||
* <p>Registers only the beans needed for outbox integration tests — avoids pulling in audit,
|
||||
* idempotency, or other persistence components that have additional dependencies
|
||||
* (DomainContextPropagator, etc.).
|
||||
*
|
||||
* <p>The DataSource lifecycle is owned by the caller; Spring will NOT close it when the context
|
||||
* is destroyed (destroyMethodName="").
|
||||
*
|
||||
* @param dataSource the JDBC DataSource (pointing at the PG container)
|
||||
* @param publisher the {@link OutboxMessagePublishPort} stub for this context
|
||||
* @param clock the clock to use
|
||||
* @return a started {@link AnnotationConfigApplicationContext}
|
||||
*/
|
||||
static AnnotationConfigApplicationContext buildContext(
|
||||
DataSource dataSource, OutboxMessagePublishPort publisher, Clock clock) {
|
||||
|
||||
// Build the EntityManagerFactory outside of the Spring context so we control
|
||||
// its full lifecycle independently. This avoids the FactoryBean complexity
|
||||
// inside AnnotationConfigApplicationContext.
|
||||
LocalContainerEntityManagerFactoryBean emfBean = buildEmfBean(dataSource);
|
||||
EntityManagerFactory emf = emfBean.getObject();
|
||||
|
||||
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
|
||||
|
||||
// Register DataSource — no destroy (caller owns lifecycle).
|
||||
ctx.registerBean(
|
||||
"dataSource", DataSource.class, () -> dataSource, bd -> bd.setDestroyMethodName(""));
|
||||
|
||||
// Register pre-built EntityManagerFactory — no destroy (emfBean.destroy() called below).
|
||||
ctx.registerBean(
|
||||
"entityManagerFactory",
|
||||
EntityManagerFactory.class,
|
||||
() -> emf,
|
||||
bd -> bd.setDestroyMethodName(""));
|
||||
|
||||
// JpaTransactionManager
|
||||
ctx.registerBean(
|
||||
"transactionManager",
|
||||
JpaTransactionManager.class,
|
||||
() -> {
|
||||
JpaTransactionManager tm = new JpaTransactionManager();
|
||||
tm.setEntityManagerFactory(emf);
|
||||
return tm;
|
||||
});
|
||||
|
||||
// SpringTransactionPort
|
||||
ctx.registerBean(
|
||||
"springTransactionPort",
|
||||
SpringTransactionPort.class,
|
||||
() ->
|
||||
new SpringTransactionPort(
|
||||
ctx.getBean("transactionManager", JpaTransactionManager.class)));
|
||||
|
||||
// Enable JPA repositories for the outbox package only (avoids scanning
|
||||
// other repositories that have unmet dependencies in this minimal context).
|
||||
ctx.register(OutboxRepositoryConfig.class);
|
||||
|
||||
// OutboxClaimRepository: the real PostgreSQL vendor implementation, injected with a
|
||||
// transaction-aware shared EntityManager (mirrors production @PersistenceContext). An
|
||||
// earlier inline lambda used a standalone EM (emf.createEntityManager()) that did NOT join
|
||||
// the relay's transaction, so FOR UPDATE SKIP LOCKED locks were not held within it —
|
||||
// breaking the concurrent-relay (zero-duplicate) and in-flight-reclaim contracts.
|
||||
// implementation project(':adapter:outbound:persistence-jpa') puts the production PostgreSQL
|
||||
// vendor class (under the .postgresql subpackage) on the test compile classpath.
|
||||
EntityManager sharedEntityManager = SharedEntityManagerCreator.createSharedEntityManager(emf);
|
||||
ctx.registerBean(
|
||||
"outboxClaimRepository",
|
||||
OutboxClaimRepository.class,
|
||||
() -> new PostgreSqlOutboxClaimRepository(sharedEntityManager));
|
||||
|
||||
// OutboxStoreAdapter: @Repository — registered manually (no component scan).
|
||||
ctx.registerBean(
|
||||
"outboxStoreAdapter",
|
||||
OutboxStoreAdapter.class,
|
||||
() ->
|
||||
new OutboxStoreAdapter(
|
||||
ctx.getBean(OutboxEventJpaRepository.class),
|
||||
ctx.getBean(OutboxClaimRepository.class)));
|
||||
|
||||
// Publisher stub and clock
|
||||
ctx.registerBean(
|
||||
"outboxMessagePublishPort",
|
||||
OutboxMessagePublishPort.class,
|
||||
() -> publisher,
|
||||
bd -> bd.setDestroyMethodName(""));
|
||||
ctx.registerBean("systemClock", Clock.class, () -> clock, bd -> bd.setDestroyMethodName(""));
|
||||
|
||||
// Register a destroy callback so emfBean.destroy() is called when ctx.close() is called
|
||||
ctx.addApplicationListener(
|
||||
event -> {
|
||||
if (event instanceof ContextClosedEvent) {
|
||||
try {
|
||||
emfBean.destroy();
|
||||
} catch (Exception exception) {
|
||||
throw new IllegalStateException(
|
||||
"Outbox test EntityManagerFactory cleanup failed", exception);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ctx.refresh();
|
||||
return ctx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds and wires a {@link PublishPendingOutboxEventsUseCase} from beans in the given context.
|
||||
*/
|
||||
static PublishPendingOutboxEventsUseCase relayUseCase(AnnotationConfigApplicationContext ctx) {
|
||||
OutboxStoreAdapter store = ctx.getBean(OutboxStoreAdapter.class);
|
||||
OutboxMessagePublishPort publisher = ctx.getBean(OutboxMessagePublishPort.class);
|
||||
TransactionPort tx = ctx.getBean(SpringTransactionPort.class);
|
||||
Clock clock = ctx.getBean(Clock.class);
|
||||
return new PublishPendingOutboxEventsUseCase(
|
||||
store,
|
||||
publisher,
|
||||
ignored -> {},
|
||||
tx,
|
||||
new OutboxBackoffPolicy(RandomGenerator.getDefault()),
|
||||
clock,
|
||||
BATCH_SIZE_CONTRACT,
|
||||
IN_FLIGHT_TIMEOUT);
|
||||
}
|
||||
|
||||
// ---- helpers ----
|
||||
|
||||
private static LocalContainerEntityManagerFactoryBean buildEmfBean(DataSource dataSource) {
|
||||
LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
|
||||
emf.setDataSource(dataSource);
|
||||
HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
|
||||
adapter.setGenerateDdl(false);
|
||||
adapter.setShowSql(false);
|
||||
emf.setJpaVendorAdapter(adapter);
|
||||
emf.setPackagesToScan("dev.caskeleton.adapter.outbound.persistence");
|
||||
Properties props = new Properties();
|
||||
props.setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect");
|
||||
props.setProperty("hibernate.jdbc.time_zone", "UTC");
|
||||
emf.setJpaProperties(props);
|
||||
emf.afterPropertiesSet(); // initializes and builds the EntityManagerFactory
|
||||
return emf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimal configuration that enables only the outbox JPA repository. Scoped to the outbox
|
||||
* sub-package to avoid auto-wiring other repositories that have unmet dependencies in this
|
||||
* minimal context.
|
||||
*/
|
||||
@Configuration
|
||||
@EnableJpaRepositories(basePackageClasses = OutboxEventJpaRepository.class)
|
||||
static class OutboxRepositoryConfig {}
|
||||
}
|
||||
-174
@@ -1,174 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.integration.outbox;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import dev.caskeleton.application.outbox.LegacyOutboxAppendPort;
|
||||
import dev.caskeleton.application.outbox.NewOutboxEvent;
|
||||
import dev.caskeleton.application.outbox.OutboxRelayResult;
|
||||
import dev.caskeleton.application.outbox.PublishPendingOutboxEventsCommand;
|
||||
import dev.caskeleton.application.outbox.PublishPendingOutboxEventsUseCase;
|
||||
import dev.caskeleton.application.transaction.TransactionPort;
|
||||
import dev.caskeleton.bootstrap.integration.PostgreSqlTestContainer;
|
||||
import java.time.Clock;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import javax.sql.DataSource;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
import org.testcontainers.postgresql.PostgreSQLContainer;
|
||||
|
||||
/**
|
||||
* Integration test #5 — multi-instance relay (leader-election via SKIP LOCKED).
|
||||
*
|
||||
* <p>Spec: PENDING 1000 rows, 2 independent Spring contexts, relay driven concurrently; total
|
||||
* publishes = 1000 and no eventId published twice.
|
||||
*
|
||||
* <p>Each context uses a stub publisher that records (instanceId, eventId) into a shared {@link
|
||||
* ConcurrentHashMap}. Both relay loops run until the store is drained (claimedCount == 0 for both
|
||||
* instances). Then assert total = 1000, duplicates = 0.
|
||||
*/
|
||||
@Testcontainers
|
||||
class OutboxPublisherLeaderElectionContractTest {
|
||||
|
||||
@Container
|
||||
static final PostgreSQLContainer PG =
|
||||
PostgreSqlTestContainer.create(OutboxContainerTestSupport.PG_IMAGE);
|
||||
|
||||
private static DataSource sharedDataSource;
|
||||
|
||||
@BeforeAll
|
||||
static void setup() {
|
||||
OutboxContainerTestSupport.assumeDockerAvailable();
|
||||
sharedDataSource = OutboxContainerTestSupport.dataSource(PG);
|
||||
OutboxContainerTestSupport.migrate(sharedDataSource);
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
static void cleanup() throws Exception {
|
||||
if (sharedDataSource instanceof AutoCloseable ac) {
|
||||
ac.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void twoRelayInstancesPublishAll1000RowsWithZeroDuplicates() throws Exception {
|
||||
// ---- fixed clock: rows inserted with occurredAt = t0, relay clock = t0 ----
|
||||
// next_attempt_at is set to occurredAt at append time. Using a fixed t0 for
|
||||
// both ensures next_attempt_at (= t0) <= now (= t0) so every row is eligible.
|
||||
// Using Instant.now() independently for rows and clock risks t0_row > t0_clock
|
||||
// which would make 0 rows eligible (the prior failure mode, fixed here).
|
||||
Instant t0 = Instant.now();
|
||||
// Give relay a 1-second buffer beyond t0 so any sub-millisecond jitter at
|
||||
// insert time does not cause rows to be ineligible.
|
||||
Clock clock = Clock.fixed(t0.plusSeconds(1), ZoneOffset.UTC);
|
||||
|
||||
AnnotationConfigApplicationContext seedCtx =
|
||||
OutboxContainerTestSupport.buildContext(sharedDataSource, e -> {}, clock);
|
||||
TransactionPort seedTx = seedCtx.getBean(TransactionPort.class);
|
||||
LegacyOutboxAppendPort appendPort = seedCtx.getBean(LegacyOutboxAppendPort.class);
|
||||
|
||||
seedTx.inWrite(
|
||||
() -> {
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
String id = "evt-leader-" + i;
|
||||
appendPort.append(
|
||||
new NewOutboxEvent(
|
||||
id,
|
||||
"TestEvent",
|
||||
"agg-leader-" + i, // distinct aggregateId per row
|
||||
"{\"seq\":" + i + "}",
|
||||
t0, // fixed occurredAt = t0 so next_attempt_at = t0 <= relay now
|
||||
"corr-leader-" + i,
|
||||
id));
|
||||
}
|
||||
return null;
|
||||
});
|
||||
seedCtx.close();
|
||||
|
||||
// ---- shared publish registry ----
|
||||
Map<String, String> publishedByEventId = new ConcurrentHashMap<>(); // eventId -> instanceId
|
||||
AtomicInteger duplicateCount = new AtomicInteger(0);
|
||||
|
||||
// ---- build two independent contexts, each with its own stub publisher ----
|
||||
AnnotationConfigApplicationContext ctx1 =
|
||||
OutboxContainerTestSupport.buildContext(
|
||||
sharedDataSource,
|
||||
event -> {
|
||||
String prev = publishedByEventId.put(event.eventId(), "instance-1");
|
||||
if (prev != null) {
|
||||
duplicateCount.incrementAndGet();
|
||||
}
|
||||
},
|
||||
clock);
|
||||
|
||||
AnnotationConfigApplicationContext ctx2 =
|
||||
OutboxContainerTestSupport.buildContext(
|
||||
sharedDataSource,
|
||||
event -> {
|
||||
String prev = publishedByEventId.put(event.eventId(), "instance-2");
|
||||
if (prev != null) {
|
||||
duplicateCount.incrementAndGet();
|
||||
}
|
||||
},
|
||||
clock);
|
||||
|
||||
PublishPendingOutboxEventsUseCase relay1 = OutboxContainerTestSupport.relayUseCase(ctx1);
|
||||
PublishPendingOutboxEventsUseCase relay2 = OutboxContainerTestSupport.relayUseCase(ctx2);
|
||||
|
||||
// ---- drive both relay loops concurrently until drained ----
|
||||
ExecutorService executor = Executors.newFixedThreadPool(2);
|
||||
Future<Integer> f1 = executor.submit(() -> drainRelay(relay1));
|
||||
Future<Integer> f2 = executor.submit(() -> drainRelay(relay2));
|
||||
|
||||
executor.shutdown();
|
||||
executor.awaitTermination(60, TimeUnit.SECONDS);
|
||||
|
||||
int published1 = f1.get();
|
||||
int published2 = f2.get();
|
||||
|
||||
ctx1.close();
|
||||
ctx2.close();
|
||||
|
||||
// ---- assertions ----
|
||||
assertThat(duplicateCount.get())
|
||||
.as("no eventId must be published twice (SKIP LOCKED prevents double-claim)")
|
||||
.isZero();
|
||||
assertThat(publishedByEventId.size())
|
||||
.as("total unique published events must equal 1000")
|
||||
.isEqualTo(1000);
|
||||
assertThat(published1 + published2)
|
||||
.as("sum of per-instance publish counts must equal 1000")
|
||||
.isEqualTo(1000);
|
||||
}
|
||||
|
||||
/** Runs the relay in a loop until claimedCount == 0 (store drained). */
|
||||
private int drainRelay(PublishPendingOutboxEventsUseCase relay) {
|
||||
int total = 0;
|
||||
int emptyRounds = 0;
|
||||
while (emptyRounds < 3) {
|
||||
OutboxRelayResult result = relay.handle(PublishPendingOutboxEventsCommand.INSTANCE);
|
||||
long published =
|
||||
result.outcomes().stream()
|
||||
.filter(o -> o.outcome() == OutboxRelayResult.Outcome.PUBLISHED)
|
||||
.count();
|
||||
total += (int) published;
|
||||
if (result.claimedCount() == 0) {
|
||||
emptyRounds++;
|
||||
} else {
|
||||
emptyRounds = 0;
|
||||
}
|
||||
}
|
||||
return total;
|
||||
}
|
||||
}
|
||||
-728
@@ -1,728 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.integration.outbox;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.persistence.outbox.OutboxEventJpaRepository;
|
||||
import dev.caskeleton.adapter.outbound.persistence.outbox.OutboxReaper;
|
||||
import dev.caskeleton.adapter.outbound.persistence.outbox.OutboxStoreAdapter;
|
||||
import dev.caskeleton.application.outbox.ClaimedOutboxEvent;
|
||||
import dev.caskeleton.application.outbox.LegacyOutboxAppendPort;
|
||||
import dev.caskeleton.application.outbox.NewOutboxEvent;
|
||||
import dev.caskeleton.application.outbox.OutboxBackoffPolicy;
|
||||
import dev.caskeleton.application.outbox.OutboxEventStatus;
|
||||
import dev.caskeleton.application.outbox.OutboxMessagePublishPort;
|
||||
import dev.caskeleton.application.outbox.OutboxRelayResult;
|
||||
import dev.caskeleton.application.outbox.PublishPendingOutboxEventsCommand;
|
||||
import dev.caskeleton.application.outbox.PublishPendingOutboxEventsUseCase;
|
||||
import dev.caskeleton.application.transaction.TransactionPort;
|
||||
import dev.caskeleton.bootstrap.integration.PostgreSqlTestContainer;
|
||||
import java.time.Clock;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.random.RandomGenerator;
|
||||
import javax.sql.DataSource;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.testcontainers.junit.jupiter.Container;
|
||||
import org.testcontainers.junit.jupiter.Testcontainers;
|
||||
import org.testcontainers.postgresql.PostgreSQLContainer;
|
||||
|
||||
/**
|
||||
* Row lifecycle integration test (feature-domain-event-outbox-contract Task E).
|
||||
*
|
||||
* <p>Verifies each lifecycle scenario against a real PostgreSQL instance:
|
||||
*
|
||||
* <ul>
|
||||
* <li>PENDING → IN_FLIGHT → PUBLISHED (happy path)
|
||||
* <li>FAILED backoff: transient failure transitions to FAILED
|
||||
* <li>3 retries exhausted → DEAD (with OUTBOX_DEAD_LETTER log code)
|
||||
* <li>FIFO ordering: rows for the same aggregate are relayed in OCCURRED_AT ASC order
|
||||
* <li>IN_FLIGHT orphan re-claim after timeout
|
||||
* <li>Reaper TTL deletion of PUBLISHED rows
|
||||
* </ul>
|
||||
*/
|
||||
@Testcontainers
|
||||
class OutboxRowLifecycleContractTest {
|
||||
|
||||
@Container
|
||||
static final PostgreSQLContainer PG =
|
||||
PostgreSqlTestContainer.create(OutboxContainerTestSupport.PG_IMAGE);
|
||||
|
||||
private static DataSource sharedDataSource;
|
||||
|
||||
@BeforeAll
|
||||
static void setup() {
|
||||
OutboxContainerTestSupport.assumeDockerAvailable();
|
||||
sharedDataSource = OutboxContainerTestSupport.dataSource(PG);
|
||||
OutboxContainerTestSupport.migrate(sharedDataSource);
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
static void cleanup() throws Exception {
|
||||
if (sharedDataSource instanceof AutoCloseable ac) {
|
||||
ac.close();
|
||||
}
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// Happy path: PENDING → IN_FLIGHT → PUBLISHED
|
||||
// =========================================================================
|
||||
|
||||
@Test
|
||||
void pendingRowTransitionsToPublishedOnSuccessfulRelay() {
|
||||
Clock clock = Clock.fixed(Instant.now(), ZoneOffset.UTC);
|
||||
try (AnnotationConfigApplicationContext ctx =
|
||||
OutboxContainerTestSupport.buildContext(sharedDataSource, e -> {}, clock)) {
|
||||
|
||||
TransactionPort tx = ctx.getBean(TransactionPort.class);
|
||||
LegacyOutboxAppendPort append = ctx.getBean(LegacyOutboxAppendPort.class);
|
||||
OutboxStoreAdapter store = ctx.getBean(OutboxStoreAdapter.class);
|
||||
|
||||
String eventId = "lifecycle-happy-" + System.nanoTime();
|
||||
tx.inWrite(
|
||||
() -> {
|
||||
append.append(newEvent(eventId, "agg-happy-" + eventId, clock));
|
||||
return null;
|
||||
});
|
||||
|
||||
PublishPendingOutboxEventsUseCase relay = OutboxContainerTestSupport.relayUseCase(ctx);
|
||||
OutboxRelayResult result = relay.handle(PublishPendingOutboxEventsCommand.INSTANCE);
|
||||
|
||||
long published =
|
||||
result.outcomes().stream()
|
||||
.filter(
|
||||
o ->
|
||||
o.eventId().equals(eventId)
|
||||
&& o.outcome() == OutboxRelayResult.Outcome.PUBLISHED)
|
||||
.count();
|
||||
assertThat(published).as("event must be PUBLISHED in relay result").isEqualTo(1);
|
||||
|
||||
// Verify DB status
|
||||
Map<OutboxEventStatus, Long> counts = store.countByStatus();
|
||||
assertThat(counts.getOrDefault(OutboxEventStatus.PUBLISHED, 0L))
|
||||
.as("PUBLISHED count must be >= 1")
|
||||
.isGreaterThanOrEqualTo(1);
|
||||
}
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// Transient failure → FAILED with backoff
|
||||
// =========================================================================
|
||||
|
||||
@Test
|
||||
void transientPublishFailureTransitionsRowToFailed() {
|
||||
Clock clock = Clock.fixed(Instant.now(), ZoneOffset.UTC);
|
||||
AtomicBoolean fail = new AtomicBoolean(true);
|
||||
|
||||
try (AnnotationConfigApplicationContext ctx =
|
||||
OutboxContainerTestSupport.buildContext(
|
||||
sharedDataSource,
|
||||
e -> {
|
||||
if (fail.get()) {
|
||||
throw new RuntimeException("transient");
|
||||
}
|
||||
},
|
||||
clock)) {
|
||||
|
||||
TransactionPort tx = ctx.getBean(TransactionPort.class);
|
||||
LegacyOutboxAppendPort append = ctx.getBean(LegacyOutboxAppendPort.class);
|
||||
OutboxStoreAdapter store = ctx.getBean(OutboxStoreAdapter.class);
|
||||
|
||||
String eventId = "lifecycle-fail-" + System.nanoTime();
|
||||
tx.inWrite(
|
||||
() -> {
|
||||
append.append(newEvent(eventId, "agg-fail-" + eventId, clock));
|
||||
return null;
|
||||
});
|
||||
|
||||
PublishPendingOutboxEventsUseCase relay = OutboxContainerTestSupport.relayUseCase(ctx);
|
||||
OutboxRelayResult result = relay.handle(PublishPendingOutboxEventsCommand.INSTANCE);
|
||||
|
||||
long failed =
|
||||
result.outcomes().stream()
|
||||
.filter(
|
||||
o ->
|
||||
o.eventId().equals(eventId)
|
||||
&& o.outcome() == OutboxRelayResult.Outcome.FAILED)
|
||||
.count();
|
||||
assertThat(failed).as("event must be FAILED after transient error").isEqualTo(1);
|
||||
|
||||
Map<OutboxEventStatus, Long> counts = store.countByStatus();
|
||||
assertThat(counts.getOrDefault(OutboxEventStatus.FAILED, 0L))
|
||||
.as("FAILED count must be >= 1 in store")
|
||||
.isGreaterThanOrEqualTo(1);
|
||||
}
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// 3 retries exhausted → DEAD
|
||||
//
|
||||
// The relay use case checks attemptCount >= maxAttempts (3) and marks DEAD.
|
||||
// After each failure, markFailed sets nextAttemptAt = now + backoff.
|
||||
// To re-claim on the next cycle, we advance the relay clock past the backoff
|
||||
// window by 2 hours per cycle (backoff max ≈ 30s; 2h always covers it).
|
||||
// =========================================================================
|
||||
|
||||
@Test
|
||||
void threeRetriesExhaustedTransitionsRowToDead() {
|
||||
Instant t0 = Instant.now();
|
||||
// Append clock — rows get nextAttemptAt = t0 (PENDING, immediately eligible)
|
||||
Clock appendClock = Clock.fixed(t0, ZoneOffset.UTC);
|
||||
|
||||
AtomicInteger publishAttempts = new AtomicInteger(0);
|
||||
|
||||
try (AnnotationConfigApplicationContext ctx =
|
||||
OutboxContainerTestSupport.buildContext(
|
||||
sharedDataSource,
|
||||
e -> {
|
||||
publishAttempts.incrementAndGet();
|
||||
throw new RuntimeException("always fails");
|
||||
},
|
||||
appendClock)) {
|
||||
|
||||
TransactionPort tx = ctx.getBean(TransactionPort.class);
|
||||
LegacyOutboxAppendPort append = ctx.getBean(LegacyOutboxAppendPort.class);
|
||||
OutboxStoreAdapter store = ctx.getBean(OutboxStoreAdapter.class);
|
||||
|
||||
String eventId = "lifecycle-dead-" + System.nanoTime();
|
||||
tx.inWrite(
|
||||
() -> {
|
||||
append.append(newEvent(eventId, "agg-dead-" + eventId, appendClock));
|
||||
return null;
|
||||
});
|
||||
|
||||
// Each relay cycle uses a clock 2 hours after the previous one.
|
||||
// This ensures the FAILED row's nextAttemptAt (now + max ~60s backoff)
|
||||
// is always in the past relative to the next relay clock.
|
||||
OutboxRelayResult r1 =
|
||||
buildRelayWithClock(ctx, t0).handle(PublishPendingOutboxEventsCommand.INSTANCE);
|
||||
assertThat(r1.outcomes())
|
||||
.as("cycle 1 must process our event")
|
||||
.anyMatch(o -> o.eventId().equals(eventId));
|
||||
|
||||
OutboxRelayResult r2 =
|
||||
buildRelayWithClock(ctx, t0.plus(Duration.ofHours(2)))
|
||||
.handle(PublishPendingOutboxEventsCommand.INSTANCE);
|
||||
assertThat(r2.outcomes())
|
||||
.as("cycle 2 must process our event")
|
||||
.anyMatch(o -> o.eventId().equals(eventId));
|
||||
|
||||
OutboxRelayResult r3 =
|
||||
buildRelayWithClock(ctx, t0.plus(Duration.ofHours(4)))
|
||||
.handle(PublishPendingOutboxEventsCommand.INSTANCE);
|
||||
|
||||
// Third cycle should produce DEAD (attemptCount=3 >= maxAttempts=3)
|
||||
long deadInR3 =
|
||||
r3.outcomes().stream()
|
||||
.filter(
|
||||
o -> o.eventId().equals(eventId) && o.outcome() == OutboxRelayResult.Outcome.DEAD)
|
||||
.count();
|
||||
assertThat(deadInR3).as("event must be DEAD after 3 failed attempts").isEqualTo(1);
|
||||
|
||||
Map<OutboxEventStatus, Long> counts = store.countByStatus();
|
||||
assertThat(counts.getOrDefault(OutboxEventStatus.DEAD, 0L))
|
||||
.as("DEAD count must be >= 1 in store")
|
||||
.isGreaterThanOrEqualTo(1);
|
||||
}
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// FIFO ordering: rows for same aggregate are relayed in OCCURRED_AT ASC order
|
||||
//
|
||||
// With the FIFO gate (I4 NOT EXISTS correlated subquery), the tail row is
|
||||
// blocked while the head is not PUBLISHED. This test verifies the two-cycle
|
||||
// semantics:
|
||||
// Cycle 1 → only the head is claimed and published; the tail does NOT appear.
|
||||
// Cycle 2 → the tail is now unblocked (head is PUBLISHED) and is published.
|
||||
// =========================================================================
|
||||
|
||||
@Test
|
||||
void fifoOrderingHeadRowAppearsBeforeTailInRelayOutcomes() {
|
||||
Instant t0 = Instant.now();
|
||||
// Relay clock is t0+1s so next_attempt_at of head (= t0) and tail (= t0+1ms)
|
||||
// are both <= relay now (= t0+1s). Using t0 exactly would make tail ineligible
|
||||
// because tail.nextAttemptAt = t0+1ms > t0.
|
||||
Clock clock = Clock.fixed(t0.plusSeconds(1), ZoneOffset.UTC);
|
||||
|
||||
try (AnnotationConfigApplicationContext ctx =
|
||||
OutboxContainerTestSupport.buildContext(sharedDataSource, e -> {}, clock)) {
|
||||
|
||||
TransactionPort tx = ctx.getBean(TransactionPort.class);
|
||||
LegacyOutboxAppendPort append = ctx.getBean(LegacyOutboxAppendPort.class);
|
||||
|
||||
String aggId = "agg-fifo-order-" + System.nanoTime();
|
||||
String headId = "fifo-order-head-" + System.nanoTime();
|
||||
String tailId = "fifo-order-tail-" + System.nanoTime();
|
||||
|
||||
// Insert head (OCCURRED_AT=t0) and tail (OCCURRED_AT=t0+1ms).
|
||||
// Both nextAttemptAt = occurredAt <= t0+1s = relay clock's now.
|
||||
tx.inWrite(
|
||||
() -> {
|
||||
append.append(newEventAt(headId, aggId, t0));
|
||||
append.append(newEventAt(tailId, aggId, t0.plusMillis(1)));
|
||||
return null;
|
||||
});
|
||||
|
||||
PublishPendingOutboxEventsUseCase relay = OutboxContainerTestSupport.relayUseCase(ctx);
|
||||
|
||||
// --- Relay cycle 1: FIFO gate blocks tail while head is PENDING ---
|
||||
// The NOT EXISTS gate allows only the head (head has no non-PUBLISHED
|
||||
// earlier sibling; tail has the head as a PENDING earlier sibling).
|
||||
OutboxRelayResult cycle1 = relay.handle(PublishPendingOutboxEventsCommand.INSTANCE);
|
||||
|
||||
List<String> cycle1Ids =
|
||||
cycle1.outcomes().stream().map(OutboxRelayResult.EventOutcome::eventId).toList();
|
||||
|
||||
assertThat(cycle1Ids)
|
||||
.as("cycle 1: only the head must be claimed (tail blocked by FIFO gate)")
|
||||
.contains(headId);
|
||||
assertThat(cycle1Ids)
|
||||
.as("cycle 1: tail must NOT appear while head is not PUBLISHED")
|
||||
.doesNotContain(tailId);
|
||||
assertThat(
|
||||
cycle1.outcomes().stream()
|
||||
.filter(o -> o.eventId().equals(headId))
|
||||
.findFirst()
|
||||
.map(OutboxRelayResult.EventOutcome::outcome)
|
||||
.orElse(null))
|
||||
.as("cycle 1: head must be PUBLISHED")
|
||||
.isEqualTo(OutboxRelayResult.Outcome.PUBLISHED);
|
||||
|
||||
// --- Relay cycle 2: head is PUBLISHED → tail is unblocked ---
|
||||
OutboxRelayResult cycle2 = relay.handle(PublishPendingOutboxEventsCommand.INSTANCE);
|
||||
|
||||
List<String> cycle2Ids =
|
||||
cycle2.outcomes().stream().map(OutboxRelayResult.EventOutcome::eventId).toList();
|
||||
|
||||
assertThat(cycle2Ids)
|
||||
.as("cycle 2: tail must now be claimed (head is PUBLISHED, gate open)")
|
||||
.contains(tailId);
|
||||
assertThat(
|
||||
cycle2.outcomes().stream()
|
||||
.filter(o -> o.eventId().equals(tailId))
|
||||
.findFirst()
|
||||
.map(OutboxRelayResult.EventOutcome::outcome)
|
||||
.orElse(null))
|
||||
.as("cycle 2: tail must be PUBLISHED")
|
||||
.isEqualTo(OutboxRelayResult.Outcome.PUBLISHED);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void equalTimestampRowsAreClaimedTogetherLegacyFifoLimitationCharacterization() {
|
||||
Instant occurredAt = Instant.now();
|
||||
Clock clock = Clock.fixed(occurredAt.plusSeconds(1), ZoneOffset.UTC);
|
||||
|
||||
try (AnnotationConfigApplicationContext ctx =
|
||||
OutboxContainerTestSupport.buildContext(sharedDataSource, e -> {}, clock)) {
|
||||
|
||||
TransactionPort tx = ctx.getBean(TransactionPort.class);
|
||||
LegacyOutboxAppendPort append = ctx.getBean(LegacyOutboxAppendPort.class);
|
||||
|
||||
String aggregateId = "agg-fifo-tie-" + System.nanoTime();
|
||||
String firstId = "fifo-tie-first-" + System.nanoTime();
|
||||
String secondId = "fifo-tie-second-" + System.nanoTime();
|
||||
|
||||
tx.inWrite(
|
||||
() -> {
|
||||
append.append(newEventAt(firstId, aggregateId, occurredAt));
|
||||
append.append(newEventAt(secondId, aggregateId, occurredAt));
|
||||
return null;
|
||||
});
|
||||
|
||||
OutboxRelayResult cycle =
|
||||
OutboxContainerTestSupport.relayUseCase(ctx)
|
||||
.handle(PublishPendingOutboxEventsCommand.INSTANCE);
|
||||
|
||||
assertThat(cycle.outcomes())
|
||||
.as(
|
||||
"legacy FIFO compares only occurred_at with '<', so equal timestamps do not gate"
|
||||
+ " either row")
|
||||
.filteredOn(
|
||||
outcome -> outcome.eventId().equals(firstId) || outcome.eventId().equals(secondId))
|
||||
.extracting(OutboxRelayResult.EventOutcome::eventId)
|
||||
.containsExactlyInAnyOrder(firstId, secondId);
|
||||
}
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// FIFO gate blocking scenarios (plan Task E)
|
||||
//
|
||||
// Three scenarios prove the strict FIFO gate on real PostgreSQL:
|
||||
//
|
||||
// (a) head FAILED with future next_attempt_at → relay claims NOTHING for that
|
||||
// aggregate (tail blocked even though tail is PENDING-due).
|
||||
// (b) after head is marked PUBLISHED → next relay cycle claims the tail (unblock).
|
||||
// (c) head DEAD → tail remains blocked (strict FIFO; unblock is runbook action).
|
||||
// =========================================================================
|
||||
|
||||
@Test
|
||||
void fifoGateBlocksTailWhileHeadIsFailedWithFutureBackoff() {
|
||||
// Use t0 as both the insert time and relay "now".
|
||||
Instant t0 = Instant.now();
|
||||
Clock clock = Clock.fixed(t0, ZoneOffset.UTC);
|
||||
|
||||
try (AnnotationConfigApplicationContext ctx =
|
||||
OutboxContainerTestSupport.buildContext(
|
||||
sharedDataSource,
|
||||
e -> {
|
||||
throw new RuntimeException("forced failure for head");
|
||||
},
|
||||
clock)) {
|
||||
|
||||
TransactionPort tx = ctx.getBean(TransactionPort.class);
|
||||
LegacyOutboxAppendPort append = ctx.getBean(LegacyOutboxAppendPort.class);
|
||||
OutboxStoreAdapter store = ctx.getBean(OutboxStoreAdapter.class);
|
||||
|
||||
String aggId = "agg-fifo-blocked-" + System.nanoTime();
|
||||
String headId = "fifo-blocked-head-" + System.nanoTime();
|
||||
String tailId = "fifo-blocked-tail-" + System.nanoTime();
|
||||
|
||||
// Insert both rows. Both nextAttemptAt = t0 <= t0 (relay now).
|
||||
tx.inWrite(
|
||||
() -> {
|
||||
append.append(newEventAt(headId, aggId, t0));
|
||||
append.append(newEventAt(tailId, aggId, t0.plusMillis(1)));
|
||||
return null;
|
||||
});
|
||||
|
||||
// Relay cycle 1: head is claimed and fails → transitions to FAILED
|
||||
// with nextAttemptAt = t0 + backoff (far in the future).
|
||||
// Tail is already blocked by the FIFO gate (head is PENDING).
|
||||
PublishPendingOutboxEventsUseCase relay = OutboxContainerTestSupport.relayUseCase(ctx);
|
||||
OutboxRelayResult cycle1 = relay.handle(PublishPendingOutboxEventsCommand.INSTANCE);
|
||||
|
||||
assertThat(
|
||||
cycle1.outcomes().stream()
|
||||
.filter(o -> o.eventId().equals(headId))
|
||||
.findFirst()
|
||||
.map(OutboxRelayResult.EventOutcome::outcome)
|
||||
.orElse(null))
|
||||
.as("cycle 1: head must be FAILED")
|
||||
.isEqualTo(OutboxRelayResult.Outcome.FAILED);
|
||||
|
||||
// Verify DB: head is FAILED with a future next_attempt_at.
|
||||
Map<OutboxEventStatus, Long> afterCycle1 = store.countByStatus();
|
||||
assertThat(afterCycle1.getOrDefault(OutboxEventStatus.FAILED, 0L))
|
||||
.as("head must be FAILED in store after cycle 1")
|
||||
.isGreaterThanOrEqualTo(1L);
|
||||
|
||||
// Relay cycle 2 (same clock t0): head's next_attempt_at is in the future.
|
||||
// The head is FAILED but not yet eligible (next_attempt_at > now = t0).
|
||||
// The tail is PENDING-due (next_attempt_at = t0+1ms <= t0? No — but the
|
||||
// FIFO gate blocks it regardless because the head is a non-PUBLISHED earlier
|
||||
// sibling). Either way, nothing for this aggregate is claimed.
|
||||
OutboxRelayResult cycle2 = relay.handle(PublishPendingOutboxEventsCommand.INSTANCE);
|
||||
|
||||
long tailInCycle2 =
|
||||
cycle2.outcomes().stream().filter(o -> o.eventId().equals(tailId)).count();
|
||||
assertThat(tailInCycle2)
|
||||
.as("cycle 2: tail must NOT be claimed — blocked by FIFO gate (head is FAILED)")
|
||||
.isZero();
|
||||
|
||||
long headInCycle2 =
|
||||
cycle2.outcomes().stream().filter(o -> o.eventId().equals(headId)).count();
|
||||
assertThat(headInCycle2)
|
||||
.as("cycle 2: head must NOT be claimed — backoff not yet elapsed")
|
||||
.isZero();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void fifoGateUnblocksTailAfterHeadIsPublished() {
|
||||
Instant t0 = Instant.now();
|
||||
// Clock at t0+1s so both head (nextAttemptAt=t0) and tail (nextAttemptAt=t0+1ms)
|
||||
// satisfy next_attempt_at <= now in both relay cycles.
|
||||
Clock clock = Clock.fixed(t0.plusSeconds(1), ZoneOffset.UTC);
|
||||
|
||||
try (AnnotationConfigApplicationContext ctx =
|
||||
OutboxContainerTestSupport.buildContext(sharedDataSource, e -> {}, clock)) {
|
||||
|
||||
TransactionPort tx = ctx.getBean(TransactionPort.class);
|
||||
LegacyOutboxAppendPort append = ctx.getBean(LegacyOutboxAppendPort.class);
|
||||
OutboxStoreAdapter store = ctx.getBean(OutboxStoreAdapter.class);
|
||||
|
||||
String aggId = "agg-fifo-unblock-" + System.nanoTime();
|
||||
String headId = "fifo-unblock-head-" + System.nanoTime();
|
||||
String tailId = "fifo-unblock-tail-" + System.nanoTime();
|
||||
|
||||
// Insert head (OCCURRED_AT=t0) and tail (OCCURRED_AT=t0+1ms).
|
||||
tx.inWrite(
|
||||
() -> {
|
||||
append.append(newEventAt(headId, aggId, t0));
|
||||
append.append(newEventAt(tailId, aggId, t0.plusMillis(1)));
|
||||
return null;
|
||||
});
|
||||
|
||||
PublishPendingOutboxEventsUseCase relay = OutboxContainerTestSupport.relayUseCase(ctx);
|
||||
|
||||
// Cycle 1: head is claimed and published, tail is blocked.
|
||||
OutboxRelayResult cycle1 = relay.handle(PublishPendingOutboxEventsCommand.INSTANCE);
|
||||
assertThat(
|
||||
cycle1.outcomes().stream()
|
||||
.filter(
|
||||
o ->
|
||||
o.eventId().equals(headId)
|
||||
&& o.outcome() == OutboxRelayResult.Outcome.PUBLISHED)
|
||||
.count())
|
||||
.as("cycle 1: head must be PUBLISHED")
|
||||
.isEqualTo(1L);
|
||||
assertThat(cycle1.outcomes().stream().filter(o -> o.eventId().equals(tailId)).count())
|
||||
.as("cycle 1: tail must NOT appear (blocked)")
|
||||
.isZero();
|
||||
|
||||
// Verify DB: head is PUBLISHED.
|
||||
Map<OutboxEventStatus, Long> afterCycle1 = store.countByStatus();
|
||||
assertThat(afterCycle1.getOrDefault(OutboxEventStatus.PUBLISHED, 0L))
|
||||
.as("at least one PUBLISHED row after cycle 1")
|
||||
.isGreaterThanOrEqualTo(1L);
|
||||
|
||||
// Cycle 2: head is now PUBLISHED → NOT EXISTS gate passes for tail.
|
||||
OutboxRelayResult cycle2 = relay.handle(PublishPendingOutboxEventsCommand.INSTANCE);
|
||||
assertThat(
|
||||
cycle2.outcomes().stream()
|
||||
.filter(
|
||||
o ->
|
||||
o.eventId().equals(tailId)
|
||||
&& o.outcome() == OutboxRelayResult.Outcome.PUBLISHED)
|
||||
.count())
|
||||
.as("cycle 2: tail must be PUBLISHED after head is PUBLISHED")
|
||||
.isEqualTo(1L);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void fifoGateBlocksTailPermanentlyWhileHeadIsDead() {
|
||||
// head DEAD → tail is blocked (strict FIFO; DEAD is not PUBLISHED).
|
||||
// Unblocking a DEAD head is a runbook manual action, not an automated path.
|
||||
Instant t0 = Instant.now();
|
||||
|
||||
try (AnnotationConfigApplicationContext ctx =
|
||||
OutboxContainerTestSupport.buildContext(
|
||||
sharedDataSource,
|
||||
e -> {
|
||||
throw new RuntimeException("always fails");
|
||||
},
|
||||
Clock.fixed(t0, ZoneOffset.UTC))) {
|
||||
|
||||
TransactionPort tx = ctx.getBean(TransactionPort.class);
|
||||
LegacyOutboxAppendPort append = ctx.getBean(LegacyOutboxAppendPort.class);
|
||||
OutboxStoreAdapter store = ctx.getBean(OutboxStoreAdapter.class);
|
||||
|
||||
String aggId = "agg-fifo-dead-" + System.nanoTime();
|
||||
String headId = "fifo-dead-head-" + System.nanoTime();
|
||||
String tailId = "fifo-dead-tail-" + System.nanoTime();
|
||||
|
||||
// Insert head at t0 and tail at t0+1ms.
|
||||
tx.inWrite(
|
||||
() -> {
|
||||
append.append(newEventAt(headId, aggId, t0));
|
||||
append.append(newEventAt(tailId, aggId, t0.plusMillis(1)));
|
||||
return null;
|
||||
});
|
||||
|
||||
// Drive head to DEAD in 3 relay cycles, each advanced 2h to expire backoff.
|
||||
OutboxRelayResult r1 =
|
||||
buildRelayWithClock(ctx, t0).handle(PublishPendingOutboxEventsCommand.INSTANCE);
|
||||
assertThat(r1.outcomes()).anyMatch(o -> o.eventId().equals(headId));
|
||||
|
||||
OutboxRelayResult r2 =
|
||||
buildRelayWithClock(ctx, t0.plus(Duration.ofHours(2)))
|
||||
.handle(PublishPendingOutboxEventsCommand.INSTANCE);
|
||||
assertThat(r2.outcomes()).anyMatch(o -> o.eventId().equals(headId));
|
||||
|
||||
OutboxRelayResult r3 =
|
||||
buildRelayWithClock(ctx, t0.plus(Duration.ofHours(4)))
|
||||
.handle(PublishPendingOutboxEventsCommand.INSTANCE);
|
||||
long deadInR3 =
|
||||
r3.outcomes().stream()
|
||||
.filter(
|
||||
o -> o.eventId().equals(headId) && o.outcome() == OutboxRelayResult.Outcome.DEAD)
|
||||
.count();
|
||||
assertThat(deadInR3).as("head must reach DEAD after 3 attempts").isEqualTo(1L);
|
||||
|
||||
// Verify head is DEAD in DB.
|
||||
Map<OutboxEventStatus, Long> afterDead = store.countByStatus();
|
||||
assertThat(afterDead.getOrDefault(OutboxEventStatus.DEAD, 0L))
|
||||
.as("DEAD count must be >= 1")
|
||||
.isGreaterThanOrEqualTo(1L);
|
||||
|
||||
// Relay cycle post-DEAD: head is DEAD (not PUBLISHED) → NOT EXISTS gate
|
||||
// returns true (earlier sibling exists with status <> 'PUBLISHED') →
|
||||
// tail remains blocked.
|
||||
// Use a clock well into the future so any eligible FAILED row would be
|
||||
// re-claimable; but since head is DEAD (not retried), only tail would
|
||||
// potentially be claimed — and it must not be.
|
||||
OutboxRelayResult r4 =
|
||||
buildRelayWithClock(ctx, t0.plus(Duration.ofHours(6)))
|
||||
.handle(PublishPendingOutboxEventsCommand.INSTANCE);
|
||||
|
||||
long tailInR4 = r4.outcomes().stream().filter(o -> o.eventId().equals(tailId)).count();
|
||||
assertThat(tailInR4)
|
||||
.as("tail must remain BLOCKED while head is DEAD (strict FIFO gate)")
|
||||
.isZero();
|
||||
}
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// IN_FLIGHT orphan re-claim after timeout
|
||||
// =========================================================================
|
||||
|
||||
@Test
|
||||
void inFlightOrphanIsReclaimedAfterTimeoutExpires() {
|
||||
// Set clock to now; insert row and claim it (it will be IN_FLIGHT with
|
||||
// next_attempt_at = now + inFlightTimeout). Then advance clock past the
|
||||
// timeout and verify it can be re-claimed.
|
||||
Instant t0 = Instant.now();
|
||||
Clock claimClock = Clock.fixed(t0, ZoneOffset.UTC);
|
||||
// Advance past inFlightTimeout (30s used in integration test support)
|
||||
Clock reclaimClock = Clock.fixed(t0.plus(Duration.ofSeconds(31)), ZoneOffset.UTC);
|
||||
|
||||
try (AnnotationConfigApplicationContext ctx =
|
||||
OutboxContainerTestSupport.buildContext(sharedDataSource, e -> {}, claimClock)) {
|
||||
|
||||
TransactionPort tx = ctx.getBean(TransactionPort.class);
|
||||
LegacyOutboxAppendPort append = ctx.getBean(LegacyOutboxAppendPort.class);
|
||||
OutboxStoreAdapter store = ctx.getBean(OutboxStoreAdapter.class);
|
||||
|
||||
String eventId = "lifecycle-orphan-" + System.nanoTime();
|
||||
tx.inWrite(
|
||||
() -> {
|
||||
append.append(newEvent(eventId, "agg-orphan-" + eventId, claimClock));
|
||||
return null;
|
||||
});
|
||||
|
||||
// Claim the row but do NOT mark it published (simulates relay crash)
|
||||
tx.inWrite(() -> store.claimBatch(1, t0, Duration.ofSeconds(30)));
|
||||
|
||||
// Verify it's now IN_FLIGHT
|
||||
Map<OutboxEventStatus, Long> afterClaim = store.countByStatus();
|
||||
assertThat(afterClaim.getOrDefault(OutboxEventStatus.IN_FLIGHT, 0L))
|
||||
.as("row must be IN_FLIGHT after claim")
|
||||
.isGreaterThanOrEqualTo(1);
|
||||
|
||||
// Build a new relay use case with the advanced clock so the orphan is re-eligible
|
||||
PublishPendingOutboxEventsUseCase reclaimRelay =
|
||||
new PublishPendingOutboxEventsUseCase(
|
||||
store,
|
||||
event -> {},
|
||||
ignored -> {},
|
||||
ctx.getBean(TransactionPort.class),
|
||||
new OutboxBackoffPolicy(RandomGenerator.getDefault()),
|
||||
reclaimClock,
|
||||
OutboxContainerTestSupport.BATCH_SIZE_CONTRACT,
|
||||
OutboxContainerTestSupport.IN_FLIGHT_TIMEOUT);
|
||||
|
||||
OutboxRelayResult reclaimResult =
|
||||
reclaimRelay.handle(PublishPendingOutboxEventsCommand.INSTANCE);
|
||||
|
||||
long reclaimed =
|
||||
reclaimResult.outcomes().stream().filter(o -> o.eventId().equals(eventId)).count();
|
||||
assertThat(reclaimed)
|
||||
.as("orphaned IN_FLIGHT row must be re-claimed after timeout")
|
||||
.isEqualTo(1);
|
||||
}
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// Reaper TTL deletion
|
||||
// =========================================================================
|
||||
|
||||
@Test
|
||||
void reaperDeletesPublishedRowsOlderThanRetention() {
|
||||
// Insert + publish a row, then run the reaper with a very short retention
|
||||
// (1 second) and a clock advanced past the cutoff.
|
||||
Instant eventTime = Instant.now().minus(Duration.ofSeconds(10));
|
||||
Clock clock = Clock.fixed(Instant.now(), ZoneOffset.UTC);
|
||||
|
||||
try (AnnotationConfigApplicationContext ctx =
|
||||
OutboxContainerTestSupport.buildContext(sharedDataSource, e -> {}, clock)) {
|
||||
|
||||
TransactionPort tx = ctx.getBean(TransactionPort.class);
|
||||
LegacyOutboxAppendPort append = ctx.getBean(LegacyOutboxAppendPort.class);
|
||||
OutboxStoreAdapter store = ctx.getBean(OutboxStoreAdapter.class);
|
||||
|
||||
String eventId = "lifecycle-reap-" + System.nanoTime();
|
||||
String aggId = "agg-reap-" + eventId;
|
||||
|
||||
tx.inWrite(
|
||||
() -> {
|
||||
append.append(newEventAt(eventId, aggId, eventTime));
|
||||
return null;
|
||||
});
|
||||
|
||||
// Claim and mark as PUBLISHED
|
||||
List<ClaimedOutboxEvent> claimed =
|
||||
tx.inWrite(() -> store.claimBatch(1, eventTime, Duration.ofSeconds(1)));
|
||||
assertThat(claimed).hasSize(1);
|
||||
tx.inWrite(
|
||||
() -> {
|
||||
store.markPublished(eventId);
|
||||
return null;
|
||||
});
|
||||
|
||||
// Verify it's PUBLISHED
|
||||
Map<OutboxEventStatus, Long> before = store.countByStatus();
|
||||
assertThat(before.getOrDefault(OutboxEventStatus.PUBLISHED, 0L))
|
||||
.as("row must be PUBLISHED before reaper runs")
|
||||
.isGreaterThanOrEqualTo(1);
|
||||
|
||||
// Run reaper with short retention (1s) and a clock well past the cutoff.
|
||||
// OutboxReaper.reap() uses @Transactional which only works as a Spring proxy.
|
||||
// When constructed manually, wrap the delete in a write transaction instead.
|
||||
OutboxEventJpaRepository repo = ctx.getBean(OutboxEventJpaRepository.class);
|
||||
OutboxReaper reaper =
|
||||
new OutboxReaper(
|
||||
repo, clock, Duration.ofSeconds(1)); // retention = 1s; eventTime was 10s ago
|
||||
|
||||
// @Transactional is not active on a manually-constructed bean; run within tx.
|
||||
int purged = tx.inWrite(() -> reaper.reap());
|
||||
assertThat(purged)
|
||||
.as("reaper must delete at least the PUBLISHED row inserted 10s ago")
|
||||
.isGreaterThanOrEqualTo(1);
|
||||
}
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// helpers
|
||||
// =========================================================================
|
||||
|
||||
/**
|
||||
* Builds a relay use case that uses the given clock instant, but gets its store and transaction
|
||||
* port from the existing context.
|
||||
*/
|
||||
private static PublishPendingOutboxEventsUseCase buildRelayWithClock(
|
||||
AnnotationConfigApplicationContext ctx, Instant clockInstant) {
|
||||
return new PublishPendingOutboxEventsUseCase(
|
||||
ctx.getBean(OutboxStoreAdapter.class),
|
||||
ctx.getBean(OutboxMessagePublishPort.class),
|
||||
ignored -> {},
|
||||
ctx.getBean(TransactionPort.class),
|
||||
new OutboxBackoffPolicy(RandomGenerator.getDefault()),
|
||||
Clock.fixed(clockInstant, ZoneOffset.UTC),
|
||||
OutboxContainerTestSupport.BATCH_SIZE_CONTRACT,
|
||||
OutboxContainerTestSupport.IN_FLIGHT_TIMEOUT);
|
||||
}
|
||||
|
||||
private static NewOutboxEvent newEvent(String eventId, String aggregateId, Clock clock) {
|
||||
return newEventAt(eventId, aggregateId, clock.instant());
|
||||
}
|
||||
|
||||
private static NewOutboxEvent newEventAt(String eventId, String aggregateId, Instant occurredAt) {
|
||||
return new NewOutboxEvent(
|
||||
eventId,
|
||||
"TestEvent",
|
||||
aggregateId,
|
||||
"{\"test\":true}",
|
||||
occurredAt,
|
||||
"corr-" + eventId,
|
||||
eventId);
|
||||
}
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
/**
|
||||
* Outbox integration tests — Testcontainers-backed real-PostgreSQL outbox contract verification.
|
||||
*
|
||||
* <p>Tests in this package require a running Docker daemon. They verify the outbox event lifecycle
|
||||
* (PENDING → IN_FLIGHT → PUBLISHED / FAILED / DEAD), transactional append guarantees,
|
||||
* leader-election relay behavior (SKIP LOCKED), and reaper TTL deletion against a real PostgreSQL
|
||||
* instance.
|
||||
*
|
||||
* <p>Test Level Matrix: {@code integration} — all tests here depend on {@code org.testcontainers..}
|
||||
* (see parent package-info for the taxonomy rule that classifies Testcontainers usage at this
|
||||
* level).
|
||||
*
|
||||
* <p>Support class: {@link dev.caskeleton.bootstrap.integration.outbox.OutboxContainerTestSupport}
|
||||
* — shared Testcontainers + Spring context bootstrap for the outbox integration tests.
|
||||
*/
|
||||
package dev.caskeleton.bootstrap.integration.outbox;
|
||||
+7
-10
@@ -1,15 +1,12 @@
|
||||
/**
|
||||
* Integration test level — Testcontainers-backed real-service tests.
|
||||
* Composition-root integration level.
|
||||
*
|
||||
* <p>Tests in this package require a running Docker daemon. They boot real external services
|
||||
* (PostgreSQL via Testcontainers) and exercise cross-layer behaviors (DDL → persistence adapter →
|
||||
* application port) that cannot be verified with in-memory fakes.
|
||||
* <p>Tests here may start real required providers, but they do not own provider semantics. Those
|
||||
* contracts belong to the adapter leaves. This source set proves that production composition joins
|
||||
* the already-qualified application, adapter, persistence, and transport boundaries correctly.
|
||||
*
|
||||
* <p>Test Level Matrix: {@code integration} — tests here depend on {@code org.testcontainers..} and
|
||||
* are intentionally classified at the integration level by the ArchUnit rule {@code
|
||||
* CONTRACT_AND_ARCHITECTURE_TESTS_DO_NOT_DEPEND_ON_TESTCONTAINERS}
|
||||
* (feature-test-taxonomy-fixture-contract §테스트 계약 #4 / D3). Unit-level and contract-level tests
|
||||
* must NOT depend on Testcontainers; such tests belong in their respective packages under {@code
|
||||
* dev.caskeleton.bootstrap.contract} or {@code dev.caskeleton.bootstrap.architecture}.
|
||||
* <p>Docker/provider absence is a failure for this required lane, not an approved skip.
|
||||
* Deterministic bean/settings composition remains under {@code src/test}; packaged-candidate
|
||||
* journeys belong to {@code systemTest}.
|
||||
*/
|
||||
package dev.caskeleton.bootstrap.integration;
|
||||
|
||||
@@ -59,20 +59,12 @@ import org.springframework.context.annotation.FilterType;
|
||||
basePackages = {
|
||||
"dev.caskeleton.bootstrap.async",
|
||||
"dev.caskeleton.bootstrap.autoconfigure.fileserver",
|
||||
"dev.caskeleton.bootstrap.autoconfigure.httpclient",
|
||||
"dev.caskeleton.bootstrap.concurrency",
|
||||
"dev.caskeleton.bootstrap.autoconfigure.idempotency",
|
||||
"dev.caskeleton.bootstrap.autoconfigure.outbox",
|
||||
"dev.caskeleton.bootstrap.autoconfigure.redis",
|
||||
"dev.caskeleton.bootstrap.runtime",
|
||||
"dev.caskeleton.bootstrap.security",
|
||||
"dev.caskeleton.bootstrap.settings",
|
||||
"dev.caskeleton.bootstrap.autoconfigure.tracing",
|
||||
"dev.caskeleton.adapter.inbound.grpc",
|
||||
"dev.caskeleton.adapter.inbound.web",
|
||||
"dev.caskeleton.adapter.inbound.websocket",
|
||||
"dev.caskeleton.adapter.outbound.cache.redis",
|
||||
"dev.caskeleton.adapter.outbound.fileserver",
|
||||
"dev.caskeleton.adapter.outbound.objectstorage",
|
||||
"dev.caskeleton.application",
|
||||
"dev.caskeleton.domain",
|
||||
@@ -101,6 +93,7 @@ public class CaSkeletonApplication {
|
||||
"dev\\.caskeleton\\.bootstrap\\.autoconfigure\\..*"
|
||||
+ "|dev\\.caskeleton\\.bootstrap\\.notification\\..*"
|
||||
+ "|dev\\.caskeleton\\.adapter\\.inbound\\.web\\.fileserver\\.admin\\..*"
|
||||
+ "|dev\\.caskeleton\\.adapter\\.outbound\\.httpclient\\.autoconfigure\\..*"
|
||||
+ "|dev\\.caskeleton\\.adapter\\.outbound\\.mongo\\..*"
|
||||
+ "|dev\\.caskeleton\\.adapter\\.outbound\\.messaging\\..*"
|
||||
+ "|dev\\.caskeleton\\.adapter\\.outbound\\.notification\\..*"
|
||||
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
package dev.caskeleton.bootstrap.activation;
|
||||
|
||||
import dev.caskeleton.bootstrap.autoconfigure.jpa.DataSourceRequirement;
|
||||
import dev.caskeleton.bootstrap.runtime.RuntimeProfileSnapshot;
|
||||
import dev.caskeleton.shared.activation.MasterSwitch;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
@@ -42,9 +43,9 @@ public class AdapterActivationEndpoint {
|
||||
masterSwitch.property(),
|
||||
"true".equalsIgnoreCase(environment.getProperty(masterSwitch.property(), "false")));
|
||||
}
|
||||
String[] active = environment.getActiveProfiles();
|
||||
var profiles = RuntimeProfileSnapshot.from(environment).activeProfiles();
|
||||
return new AdapterActivationReport(
|
||||
active.length == 0 ? "" : active[0],
|
||||
profiles.isEmpty() ? "" : profiles.get(0),
|
||||
switches,
|
||||
DataSourceRequirement.reasons(environment),
|
||||
resolvedVendor());
|
||||
|
||||
+1
-11
@@ -1,8 +1,6 @@
|
||||
package dev.caskeleton.bootstrap.activation;
|
||||
|
||||
import dev.caskeleton.bootstrap.runtime.startup.StartupFailures;
|
||||
import dev.caskeleton.bootstrap.runtime.startup.StartupOrder;
|
||||
import java.util.List;
|
||||
import org.springframework.boot.EnvironmentPostProcessor;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.core.Ordered;
|
||||
@@ -42,15 +40,7 @@ public class CapabilityDependencyEnvironmentValidator implements EnvironmentPost
|
||||
@Override
|
||||
public void postProcessEnvironment(
|
||||
ConfigurableEnvironment environment, SpringApplication application) {
|
||||
List<String> violations = CapabilityDependencyValidator.violations(environment);
|
||||
if (violations.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
throw StartupFailures.requiredAdapterDisabled(
|
||||
"This deployment enables capabilities whose dependencies are off:"
|
||||
+ System.lineSeparator()
|
||||
+ String.join(
|
||||
System.lineSeparator(), violations.stream().map(v -> " - " + v).toList()));
|
||||
CapabilityDependencyValidator.requireSatisfied(environment);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-11
@@ -1,7 +1,5 @@
|
||||
package dev.caskeleton.bootstrap.activation;
|
||||
|
||||
import dev.caskeleton.bootstrap.runtime.startup.StartupFailures;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
@@ -24,14 +22,6 @@ public class CapabilityDependencyStartupCheck implements InitializingBean {
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
List<String> violations = CapabilityDependencyValidator.violations(environment);
|
||||
if (violations.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
throw StartupFailures.requiredAdapterDisabled(
|
||||
"This deployment enables capabilities whose dependencies are off:"
|
||||
+ System.lineSeparator()
|
||||
+ String.join(
|
||||
System.lineSeparator(), violations.stream().map(v -> " - " + v).toList()));
|
||||
CapabilityDependencyValidator.requireSatisfied(environment);
|
||||
}
|
||||
}
|
||||
|
||||
+77
-43
@@ -1,7 +1,10 @@
|
||||
package dev.caskeleton.bootstrap.activation;
|
||||
|
||||
import dev.caskeleton.bootstrap.runtime.RuntimeProfileSnapshot;
|
||||
import dev.caskeleton.bootstrap.runtime.startup.StartupPhase;
|
||||
import dev.caskeleton.bootstrap.runtime.startup.StartupValidationContext;
|
||||
import dev.caskeleton.shared.activation.MasterSwitch;
|
||||
import java.util.ArrayList;
|
||||
import dev.caskeleton.shared.runtime.RuntimeEnvironment;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
@@ -24,11 +27,11 @@ import org.springframework.core.env.Environment;
|
||||
public final class CapabilityDependencyValidator {
|
||||
|
||||
/** Which GraphQL deployment modes each runtime environment permits. */
|
||||
private static final Map<String, Set<String>> PERMITTED_GRAPHQL_MODES =
|
||||
private static final Map<RuntimeEnvironment, Set<String>> PERMITTED_GRAPHQL_MODES =
|
||||
Map.of(
|
||||
"local", Set.of("LOCAL"),
|
||||
"dev", Set.of("DEV"),
|
||||
"prod", Set.of("PRODUCTION_INTERNAL", "PRODUCTION_PUBLIC"));
|
||||
RuntimeEnvironment.LOCAL, Set.of("LOCAL"),
|
||||
RuntimeEnvironment.DEV, Set.of("DEV"),
|
||||
RuntimeEnvironment.PROD, Set.of("PRODUCTION_INTERNAL", "PRODUCTION_PUBLIC"));
|
||||
|
||||
private CapabilityDependencyValidator() {}
|
||||
|
||||
@@ -39,7 +42,8 @@ public final class CapabilityDependencyValidator {
|
||||
* @return the violations; empty when the active capability graph is consistent
|
||||
*/
|
||||
public static List<String> violations(Environment environment) {
|
||||
List<String> violations = new ArrayList<>();
|
||||
StartupValidationContext violations =
|
||||
StartupValidationContext.forPhase(StartupPhase.ADAPTER_ENABLEMENT);
|
||||
|
||||
boolean jpa = isOn(environment, MasterSwitch.PERSISTENCE_JPA.property());
|
||||
boolean mongo = isOn(environment, MasterSwitch.PERSISTENCE_MONGO.property());
|
||||
@@ -51,40 +55,42 @@ public final class CapabilityDependencyValidator {
|
||||
String broker = environment.getProperty("app.messaging.broker", "").trim();
|
||||
|
||||
if (outbox && !jpa) {
|
||||
violations.add(
|
||||
violations.reject(
|
||||
"ca-skeleton.outbox.enabled=true needs relational persistence to store rows; set "
|
||||
+ MasterSwitch.PERSISTENCE_JPA.property()
|
||||
+ "=true or turn the outbox off.");
|
||||
}
|
||||
if (outbox && !messaging) {
|
||||
violations.add(
|
||||
violations.reject(
|
||||
"ca-skeleton.outbox.enabled=true needs somewhere to publish; set "
|
||||
+ MasterSwitch.MESSAGING.property()
|
||||
+ "=true or turn the outbox off.");
|
||||
}
|
||||
if (relay && !outbox) {
|
||||
violations.add(
|
||||
violations.reject(
|
||||
"ca-skeleton.outbox.relay-enabled=true only starts the scheduler for a capability that is "
|
||||
+ "off; set ca-skeleton.outbox.enabled=true or turn the relay off.");
|
||||
}
|
||||
if (messaging && broker.isEmpty()) {
|
||||
violations.add(
|
||||
violations.reject(
|
||||
"app.messaging.enabled=true needs a transport; set app.messaging.broker to a registered "
|
||||
+ "broker id.");
|
||||
}
|
||||
if ("jdbc"
|
||||
.equalsIgnoreCase(
|
||||
environment.getProperty(
|
||||
"ca-skeleton.capabilities.idempotency.provider", "disabled"))
|
||||
String idempotencyProvider =
|
||||
environment.getProperty("ca-skeleton.capabilities.idempotency.provider", "disabled").trim();
|
||||
if (("jdbc".equalsIgnoreCase(idempotencyProvider)
|
||||
|| "postgresql".equalsIgnoreCase(idempotencyProvider))
|
||||
&& !jpa) {
|
||||
violations.add(
|
||||
"ca-skeleton.capabilities.idempotency.provider=jdbc needs a database; set "
|
||||
violations.reject(
|
||||
"ca-skeleton.capabilities.idempotency.provider="
|
||||
+ idempotencyProvider
|
||||
+ " needs relational persistence; set "
|
||||
+ MasterSwitch.PERSISTENCE_JPA.property()
|
||||
+ "=true or choose another provider.");
|
||||
}
|
||||
if (isOn(environment, "ca-skeleton.lock.multi-instance-enabled") && !jpa) {
|
||||
violations.add(
|
||||
"ca-skeleton.lock.multi-instance-enabled=true needs a database for the lock registry; set "
|
||||
if (isOn(environment, "ca-skeleton.runtime.multi-instance-enabled") && !jpa) {
|
||||
violations.reject(
|
||||
"ca-skeleton.runtime.multi-instance-enabled=true needs a database for the lock registry; set "
|
||||
+ MasterSwitch.PERSISTENCE_JPA.property()
|
||||
+ "=true or turn multi-instance locking off.");
|
||||
}
|
||||
@@ -93,27 +99,56 @@ public final class CapabilityDependencyValidator {
|
||||
.equalsIgnoreCase(
|
||||
environment.getProperty("ca-skeleton.notification.platform.persistence", "jpa"))
|
||||
&& !jpa) {
|
||||
violations.add(
|
||||
violations.reject(
|
||||
MasterSwitch.NOTIFICATION_PLATFORM.property()
|
||||
+ "=true stores requests relationally, and no other store is implemented; set "
|
||||
+ MasterSwitch.PERSISTENCE_JPA.property()
|
||||
+ "=true.");
|
||||
}
|
||||
if (mongo
|
||||
&& environment
|
||||
.getProperty(
|
||||
MasterSwitch.PERSISTENCE_MONGO.property().replace(".enabled", ".active-profile"),
|
||||
"")
|
||||
.isBlank()) {
|
||||
violations.add(
|
||||
MasterSwitch.PERSISTENCE_MONGO.property()
|
||||
+ "=true needs exactly one profile; set "
|
||||
+ "ca-skeleton.persistence-mongo.active-profile.");
|
||||
if (mongo) {
|
||||
String activeMongoProfile =
|
||||
environment
|
||||
.getProperty(
|
||||
MasterSwitch.PERSISTENCE_MONGO.property().replace(".enabled", ".active-profile"),
|
||||
"")
|
||||
.trim();
|
||||
if (activeMongoProfile.isBlank()) {
|
||||
violations.reject(
|
||||
MasterSwitch.PERSISTENCE_MONGO.property()
|
||||
+ "=true needs exactly one profile; set "
|
||||
+ "ca-skeleton.persistence-mongo.active-profile.");
|
||||
} else {
|
||||
String standardUri = environment.getProperty("spring.mongodb.uri", "").trim();
|
||||
String profileSecretProperty =
|
||||
"ca-skeleton.persistence-mongo.platform.profiles." + activeMongoProfile + ".uri-secret";
|
||||
String profileSecret = environment.getProperty(profileSecretProperty, "").trim();
|
||||
if (standardUri.isBlank() && profileSecret.isBlank()) {
|
||||
violations.reject(
|
||||
MasterSwitch.PERSISTENCE_MONGO.property()
|
||||
+ "=true has no explicit MongoDB connection source; set spring.mongodb.uri "
|
||||
+ "(SPRING_MONGODB_URI) or "
|
||||
+ profileSecretProperty
|
||||
+ ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (graphQl) {
|
||||
violations.addAll(graphQlModeViolations(environment));
|
||||
violations.rejectAll(graphQlModeViolations(environment));
|
||||
}
|
||||
return List.copyOf(violations);
|
||||
return violations.violations();
|
||||
}
|
||||
|
||||
/**
|
||||
* Rejects the deployment when any capability dependency is unsatisfied.
|
||||
*
|
||||
* <p>Both the EnvironmentPostProcessor path and the bean fallback delegate here, so phase,
|
||||
* aggregation and operator-facing failure formatting cannot drift between startup entry points.
|
||||
*/
|
||||
public static void requireSatisfied(Environment environment) {
|
||||
StartupValidationContext violations =
|
||||
StartupValidationContext.forPhase(StartupPhase.ADAPTER_ENABLEMENT)
|
||||
.rejectAll(violations(environment));
|
||||
violations.failIfViolated("This deployment enables capabilities whose dependencies are off");
|
||||
}
|
||||
|
||||
private static List<String> graphQlModeViolations(Environment environment) {
|
||||
@@ -124,20 +159,24 @@ public final class CapabilityDependencyValidator {
|
||||
+ "=true needs an explicit safety posture; set backend.graphql.deployment-mode to one "
|
||||
+ "of LOCAL, DEV, PRODUCTION_INTERNAL, PRODUCTION_PUBLIC.");
|
||||
}
|
||||
String runtime = activeRuntimeEnvironment(environment);
|
||||
Set<String> permitted = PERMITTED_GRAPHQL_MODES.get(runtime);
|
||||
if (permitted == null) {
|
||||
RuntimeProfileSnapshot profiles = RuntimeProfileSnapshot.from(environment);
|
||||
List<String> activeProfiles = profiles.activeProfiles();
|
||||
RuntimeEnvironment runtime = profiles.resolve().orElse(null);
|
||||
if (runtime == null) {
|
||||
return List.of(
|
||||
"backend.graphql.deployment-mode cannot be checked because the runtime environment '"
|
||||
+ runtime
|
||||
+ "' is not one of local, dev, prod.");
|
||||
+ String.join(",", activeProfiles)
|
||||
+ "' is not one of "
|
||||
+ RuntimeEnvironment.deployableProfileNames()
|
||||
+ ".");
|
||||
}
|
||||
Set<String> permitted = PERMITTED_GRAPHQL_MODES.get(runtime);
|
||||
if (!permitted.contains(mode.toUpperCase(Locale.ROOT))) {
|
||||
return List.of(
|
||||
"backend.graphql.deployment-mode="
|
||||
+ mode
|
||||
+ " is not permitted in the "
|
||||
+ runtime
|
||||
+ runtime.profileName()
|
||||
+ " runtime; permitted here: "
|
||||
+ permitted.stream().sorted().toList()
|
||||
+ ".");
|
||||
@@ -145,11 +184,6 @@ public final class CapabilityDependencyValidator {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
private static String activeRuntimeEnvironment(Environment environment) {
|
||||
String[] active = environment.getActiveProfiles();
|
||||
return active.length == 0 ? "" : active[0];
|
||||
}
|
||||
|
||||
private static boolean isOn(Environment environment, String property) {
|
||||
return "true".equalsIgnoreCase(environment.getProperty(property, "false"));
|
||||
}
|
||||
|
||||
+6
-4
@@ -1,5 +1,6 @@
|
||||
package dev.caskeleton.bootstrap.activation;
|
||||
|
||||
import dev.caskeleton.bootstrap.runtime.RuntimeProfileSnapshot;
|
||||
import dev.caskeleton.bootstrap.runtime.startup.StartupFailures;
|
||||
import dev.caskeleton.bootstrap.runtime.startup.StartupOrder;
|
||||
import dev.caskeleton.shared.runtime.RuntimeEnvironment;
|
||||
@@ -17,7 +18,7 @@ import org.springframework.core.env.ConfigurableEnvironment;
|
||||
* meant an in-memory database that loses every write on restart. The failure had no symptom until
|
||||
* the data was already gone.
|
||||
*
|
||||
* <p>Feature selection is not expressed here. That is what the five master switches are for, and a
|
||||
* <p>Feature selection is not expressed here. That is what the registered master switches are for, and a
|
||||
* supplementary profile used as a feature flag is how a profile list stops being a statement about
|
||||
* where the application is running.
|
||||
*
|
||||
@@ -42,9 +43,10 @@ public class RuntimeEnvironmentProfileValidator implements EnvironmentPostProces
|
||||
if (!isDeployableArtifact(application)) {
|
||||
return;
|
||||
}
|
||||
List<String> active = List.of(environment.getActiveProfiles());
|
||||
RuntimeProfileSnapshot profiles = RuntimeProfileSnapshot.from(environment);
|
||||
List<String> active = profiles.activeProfiles();
|
||||
|
||||
if (RuntimeEnvironment.isTestContext(active)) {
|
||||
if (profiles.isTestContext()) {
|
||||
return;
|
||||
}
|
||||
if (active.isEmpty()) {
|
||||
@@ -54,7 +56,7 @@ public class RuntimeEnvironmentProfileValidator implements EnvironmentPostProces
|
||||
+ "; there is no default, because a profile that is guessed is a deployment nobody "
|
||||
+ "chose.");
|
||||
}
|
||||
List<RuntimeEnvironment> environments = RuntimeEnvironment.activeIn(active);
|
||||
List<RuntimeEnvironment> environments = profiles.environments();
|
||||
if (environments.size() > 1) {
|
||||
throw StartupFailures.envValidation(
|
||||
"SPRING_PROFILES_ACTIVE names more than one environment "
|
||||
|
||||
-83
@@ -1,83 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure;
|
||||
|
||||
import dev.caskeleton.bootstrap.runtime.startup.StartupFailures;
|
||||
import java.util.function.Predicate;
|
||||
import org.springframework.boot.context.properties.bind.BindHandler;
|
||||
import org.springframework.boot.context.properties.bind.Bindable;
|
||||
import org.springframework.boot.context.properties.bind.Binder;
|
||||
import org.springframework.boot.context.properties.bind.handler.NoUnboundElementsBindHandler;
|
||||
import org.springframework.boot.context.properties.source.ConfigurationPropertySource;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
/**
|
||||
* Binds a capability's settings strictly, and only when the capability is switched on.
|
||||
*
|
||||
* <p>Two properties matter and neither is available from a scanned {@code @ConfigurationProperties}
|
||||
* class.
|
||||
*
|
||||
* <p>First, timing. A binder runs inside its master-gated auto-configuration, so a deployment that
|
||||
* never enables a capability never binds one of its settings — a malformed {@code Duration} in a
|
||||
* block nobody switched on cannot fail that deployment's startup.
|
||||
*
|
||||
* <p>Second, strictness. Unknown keys under the prefix are refused rather than ignored. Silently
|
||||
* dropping {@code app.fileserver-platform.uplaod.max-file-size} is how a deployment ends up running
|
||||
* the default limit while its configuration file says otherwise, and discovering that from a
|
||||
* production incident is the whole failure mode this prevents.
|
||||
*
|
||||
* <h2>Why this is shared</h2>
|
||||
*
|
||||
* <p>The Fileserver and HTTP client platforms each had their own copy of this — same handler, same
|
||||
* {@code Binder.get(...).bind(PREFIX, Bindable.of(T), strict)}, same {@code orElseThrow}, differing
|
||||
* only in which prefix they named and in one word of the failure message (BOOT-011). The one real
|
||||
* difference between them is which property sources the unbound-element check applies to, so that
|
||||
* is the parameter, and everything else is here once.
|
||||
*/
|
||||
public final class StrictSettingsBinder {
|
||||
|
||||
private StrictSettingsBinder() {}
|
||||
|
||||
/**
|
||||
* Binds the prefix strictly against every property source.
|
||||
*
|
||||
* @param environment the environment to bind from
|
||||
* @param prefix the settings prefix
|
||||
* @param type the settings type
|
||||
* @param <T> the settings type
|
||||
* @return the bound settings
|
||||
*/
|
||||
public static <T> T bind(Environment environment, String prefix, Class<T> type) {
|
||||
return bind(environment, prefix, type, source -> true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Binds the prefix strictly, checking unbound elements only in the sources the filter accepts.
|
||||
*
|
||||
* <p>The filter exists for one real case rather than as generality for its own sake. Spring
|
||||
* enumerates {@code APP_HTTPCLIENT_CLIENTS_0_BASE_URL} from the system environment as {@code
|
||||
* ...clients[0].base.url} while binding it as {@code ...clients[0].base-url}, so leaving the
|
||||
* system environment to {@link NoUnboundElementsBindHandler} would reject every correctly spelled
|
||||
* variable and still miss the misspelled ones. A caller that excludes it here is expected to
|
||||
* check that source by another route.
|
||||
*
|
||||
* @param environment the environment to bind from
|
||||
* @param prefix the settings prefix
|
||||
* @param type the settings type
|
||||
* @param unboundCheckScope which property sources the unbound-element check applies to
|
||||
* @param <T> the settings type
|
||||
* @return the bound settings
|
||||
*/
|
||||
public static <T> T bind(
|
||||
Environment environment,
|
||||
String prefix,
|
||||
Class<T> type,
|
||||
Predicate<ConfigurationPropertySource> unboundCheckScope) {
|
||||
BindHandler strict =
|
||||
new NoUnboundElementsBindHandler(BindHandler.DEFAULT, unboundCheckScope::test);
|
||||
return Binder.get(environment)
|
||||
.bind(prefix, Bindable.of(type), strict)
|
||||
.orElseThrow(
|
||||
() ->
|
||||
StartupFailures.envValidation(
|
||||
prefix + " could not be bound although the capability is enabled"));
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.common;
|
||||
|
||||
import java.time.Clock;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
/**
|
||||
* Application-wide wall-clock composition.
|
||||
*
|
||||
* <p>Clock is infrastructure shared by persistence, outbox, fileserver, notification, Redis and
|
||||
* other capabilities. It must therefore exist independently of whether any optional capability is
|
||||
* enabled. Adopters may replace it with their own bean; the shipped default is UTC.
|
||||
*/
|
||||
@AutoConfiguration(
|
||||
beforeName =
|
||||
"dev.caskeleton.adapter.inbound.graphql.autoconfigure.GraphQlRootAutoConfiguration")
|
||||
public class BootstrapClockAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(Clock.class)
|
||||
Clock applicationClock() {
|
||||
return Clock.systemUTC();
|
||||
}
|
||||
}
|
||||
+17
-2
@@ -1,5 +1,7 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.fileserver;
|
||||
|
||||
import static net.logstash.logback.argument.StructuredArguments.kv;
|
||||
|
||||
import dev.caskeleton.application.fileserver.cleanup.CleanupBatchResult;
|
||||
import dev.caskeleton.application.fileserver.cleanup.CleanupService;
|
||||
import org.slf4j.Logger;
|
||||
@@ -52,10 +54,23 @@ public class FileserverCleanupWorker {
|
||||
result.skippedActiveLease(),
|
||||
result.skippedStateChanged(),
|
||||
result.failed(),
|
||||
result.reclaimedBytes());
|
||||
result.reclaimedBytes(),
|
||||
kv("capability", "fileserver"),
|
||||
kv("operation", "cleanup"),
|
||||
kv("cleanup.deleted", result.deleted()),
|
||||
kv("cleanup.skipped_active_lease", result.skippedActiveLease()),
|
||||
kv("cleanup.skipped_state_changed", result.skippedStateChanged()),
|
||||
kv("cleanup.failed", result.failed()),
|
||||
kv("cleanup.reclaimed_bytes", result.reclaimedBytes()));
|
||||
}
|
||||
} catch (RuntimeException failure) {
|
||||
LOG.warn("fileserver.cleanup batch failed; the next run retries the same queue", failure);
|
||||
LOG.warn(
|
||||
"fileserver.cleanup batch failed; the next run retries the same queue",
|
||||
kv("capability", "fileserver"),
|
||||
kv("operation", "cleanup"),
|
||||
kv("warning.kind", "scheduled-task-failed"),
|
||||
kv("retry.disposition", "next-run"),
|
||||
failure);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.fileserver;
|
||||
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.config.FileserverWebProperties;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.config.TransferExecutorProperties;
|
||||
import dev.caskeleton.application.fileserver.api.StorageNamespace;
|
||||
import dev.caskeleton.application.fileserver.upload.UploadPolicy;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
class FileserverCorePolicyConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
FileserverWebProperties fileserverWebProperties(FileserverPlatformSettings properties) {
|
||||
return new FileserverWebProperties(
|
||||
StorageNamespace.of(properties.defaultNamespace()),
|
||||
properties.upload().ttl(),
|
||||
properties.upload().maxParts(),
|
||||
properties.upload().requireContentLength());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
TransferExecutorProperties fileserverTransferExecutorProperties(
|
||||
FileserverPlatformSettings properties) {
|
||||
return new TransferExecutorProperties(
|
||||
properties.transfer().coreSize(),
|
||||
properties.transfer().maxSize(),
|
||||
properties.transfer().queueCapacity(),
|
||||
properties.transfer().awaitSeconds());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
UploadPolicy fileserverUploadPolicy(FileserverPlatformSettings properties) {
|
||||
return new UploadPolicy(
|
||||
properties.upload().maxFileSize().toBytes(),
|
||||
properties.upload().initialReservation().toBytes(),
|
||||
properties.upload().reservationTtl(),
|
||||
properties.upload().leaseDuration());
|
||||
}
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.fileserver;
|
||||
|
||||
import dev.caskeleton.application.fileserver.api.metadata.FileMetadataStore;
|
||||
import dev.caskeleton.application.fileserver.api.security.FileAccessPolicy;
|
||||
import dev.caskeleton.application.fileserver.api.security.OriginalFilenamePolicy;
|
||||
import dev.caskeleton.application.fileserver.cleanup.CleanupQueue;
|
||||
import dev.caskeleton.application.fileserver.download.DefaultDownloadApplicationService;
|
||||
import dev.caskeleton.application.fileserver.download.DownloadApplicationService;
|
||||
import dev.caskeleton.application.fileserver.download.DownloadContentGateway;
|
||||
import dev.caskeleton.application.fileserver.download.ZeroCopyDownloadGateway;
|
||||
import dev.caskeleton.application.fileserver.lifecycle.CopyContentGateway;
|
||||
import dev.caskeleton.application.fileserver.lifecycle.DefaultFileLifecycleService;
|
||||
import dev.caskeleton.application.fileserver.lifecycle.FileLifecycleService;
|
||||
import dev.caskeleton.application.fileserver.observability.FileserverMetricsPort;
|
||||
import dev.caskeleton.application.fileserver.upload.UploadIdentifierFactory;
|
||||
import dev.caskeleton.application.transaction.TransactionPort;
|
||||
import java.time.Clock;
|
||||
import java.util.Optional;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
class FileserverDownloadLifecycleConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
DownloadApplicationService fileserverDownloadService(
|
||||
FileMetadataStore metadataStore,
|
||||
DownloadContentGateway contentGateway,
|
||||
FileAccessPolicy accessPolicy,
|
||||
ZeroCopyDownloadGateway zeroCopyGateway,
|
||||
ObjectProvider<FileserverMetricsPort> metrics) {
|
||||
return new DefaultDownloadApplicationService(
|
||||
metadataStore,
|
||||
contentGateway,
|
||||
accessPolicy,
|
||||
Optional.of(zeroCopyGateway),
|
||||
FileserverMetricsSupport.metricsOrNoop(metrics));
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
FileLifecycleService fileserverLifecycleService(
|
||||
FileMetadataStore metadataStore,
|
||||
CopyContentGateway copyGateway,
|
||||
FileAccessPolicy accessPolicy,
|
||||
OriginalFilenamePolicy filenamePolicy,
|
||||
CleanupQueue cleanupQueue,
|
||||
UploadIdentifierFactory identifierFactory,
|
||||
TransactionPort transactions,
|
||||
Clock clock) {
|
||||
return new DefaultFileLifecycleService(
|
||||
metadataStore,
|
||||
copyGateway,
|
||||
accessPolicy,
|
||||
filenamePolicy,
|
||||
cleanupQueue,
|
||||
identifierFactory,
|
||||
transactions,
|
||||
clock);
|
||||
}
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.fileserver;
|
||||
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.http.DefaultHttpRangeResolver;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.http.HttpContentDispositionFactory;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.http.HttpDownloadPlanner;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.http.HttpDownloadPolicy;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.http.HttpRangePolicy;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.http.HttpRangeResolver;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.http.MvcConditionalRequestFactory;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.http.MvcDownloadResponseWriter;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.http.ZeroCopyEligibility;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/** HTTP-only download policy and rendering helpers. */
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
class FileserverHttpDownloadConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
MvcConditionalRequestFactory fileserverConditionalRequestFactory() {
|
||||
return new MvcConditionalRequestFactory();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
HttpRangeResolver fileserverHttpRangeResolver() {
|
||||
return new DefaultHttpRangeResolver();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
HttpContentDispositionFactory fileserverHttpContentDispositionFactory() {
|
||||
return new HttpContentDispositionFactory();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
HttpDownloadPolicy fileserverHttpDownloadPolicy(FileserverPlatformSettings properties) {
|
||||
HttpRangePolicy rangePolicy =
|
||||
properties.download().maxRanges() <= 1
|
||||
? HttpRangePolicy.single(properties.download().maxRangeBytes().toBytes())
|
||||
: HttpRangePolicy.multi(
|
||||
properties.download().maxRanges(), properties.download().maxRangeBytes().toBytes());
|
||||
return new HttpDownloadPolicy(
|
||||
rangePolicy, properties.download().cacheControl(), properties.download().inlineAllowed());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
HttpDownloadPlanner fileserverHttpDownloadPlanner(
|
||||
HttpRangeResolver rangeResolver,
|
||||
HttpContentDispositionFactory dispositionFactory,
|
||||
HttpDownloadPolicy policy) {
|
||||
return new HttpDownloadPlanner(rangeResolver, dispositionFactory, policy);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
MvcDownloadResponseWriter fileserverDownloadResponseWriter() {
|
||||
return new MvcDownloadResponseWriter();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
ZeroCopyEligibility fileserverZeroCopyEligibility(FileserverPlatformSettings properties) {
|
||||
return new ZeroCopyEligibility(
|
||||
properties.download().zeroCopyEnabled(),
|
||||
properties.download().zeroCopyMinimumBytes().toBytes());
|
||||
}
|
||||
}
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.fileserver;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalBlockingContentStore;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalStorageCapabilityProbe;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalStorageProbeResult;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalStorageProperties;
|
||||
import dev.caskeleton.adapter.outbound.persistence.fileserver.FileserverSchemaActivation;
|
||||
import dev.caskeleton.application.fileserver.api.content.PublishMode;
|
||||
import dev.caskeleton.bootstrap.runtime.startup.StartupFailures;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Locale;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.jdbc.core.JdbcOperations;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
class FileserverLocalStorageCoreConfiguration {
|
||||
|
||||
/**
|
||||
* The three storage invariants are pinned, not configured.
|
||||
*
|
||||
* <p>Staging and content on one file store, a refusal to follow symbolic links, and a force
|
||||
* before publish are what make an atomic publish atomic and a namespace a boundary. A deployment
|
||||
* that could switch them off would be running a different capability under the same name and the
|
||||
* same tests, so they are constants here rather than settings.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
LocalStorageProperties fileserverStorageProperties(FileserverPlatformSettings settings) {
|
||||
FileserverPlatformSettings.Storage storage = settings.storage();
|
||||
requireStorageRootIsIsolated(storage);
|
||||
return new LocalStorageProperties(
|
||||
storage.root(),
|
||||
publishMode(storage.publishMode()),
|
||||
true,
|
||||
true,
|
||||
(int) storage.bufferSize().toBytes(),
|
||||
settings.upload().maxFileSize().toBytes(),
|
||||
true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refuses to start until the Fileserver schema stream is applied and promoted.
|
||||
*
|
||||
* <p>Paired with the storage probe below: one proves the volume can hold the bytes, the other
|
||||
* proves the database sanctions the records. A capability that starts with either unproven fails
|
||||
* on a user's first upload instead of on the deployment that caused it.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnBean(JdbcOperations.class)
|
||||
FileserverSchemaActivation fileserverSchemaActivation(JdbcOperations jdbc) {
|
||||
FileserverSchemaActivation activation = new FileserverSchemaActivation(jdbc);
|
||||
activation.requireActive();
|
||||
return activation;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
LocalStorageProbeResult fileserverStorageProbeResult(LocalStorageProperties properties) {
|
||||
LocalStorageProbeResult result = new LocalStorageCapabilityProbe(properties).run();
|
||||
if (!result.mandatoryChecksPassed()) {
|
||||
throw StartupFailures.envValidation(
|
||||
"fileserver storage root failed a mandatory capability probe: "
|
||||
+ result.failures()
|
||||
+ "; the capability refuses to start rather than publish files it cannot place "
|
||||
+ "atomically");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
LocalBlockingContentStore fileserverContentStore(
|
||||
LocalStorageProperties properties, LocalStorageProbeResult probeResult) {
|
||||
return new LocalBlockingContentStore(properties, probeResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refuses a storage root that overlaps something the process already serves or reads.
|
||||
*
|
||||
* <p>A root under a web root turns every upload into a published file; a root under a
|
||||
* configuration directory turns one into a configuration change. Both are checked here because
|
||||
* the path is only known once, at binding time.
|
||||
*/
|
||||
private static void requireStorageRootIsIsolated(FileserverPlatformSettings.Storage storage) {
|
||||
Path root = storage.root().toAbsolutePath().normalize();
|
||||
for (Path forbidden : storage.forbiddenRootAncestors()) {
|
||||
Path ancestor = forbidden.toAbsolutePath().normalize();
|
||||
if (root.startsWith(ancestor)) {
|
||||
throw StartupFailures.envValidation(
|
||||
"fileserver storage root must not live under a configured forbidden ancestor");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static PublishMode publishMode(String configured) {
|
||||
String canonical = configured.trim().toUpperCase(Locale.ROOT).replace('-', '_');
|
||||
try {
|
||||
return PublishMode.valueOf(canonical);
|
||||
} catch (IllegalArgumentException unknown) {
|
||||
throw StartupFailures.envValidation(
|
||||
FileserverPlatformSettings.PREFIX
|
||||
+ ".storage.publish-mode must be one of atomic-move-required, "
|
||||
+ "atomic-move-preferred, metadata-pointer",
|
||||
unknown);
|
||||
}
|
||||
}
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.fileserver;
|
||||
|
||||
import dev.caskeleton.application.fileserver.admin.AdminAuditPort;
|
||||
import dev.caskeleton.application.fileserver.admin.DefaultFileserverAdminService;
|
||||
import dev.caskeleton.application.fileserver.admin.FileserverAdminService;
|
||||
import dev.caskeleton.application.fileserver.admin.OrphanScanPort;
|
||||
import dev.caskeleton.application.fileserver.admin.StorageHealthPort;
|
||||
import dev.caskeleton.application.fileserver.api.metadata.FileMetadataStore;
|
||||
import dev.caskeleton.application.fileserver.api.metadata.UploadSessionStore;
|
||||
import dev.caskeleton.application.fileserver.api.security.FileAccessPolicy;
|
||||
import dev.caskeleton.application.fileserver.cleanup.CleanupContentGateway;
|
||||
import dev.caskeleton.application.fileserver.cleanup.CleanupQueue;
|
||||
import dev.caskeleton.application.fileserver.cleanup.CleanupService;
|
||||
import dev.caskeleton.application.fileserver.cleanup.DefaultCleanupService;
|
||||
import dev.caskeleton.application.fileserver.cleanup.QuotaReclaimGateway;
|
||||
import dev.caskeleton.application.fileserver.observability.FileserverMetricsPort;
|
||||
import dev.caskeleton.application.fileserver.observability.SafeFileFingerprint;
|
||||
import dev.caskeleton.application.fileserver.recovery.DefaultFileReconciliationService;
|
||||
import dev.caskeleton.application.fileserver.recovery.FileReconciliationService;
|
||||
import dev.caskeleton.application.fileserver.recovery.ReconciliationContentProbe;
|
||||
import dev.caskeleton.application.fileserver.recovery.RecoveryQueue;
|
||||
import dev.caskeleton.application.transaction.TransactionPort;
|
||||
import java.time.Clock;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
class FileserverMaintenanceServiceConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
CleanupService fileserverCleanupService(
|
||||
CleanupQueue queue,
|
||||
CleanupContentGateway contentGateway,
|
||||
FileMetadataStore metadataStore,
|
||||
UploadSessionStore sessionStore,
|
||||
QuotaReclaimGateway quotaGateway,
|
||||
FileserverPlatformSettings settings,
|
||||
ObjectProvider<FileserverMetricsPort> metrics,
|
||||
TransactionPort transactions,
|
||||
Clock clock) {
|
||||
return new DefaultCleanupService(
|
||||
queue,
|
||||
contentGateway,
|
||||
metadataStore,
|
||||
sessionStore,
|
||||
quotaGateway,
|
||||
settings.cleanup().retryBackoff(),
|
||||
FileserverMetricsSupport.metricsOrNoop(metrics),
|
||||
transactions,
|
||||
clock);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
FileReconciliationService fileserverReconciliationService(
|
||||
FileMetadataStore metadataStore,
|
||||
ReconciliationContentProbe contentProbe,
|
||||
RecoveryQueue recoveryQueue,
|
||||
TransactionPort transactions,
|
||||
Clock clock) {
|
||||
return new DefaultFileReconciliationService(
|
||||
metadataStore, contentProbe, recoveryQueue, transactions, clock);
|
||||
}
|
||||
|
||||
/**
|
||||
* The management plane, gated on its own switch.
|
||||
*
|
||||
* <p>Admin is a separate decision from the data plane: a deployment that serves files does not
|
||||
* automatically want an endpoint that can force-delete them.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnProperty(
|
||||
prefix = "app.fileserver-platform.admin",
|
||||
name = "enabled",
|
||||
havingValue = "true")
|
||||
FileserverAdminService fileserverAdminService(
|
||||
StorageHealthPort healthPort,
|
||||
OrphanScanPort orphanScanPort,
|
||||
FileMetadataStore metadataStore,
|
||||
UploadSessionStore sessionStore,
|
||||
CleanupQueue cleanupQueue,
|
||||
CleanupService cleanupService,
|
||||
FileAccessPolicy accessPolicy,
|
||||
AdminAuditPort auditPort,
|
||||
SafeFileFingerprint fingerprint,
|
||||
TransactionPort transactions,
|
||||
Clock clock) {
|
||||
return new DefaultFileserverAdminService(
|
||||
healthPort,
|
||||
orphanScanPort,
|
||||
metadataStore,
|
||||
sessionStore,
|
||||
cleanupQueue,
|
||||
cleanupService,
|
||||
accessPolicy,
|
||||
auditPort,
|
||||
fingerprint,
|
||||
transactions,
|
||||
clock);
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.fileserver;
|
||||
|
||||
import dev.caskeleton.application.fileserver.observability.FileserverMetricsPort;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
|
||||
/** Shared optional-metrics selection for Fileserver application-service assembly. */
|
||||
final class FileserverMetricsSupport {
|
||||
|
||||
private FileserverMetricsSupport() {}
|
||||
|
||||
/**
|
||||
* Instrumentation is optional; the services are not.
|
||||
*
|
||||
* <p>Metrics can be switched off, and when they are there is no {@code FileserverMetricsPort}
|
||||
* bean. Injecting it directly would make every service depend on telemetry being enabled, so the
|
||||
* no-op stands in — which is also what stops the ports from being dead code the way they were
|
||||
* when nothing called them at all.
|
||||
*/
|
||||
static FileserverMetricsPort metricsOrNoop(ObjectProvider<FileserverMetricsPort> metrics) {
|
||||
return metrics.getIfAvailable(FileserverMetricsPort::noop);
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.fileserver;
|
||||
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.nginx.DefaultNginxInternalUriMapper;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.nginx.NginxDelegationProperties;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.nginx.NginxDownloadStrategy;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.nginx.NginxInternalUriMapper;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
class FileserverNginxConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
NginxDelegationProperties fileserverNginxDelegationProperties(
|
||||
FileserverPlatformSettings properties) {
|
||||
return new NginxDelegationProperties(
|
||||
properties.nginx().enabled(),
|
||||
properties.nginx().internalPrefix(),
|
||||
properties.nginx().objectSuffix(),
|
||||
properties.nginx().minimumSize().toBytes());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
NginxInternalUriMapper fileserverNginxInternalUriMapper(NginxDelegationProperties properties) {
|
||||
return new DefaultNginxInternalUriMapper(properties);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
NginxDownloadStrategy fileserverNginxDownloadStrategy(
|
||||
NginxDelegationProperties properties, NginxInternalUriMapper uriMapper) {
|
||||
return new NginxDownloadStrategy(properties, uriMapper);
|
||||
}
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.fileserver;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.observability.MicrometerFileserverMetrics;
|
||||
import dev.caskeleton.application.fileserver.observability.FileserverMetricsPort;
|
||||
import dev.caskeleton.application.fileserver.observability.SafeFileFingerprint;
|
||||
import dev.caskeleton.bootstrap.runtime.startup.StartupFailures;
|
||||
import io.micrometer.core.instrument.MeterRegistry;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
class FileserverObservabilityConfiguration {
|
||||
|
||||
/**
|
||||
* Telemetry fingerprinting.
|
||||
*
|
||||
* <p>Absent a configured key the capability is not silently downgraded to an unkeyed hash — which
|
||||
* would be reversible for an enumerable identifier space. The key is required, and startup fails
|
||||
* without one — but only when something actually consumes a fingerprint. There are two such
|
||||
* consumers, telemetry and the management-plane audit trail, so the bean exists when either is on
|
||||
* rather than being tied to metrics alone: an audit trail that pseudonymised its actors with an
|
||||
* unkeyed 32-bit hash was the reason this had to be widened.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@Conditional(FileserverFingerprintConsumerCondition.class)
|
||||
SafeFileFingerprint fileserverFingerprint(FileserverPlatformSettings properties) {
|
||||
String key = properties.observability().fingerprintKey();
|
||||
if (key == null || key.isBlank()) {
|
||||
throw StartupFailures.envValidation(
|
||||
FileserverPlatformSettings.PREFIX
|
||||
+ ".observability.fingerprint-key must be configured while metrics are enabled: an "
|
||||
+ "unkeyed digest of an enumerable identifier is reversible");
|
||||
}
|
||||
return new SafeFileFingerprint(key.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnProperty(
|
||||
prefix = FileserverPlatformSettings.PREFIX + ".observability",
|
||||
name = "metrics-enabled",
|
||||
havingValue = "true",
|
||||
matchIfMissing = true)
|
||||
FileserverMetricsPort fileserverMetrics(MeterRegistry registry) {
|
||||
return new MicrometerFileserverMetrics(registry);
|
||||
}
|
||||
}
|
||||
+9
-280
@@ -1,64 +1,17 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.fileserver;
|
||||
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.config.FileserverWebProperties;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.config.TransferExecutorProperties;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.draft12.Draft12Properties;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.http.MvcConditionalRequestFactory;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.http.MvcDownloadResponseWriter;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.http.ZeroCopyEligibility;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.mapper.MultipartUploadRequestMapper;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.mapper.RawUploadRequestMapper;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.nginx.DefaultNginxInternalUriMapper;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.nginx.NginxDelegationProperties;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.nginx.NginxDownloadStrategy;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.nginx.NginxInternalUriMapper;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.problem.FileserverProblemFactory;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.security.FileserverRequestContextFactory;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.tus.TusChecksumVerifier;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.tus.TusProperties;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.tus.TusRequestParser;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.observability.MicrometerFileserverMetrics;
|
||||
import dev.caskeleton.application.fileserver.api.StorageNamespace;
|
||||
import dev.caskeleton.application.fileserver.api.transfer.ConditionalRequestEvaluator;
|
||||
import dev.caskeleton.application.fileserver.api.transfer.ContentDispositionFactory;
|
||||
import dev.caskeleton.application.fileserver.api.transfer.DefaultConditionalRequestEvaluator;
|
||||
import dev.caskeleton.application.fileserver.api.transfer.DefaultHttpRangeResolver;
|
||||
import dev.caskeleton.application.fileserver.api.transfer.HttpRangeResolver;
|
||||
import dev.caskeleton.application.fileserver.api.transfer.RangeBudget;
|
||||
import dev.caskeleton.application.fileserver.download.DownloadPolicy;
|
||||
import dev.caskeleton.application.fileserver.observability.FileserverMetricsPort;
|
||||
import dev.caskeleton.application.fileserver.observability.SafeFileFingerprint;
|
||||
import dev.caskeleton.application.fileserver.upload.UploadPolicy;
|
||||
import dev.caskeleton.bootstrap.runtime.startup.StartupFailures;
|
||||
import io.micrometer.core.instrument.MeterRegistry;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
/**
|
||||
* The one entry point through which the HTTP Fileserver platform exists at all.
|
||||
* Master-gated Fileserver platform entry point.
|
||||
*
|
||||
* <p>This is an auto-configuration rather than a component-scanned {@code @Configuration}, and it
|
||||
* lives in a package the composition root's scan explicitly excludes. That is the whole point: when
|
||||
* the master switch is absent or false, the class is never processed, so none of the configurations
|
||||
* it imports are discovered either. The previous shape — child configurations sitting inside the
|
||||
* scanned package — meant the storage probe, the authorization policy, and the service graph were
|
||||
* assembled whatever the master switch said, which is not an optional capability but a mandatory
|
||||
* one with a switch that only controlled its controllers.
|
||||
*
|
||||
* <p>Consequently every sub-feature switch is evaluated inside a graph that already requires the
|
||||
* master switch. Turning on the admin plane, tus, the experimental draft, or the cleanup worker in
|
||||
* a deployment that never enabled the Fileserver now does nothing at all, rather than half-building
|
||||
* a bean graph that fails on its first missing collaborator.
|
||||
*
|
||||
* <p>The policy objects are built here rather than read inside the application layer, which is what
|
||||
* keeps that layer free of configuration types.
|
||||
* <p>This class owns only activation and strict settings binding. Concern-specific assembly stays
|
||||
* in package-private child configurations reachable exclusively through this gated root.
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnProperty(
|
||||
@@ -66,6 +19,12 @@ import org.springframework.core.env.Environment;
|
||||
name = "enabled",
|
||||
havingValue = "true")
|
||||
@Import({
|
||||
FileserverCorePolicyConfiguration.class,
|
||||
FileserverWebAssemblyConfiguration.class,
|
||||
FileserverHttpDownloadConfiguration.class,
|
||||
FileserverNginxConfiguration.class,
|
||||
FileserverProtocolConfiguration.class,
|
||||
FileserverObservabilityConfiguration.class,
|
||||
FileserverStorageConfiguration.class,
|
||||
FileserverSecurityConfiguration.class,
|
||||
FileserverServiceConfiguration.class,
|
||||
@@ -87,234 +46,4 @@ public class FileserverPlatformAutoConfiguration {
|
||||
FileserverPlatformSettings fileserverPlatformSettings(Environment environment) {
|
||||
return FileserverPlatformSettingsBinder.bind(environment);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
FileserverWebProperties fileserverWebProperties(FileserverPlatformSettings properties) {
|
||||
return new FileserverWebProperties(
|
||||
StorageNamespace.of(properties.defaultNamespace()),
|
||||
properties.upload().ttl(),
|
||||
properties.upload().maxParts(),
|
||||
properties.upload().requireContentLength());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
TransferExecutorProperties fileserverTransferExecutorProperties(
|
||||
FileserverPlatformSettings properties) {
|
||||
return new TransferExecutorProperties(
|
||||
properties.transfer().coreSize(),
|
||||
properties.transfer().maxSize(),
|
||||
properties.transfer().queueCapacity(),
|
||||
properties.transfer().awaitSeconds());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
UploadPolicy fileserverUploadPolicy(FileserverPlatformSettings properties) {
|
||||
return new UploadPolicy(
|
||||
properties.upload().maxFileSize().toBytes(),
|
||||
properties.upload().initialReservation().toBytes(),
|
||||
properties.upload().reservationTtl(),
|
||||
properties.upload().leaseDuration());
|
||||
}
|
||||
|
||||
/**
|
||||
* Range budget.
|
||||
*
|
||||
* <p>The byte ceiling applies to the single-range profile too. Treating {@code max-ranges=1} as
|
||||
* "unbounded bytes" made {@code max-range-bytes} silently inert in the default configuration —
|
||||
* the one almost every deployment runs — so the setting described a limit nobody had.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
DownloadPolicy fileserverDownloadPolicy(FileserverPlatformSettings properties) {
|
||||
RangeBudget budget =
|
||||
properties.download().maxRanges() <= 1
|
||||
? RangeBudget.single(properties.download().maxRangeBytes().toBytes())
|
||||
: RangeBudget.multi(
|
||||
properties.download().maxRanges(), properties.download().maxRangeBytes().toBytes());
|
||||
return new DownloadPolicy(
|
||||
budget, properties.download().cacheControl(), properties.download().inlineAllowed());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
HttpRangeResolver fileserverRangeResolver() {
|
||||
return new DefaultHttpRangeResolver();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
ConditionalRequestEvaluator fileserverConditionalEvaluator(HttpRangeResolver rangeResolver) {
|
||||
return new DefaultConditionalRequestEvaluator(rangeResolver);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
ContentDispositionFactory fileserverContentDispositionFactory() {
|
||||
return new ContentDispositionFactory();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
FileserverRequestContextFactory fileserverRequestContextFactory(
|
||||
FileserverPlatformSettings properties) {
|
||||
return new FileserverRequestContextFactory(properties.instanceId());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
FileserverProblemFactory fileserverProblemFactory() {
|
||||
return new FileserverProblemFactory();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
RawUploadRequestMapper fileserverRawUploadRequestMapper(FileserverPlatformSettings properties) {
|
||||
return new RawUploadRequestMapper(properties.upload().requireContentLength());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
MultipartUploadRequestMapper fileserverMultipartUploadRequestMapper() {
|
||||
return new MultipartUploadRequestMapper();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
MvcConditionalRequestFactory fileserverConditionalRequestFactory() {
|
||||
return new MvcConditionalRequestFactory();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
MvcDownloadResponseWriter fileserverDownloadResponseWriter() {
|
||||
return new MvcDownloadResponseWriter();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
ZeroCopyEligibility fileserverZeroCopyEligibility(FileserverPlatformSettings properties) {
|
||||
return new ZeroCopyEligibility(
|
||||
properties.download().zeroCopyEnabled(),
|
||||
properties.download().zeroCopyMinimumBytes().toBytes());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
NginxDelegationProperties fileserverNginxDelegationProperties(
|
||||
FileserverPlatformSettings properties) {
|
||||
return new NginxDelegationProperties(
|
||||
properties.nginx().enabled(),
|
||||
properties.nginx().internalPrefix(),
|
||||
properties.nginx().objectSuffix(),
|
||||
properties.nginx().minimumSize().toBytes());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
NginxInternalUriMapper fileserverNginxInternalUriMapper(NginxDelegationProperties properties) {
|
||||
return new DefaultNginxInternalUriMapper(properties);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
NginxDownloadStrategy fileserverNginxDownloadStrategy(
|
||||
NginxDelegationProperties properties, NginxInternalUriMapper uriMapper) {
|
||||
return new NginxDownloadStrategy(properties, uriMapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* tus support objects, contributed only when both this switch and the master switch are on.
|
||||
*
|
||||
* <p>The nesting is the fix: previously the protocol's own flag was the only condition, so
|
||||
* enabling tus in a deployment with the Fileserver off produced a controller with no service
|
||||
* behind it.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnProperty(
|
||||
prefix = FileserverPlatformSettings.PREFIX + ".tus",
|
||||
name = "enabled",
|
||||
havingValue = "true")
|
||||
TusProperties fileserverTusProperties(FileserverPlatformSettings properties) {
|
||||
return new TusProperties(
|
||||
TusProperties.RESUMABLE_VERSION,
|
||||
List.of("creation", "expiration", "checksum", "termination"),
|
||||
properties.upload().maxFileSize().toBytes(),
|
||||
properties.upload().ttl());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnProperty(
|
||||
prefix = FileserverPlatformSettings.PREFIX + ".tus",
|
||||
name = "enabled",
|
||||
havingValue = "true")
|
||||
TusRequestParser fileserverTusRequestParser(TusProperties tusProperties) {
|
||||
return new TusRequestParser(tusProperties);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnProperty(
|
||||
prefix = FileserverPlatformSettings.PREFIX + ".tus",
|
||||
name = "enabled",
|
||||
havingValue = "true")
|
||||
TusChecksumVerifier fileserverTusChecksumVerifier() {
|
||||
return new TusChecksumVerifier();
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings for the experimental draft, which previously had no production binding at all.
|
||||
*
|
||||
* <p>The controller existed and could be switched on, but nothing built the properties it needs,
|
||||
* so the switch produced a startup failure rather than a protocol.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnProperty(
|
||||
prefix = FileserverPlatformSettings.PREFIX + ".httpbis-draft12",
|
||||
name = "enabled",
|
||||
havingValue = "true")
|
||||
Draft12Properties fileserverDraft12Properties(FileserverPlatformSettings properties) {
|
||||
return new Draft12Properties(
|
||||
true, properties.upload().maxFileSize().toBytes(), properties.upload().ttl(), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Telemetry fingerprinting.
|
||||
*
|
||||
* <p>Absent a configured key the capability is not silently downgraded to an unkeyed hash — which
|
||||
* would be reversible for an enumerable identifier space. The key is required, and startup fails
|
||||
* without one — but only when something actually consumes a fingerprint. There are two such
|
||||
* consumers, telemetry and the management-plane audit trail, so the bean exists when either is on
|
||||
* rather than being tied to metrics alone: an audit trail that pseudonymised its actors with an
|
||||
* unkeyed 32-bit hash was the reason this had to be widened.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@Conditional(FileserverFingerprintConsumerCondition.class)
|
||||
SafeFileFingerprint fileserverFingerprint(FileserverPlatformSettings properties) {
|
||||
String key = properties.observability().fingerprintKey();
|
||||
if (key == null || key.isBlank()) {
|
||||
throw StartupFailures.envValidation(
|
||||
FileserverPlatformSettings.PREFIX
|
||||
+ ".observability.fingerprint-key must be configured while metrics are enabled: an "
|
||||
+ "unkeyed digest of an enumerable identifier is reversible");
|
||||
}
|
||||
return new SafeFileFingerprint(key.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnProperty(
|
||||
prefix = FileserverPlatformSettings.PREFIX + ".observability",
|
||||
name = "metrics-enabled",
|
||||
havingValue = "true",
|
||||
matchIfMissing = true)
|
||||
FileserverMetricsPort fileserverMetrics(MeterRegistry registry) {
|
||||
return new MicrometerFileserverMetrics(registry);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.fileserver;
|
||||
|
||||
import dev.caskeleton.bootstrap.autoconfigure.StrictSettingsBinder;
|
||||
import dev.caskeleton.adapter.outbound.support.StrictSettingsBinder;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
/**
|
||||
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.fileserver;
|
||||
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.draft12.Draft12Properties;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.tus.TusChecksumVerifier;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.tus.TusProperties;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.tus.TusRequestParser;
|
||||
import java.util.List;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
class FileserverProtocolConfiguration {
|
||||
|
||||
/**
|
||||
* tus support objects, contributed only when both this switch and the master switch are on.
|
||||
*
|
||||
* <p>The nesting is the fix: previously the protocol's own flag was the only condition, so
|
||||
* enabling tus in a deployment with the Fileserver off produced a controller with no service
|
||||
* behind it.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnProperty(
|
||||
prefix = FileserverPlatformSettings.PREFIX + ".tus",
|
||||
name = "enabled",
|
||||
havingValue = "true")
|
||||
TusProperties fileserverTusProperties(FileserverPlatformSettings properties) {
|
||||
return new TusProperties(
|
||||
TusProperties.RESUMABLE_VERSION,
|
||||
List.of("creation", "expiration", "checksum", "termination"),
|
||||
properties.upload().maxFileSize().toBytes(),
|
||||
properties.upload().ttl());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnProperty(
|
||||
prefix = FileserverPlatformSettings.PREFIX + ".tus",
|
||||
name = "enabled",
|
||||
havingValue = "true")
|
||||
TusRequestParser fileserverTusRequestParser(TusProperties tusProperties) {
|
||||
return new TusRequestParser(tusProperties);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnProperty(
|
||||
prefix = FileserverPlatformSettings.PREFIX + ".tus",
|
||||
name = "enabled",
|
||||
havingValue = "true")
|
||||
TusChecksumVerifier fileserverTusChecksumVerifier() {
|
||||
return new TusChecksumVerifier();
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings for the experimental draft, which previously had no production binding at all.
|
||||
*
|
||||
* <p>The controller existed and could be switched on, but nothing built the properties it needs,
|
||||
* so the switch produced a startup failure rather than a protocol.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnProperty(
|
||||
prefix = FileserverPlatformSettings.PREFIX + ".httpbis-draft12",
|
||||
name = "enabled",
|
||||
havingValue = "true")
|
||||
Draft12Properties fileserverDraft12Properties(FileserverPlatformSettings properties) {
|
||||
return new Draft12Properties(
|
||||
true, properties.upload().maxFileSize().toBytes(), properties.upload().ttl(), false);
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -7,6 +7,7 @@ import dev.caskeleton.adapter.outbound.fileserver.platform.security.UnenforcedFi
|
||||
import dev.caskeleton.application.fileserver.admin.AdminAuditPort;
|
||||
import dev.caskeleton.application.fileserver.api.security.FileAccessPolicy;
|
||||
import dev.caskeleton.application.fileserver.observability.FileserverAuditPort;
|
||||
import dev.caskeleton.bootstrap.runtime.RuntimeProfileSnapshot;
|
||||
import dev.caskeleton.bootstrap.runtime.startup.StartupFailures;
|
||||
import dev.caskeleton.shared.runtime.RuntimeEnvironment;
|
||||
import java.util.LinkedHashSet;
|
||||
@@ -78,7 +79,7 @@ public class FileserverSecurityConfiguration {
|
||||
}
|
||||
|
||||
private static FileAccessPolicy unenforcedOrFail(Environment environment) {
|
||||
if (RuntimeEnvironment.isProductionActive(List.of(environment.getActiveProfiles()))) {
|
||||
if (RuntimeProfileSnapshot.from(environment).isProduction()) {
|
||||
throw StartupFailures.profileMismatch(
|
||||
"app.fileserver-platform.security.access-policy=unenforced authorizes every file "
|
||||
+ "operation and must not be active under the '"
|
||||
|
||||
+8
-309
@@ -1,314 +1,13 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.fileserver;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalBlockingContentStore;
|
||||
import dev.caskeleton.adapter.outbound.identifier.RandomUploadIdentifierFactory;
|
||||
import dev.caskeleton.application.fileserver.admin.AdminAuditPort;
|
||||
import dev.caskeleton.application.fileserver.admin.DefaultFileserverAdminService;
|
||||
import dev.caskeleton.application.fileserver.admin.FileserverAdminService;
|
||||
import dev.caskeleton.application.fileserver.admin.OrphanScanPort;
|
||||
import dev.caskeleton.application.fileserver.admin.StorageHealthPort;
|
||||
import dev.caskeleton.application.fileserver.api.metadata.FileMetadataStore;
|
||||
import dev.caskeleton.application.fileserver.api.metadata.FileQuotaService;
|
||||
import dev.caskeleton.application.fileserver.api.metadata.UploadSessionStore;
|
||||
import dev.caskeleton.application.fileserver.api.security.FileAccessPolicy;
|
||||
import dev.caskeleton.application.fileserver.api.security.OriginalFilenamePolicy;
|
||||
import dev.caskeleton.application.fileserver.api.transfer.ConditionalRequestEvaluator;
|
||||
import dev.caskeleton.application.fileserver.api.transfer.ContentDispositionFactory;
|
||||
import dev.caskeleton.application.fileserver.cleanup.CleanupContentGateway;
|
||||
import dev.caskeleton.application.fileserver.cleanup.CleanupQueue;
|
||||
import dev.caskeleton.application.fileserver.cleanup.CleanupService;
|
||||
import dev.caskeleton.application.fileserver.cleanup.DefaultCleanupService;
|
||||
import dev.caskeleton.application.fileserver.cleanup.QuotaReclaimGateway;
|
||||
import dev.caskeleton.application.fileserver.concurrency.DefaultWriterLeaseCoordinator;
|
||||
import dev.caskeleton.application.fileserver.concurrency.WriterLeaseCoordinator;
|
||||
import dev.caskeleton.application.fileserver.download.DefaultDownloadApplicationService;
|
||||
import dev.caskeleton.application.fileserver.download.DownloadApplicationService;
|
||||
import dev.caskeleton.application.fileserver.download.DownloadContentGateway;
|
||||
import dev.caskeleton.application.fileserver.download.DownloadPolicy;
|
||||
import dev.caskeleton.application.fileserver.download.ZeroCopyDownloadGateway;
|
||||
import dev.caskeleton.application.fileserver.lifecycle.CopyContentGateway;
|
||||
import dev.caskeleton.application.fileserver.lifecycle.DefaultFileLifecycleService;
|
||||
import dev.caskeleton.application.fileserver.lifecycle.FileLifecycleService;
|
||||
import dev.caskeleton.application.fileserver.observability.FileserverMetricsPort;
|
||||
import dev.caskeleton.application.fileserver.observability.SafeFileFingerprint;
|
||||
import dev.caskeleton.application.fileserver.quota.DefaultTransferAdmissionController;
|
||||
import dev.caskeleton.application.fileserver.quota.StorageUsageProbe;
|
||||
import dev.caskeleton.application.fileserver.quota.TransferAdmissionController;
|
||||
import dev.caskeleton.application.fileserver.quota.TransferAdmissionProperties;
|
||||
import dev.caskeleton.application.fileserver.recovery.DefaultFileReconciliationService;
|
||||
import dev.caskeleton.application.fileserver.recovery.FileReconciliationService;
|
||||
import dev.caskeleton.application.fileserver.recovery.ReconciliationContentProbe;
|
||||
import dev.caskeleton.application.fileserver.recovery.RecoveryQueue;
|
||||
import dev.caskeleton.application.fileserver.upload.DefaultFinalizeUploadService;
|
||||
import dev.caskeleton.application.fileserver.upload.DefaultSingleShotUploadService;
|
||||
import dev.caskeleton.application.fileserver.upload.DefaultUploadApplicationService;
|
||||
import dev.caskeleton.application.fileserver.upload.FileVerificationService;
|
||||
import dev.caskeleton.application.fileserver.upload.FinalizeUploadService;
|
||||
import dev.caskeleton.application.fileserver.upload.QuotaCommitGateway;
|
||||
import dev.caskeleton.application.fileserver.upload.SingleShotUploadService;
|
||||
import dev.caskeleton.application.fileserver.upload.UploadApplicationService;
|
||||
import dev.caskeleton.application.fileserver.upload.UploadContentGateway;
|
||||
import dev.caskeleton.application.fileserver.upload.UploadIdentifierFactory;
|
||||
import dev.caskeleton.application.fileserver.upload.UploadPolicy;
|
||||
import dev.caskeleton.application.fileserver.upload.UploadStorageGateway;
|
||||
import dev.caskeleton.application.transaction.TransactionPort;
|
||||
import java.time.Clock;
|
||||
import java.util.Optional;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* Assembles the application services from their ports.
|
||||
*
|
||||
* <p>Every service here is a plain object built by constructor. The application layer never
|
||||
* discovers its collaborators, so this class is the single place where the capability's shape is
|
||||
* decided — which also means a missing port is a startup failure with a readable bean name rather
|
||||
* than a null at the first upload.
|
||||
*
|
||||
* <p>The effective publish mode handed to finalization comes from the store rather than from
|
||||
* configuration, because the store already reconciled the configured intent against what the
|
||||
* startup probe could prove.
|
||||
*/
|
||||
/** Application-service composition aggregator split by runtime concern. */
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class FileserverServiceConfiguration {
|
||||
|
||||
/**
|
||||
* Instrumentation is optional; the services are not.
|
||||
*
|
||||
* <p>Metrics can be switched off, and when they are there is no {@code FileserverMetricsPort}
|
||||
* bean. Injecting it directly would make every service depend on telemetry being enabled, so the
|
||||
* no-op stands in — which is also what stops the ports from being dead code the way they were
|
||||
* when nothing called them at all.
|
||||
*/
|
||||
private static FileserverMetricsPort metricsOrNoop(
|
||||
ObjectProvider<FileserverMetricsPort> metrics) {
|
||||
return metrics.getIfAvailable(FileserverMetricsPort::noop);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
UploadIdentifierFactory fileserverIdentifierFactory() {
|
||||
return new RandomUploadIdentifierFactory();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
TransferAdmissionProperties fileserverAdmissionProperties(FileserverPlatformSettings settings) {
|
||||
FileserverPlatformSettings.Quota quota = settings.quota();
|
||||
return new TransferAdmissionProperties(
|
||||
quota.instanceUploadPermits(),
|
||||
quota.scopeUploadPermits(),
|
||||
quota.directDownloadPermits(),
|
||||
quota.softHighWater(),
|
||||
quota.hardHighWater());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
TransferAdmissionController fileserverAdmissionController(
|
||||
TransferAdmissionProperties properties,
|
||||
StorageUsageProbe usageProbe,
|
||||
FileserverPlatformSettings settings) {
|
||||
return new DefaultTransferAdmissionController(
|
||||
properties, usageProbe, settings.upload().maxFileSize().toBytes());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
UploadApplicationService fileserverUploadService(
|
||||
FileMetadataStore metadataStore,
|
||||
UploadSessionStore sessionStore,
|
||||
WriterLeaseCoordinator leaseCoordinator,
|
||||
UploadStorageGateway storageGateway,
|
||||
FileQuotaService quotaService,
|
||||
TransferAdmissionController admissionController,
|
||||
FileAccessPolicy accessPolicy,
|
||||
OriginalFilenamePolicy filenamePolicy,
|
||||
CleanupQueue cleanupQueue,
|
||||
UploadIdentifierFactory identifierFactory,
|
||||
UploadPolicy uploadPolicy,
|
||||
ObjectProvider<FileserverMetricsPort> metrics,
|
||||
TransactionPort transactions,
|
||||
Clock clock) {
|
||||
return new DefaultUploadApplicationService(
|
||||
metadataStore,
|
||||
sessionStore,
|
||||
leaseCoordinator,
|
||||
storageGateway,
|
||||
quotaService,
|
||||
admissionController,
|
||||
accessPolicy,
|
||||
filenamePolicy,
|
||||
cleanupQueue,
|
||||
identifierFactory,
|
||||
uploadPolicy,
|
||||
metricsOrNoop(metrics),
|
||||
transactions,
|
||||
clock);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
FinalizeUploadService fileserverFinalizeService(
|
||||
FileMetadataStore metadataStore,
|
||||
UploadSessionStore sessionStore,
|
||||
UploadContentGateway contentGateway,
|
||||
FileVerificationService verificationService,
|
||||
QuotaCommitGateway quotaGateway,
|
||||
CleanupQueue cleanupQueue,
|
||||
RecoveryQueue recoveryQueue,
|
||||
LocalBlockingContentStore store,
|
||||
TransactionPort transactions,
|
||||
Clock clock) {
|
||||
return new DefaultFinalizeUploadService(
|
||||
metadataStore,
|
||||
sessionStore,
|
||||
contentGateway,
|
||||
verificationService,
|
||||
quotaGateway,
|
||||
cleanupQueue,
|
||||
recoveryQueue,
|
||||
store.effectivePublishMode(),
|
||||
transactions,
|
||||
clock);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
SingleShotUploadService fileserverSingleShotUploadService(
|
||||
UploadApplicationService uploadService, FinalizeUploadService finalizeService) {
|
||||
return new DefaultSingleShotUploadService(uploadService, finalizeService);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
DownloadApplicationService fileserverDownloadService(
|
||||
FileMetadataStore metadataStore,
|
||||
DownloadContentGateway contentGateway,
|
||||
FileAccessPolicy accessPolicy,
|
||||
ConditionalRequestEvaluator conditionalEvaluator,
|
||||
ContentDispositionFactory dispositionFactory,
|
||||
DownloadPolicy policy,
|
||||
ZeroCopyDownloadGateway zeroCopyGateway,
|
||||
ObjectProvider<FileserverMetricsPort> metrics) {
|
||||
return new DefaultDownloadApplicationService(
|
||||
metadataStore,
|
||||
contentGateway,
|
||||
accessPolicy,
|
||||
conditionalEvaluator,
|
||||
dispositionFactory,
|
||||
policy,
|
||||
Optional.of(zeroCopyGateway),
|
||||
metricsOrNoop(metrics));
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
FileLifecycleService fileserverLifecycleService(
|
||||
FileMetadataStore metadataStore,
|
||||
CopyContentGateway copyGateway,
|
||||
FileAccessPolicy accessPolicy,
|
||||
OriginalFilenamePolicy filenamePolicy,
|
||||
CleanupQueue cleanupQueue,
|
||||
UploadIdentifierFactory identifierFactory,
|
||||
TransactionPort transactions,
|
||||
Clock clock) {
|
||||
return new DefaultFileLifecycleService(
|
||||
metadataStore,
|
||||
copyGateway,
|
||||
accessPolicy,
|
||||
filenamePolicy,
|
||||
cleanupQueue,
|
||||
identifierFactory,
|
||||
transactions,
|
||||
clock);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
CleanupService fileserverCleanupService(
|
||||
CleanupQueue queue,
|
||||
CleanupContentGateway contentGateway,
|
||||
FileMetadataStore metadataStore,
|
||||
UploadSessionStore sessionStore,
|
||||
QuotaReclaimGateway quotaGateway,
|
||||
FileserverPlatformSettings settings,
|
||||
ObjectProvider<FileserverMetricsPort> metrics,
|
||||
TransactionPort transactions,
|
||||
Clock clock) {
|
||||
return new DefaultCleanupService(
|
||||
queue,
|
||||
contentGateway,
|
||||
metadataStore,
|
||||
sessionStore,
|
||||
quotaGateway,
|
||||
settings.cleanup().retryBackoff(),
|
||||
metricsOrNoop(metrics),
|
||||
transactions,
|
||||
clock);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
FileReconciliationService fileserverReconciliationService(
|
||||
FileMetadataStore metadataStore,
|
||||
ReconciliationContentProbe contentProbe,
|
||||
RecoveryQueue recoveryQueue,
|
||||
TransactionPort transactions,
|
||||
Clock clock) {
|
||||
return new DefaultFileReconciliationService(
|
||||
metadataStore, contentProbe, recoveryQueue, transactions, clock);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
WriterLeaseCoordinator fileserverWriterLeaseCoordinator(
|
||||
UploadSessionStore sessionStore,
|
||||
UploadPolicy uploadPolicy,
|
||||
TransactionPort transactions,
|
||||
Clock clock) {
|
||||
return new DefaultWriterLeaseCoordinator(
|
||||
sessionStore, uploadPolicy.leaseDuration(), transactions, clock);
|
||||
}
|
||||
|
||||
/**
|
||||
* The management plane, gated on its own switch.
|
||||
*
|
||||
* <p>Admin is a separate decision from the data plane: a deployment that serves files does not
|
||||
* automatically want an endpoint that can force-delete them.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnProperty(
|
||||
prefix = "app.fileserver-platform.admin",
|
||||
name = "enabled",
|
||||
havingValue = "true")
|
||||
FileserverAdminService fileserverAdminService(
|
||||
StorageHealthPort healthPort,
|
||||
OrphanScanPort orphanScanPort,
|
||||
FileMetadataStore metadataStore,
|
||||
UploadSessionStore sessionStore,
|
||||
CleanupQueue cleanupQueue,
|
||||
CleanupService cleanupService,
|
||||
FileAccessPolicy accessPolicy,
|
||||
AdminAuditPort auditPort,
|
||||
SafeFileFingerprint fingerprint,
|
||||
TransactionPort transactions,
|
||||
Clock clock) {
|
||||
return new DefaultFileserverAdminService(
|
||||
healthPort,
|
||||
orphanScanPort,
|
||||
metadataStore,
|
||||
sessionStore,
|
||||
cleanupQueue,
|
||||
cleanupService,
|
||||
accessPolicy,
|
||||
auditPort,
|
||||
fingerprint,
|
||||
transactions,
|
||||
clock);
|
||||
}
|
||||
}
|
||||
@Import({
|
||||
FileserverUploadServiceConfiguration.class,
|
||||
FileserverDownloadLifecycleConfiguration.class,
|
||||
FileserverMaintenanceServiceConfiguration.class
|
||||
})
|
||||
class FileserverServiceConfiguration {}
|
||||
|
||||
+2
-3
@@ -7,8 +7,7 @@ import dev.caskeleton.adapter.outbound.fileserver.platform.security.UnenforcedFi
|
||||
import dev.caskeleton.application.fileserver.api.metadata.FileMetadataStore;
|
||||
import dev.caskeleton.application.fileserver.api.security.FileAccessPolicy;
|
||||
import dev.caskeleton.application.fileserver.upload.FileVerificationService;
|
||||
import dev.caskeleton.shared.runtime.RuntimeEnvironment;
|
||||
import java.util.List;
|
||||
import dev.caskeleton.bootstrap.runtime.RuntimeProfileSnapshot;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -86,6 +85,6 @@ public class FileserverStartupConfiguration {
|
||||
}
|
||||
|
||||
private static boolean isProductionProfile(Environment environment) {
|
||||
return RuntimeEnvironment.isProductionActive(List.of(environment.getActiveProfiles()));
|
||||
return RuntimeProfileSnapshot.from(environment).isProduction();
|
||||
}
|
||||
}
|
||||
|
||||
+9
-281
@@ -1,286 +1,14 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.fileserver;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalBlockingContentStore;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalCleanupContentGateway;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalCopyContentGateway;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalDownloadContentGateway;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalOrphanScanAdapter;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalReconciliationContentProbe;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalStorageCapabilityProbe;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalStorageHealthAdapter;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalStorageProbeResult;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalStorageProperties;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalStorageUsageProbe;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalUploadContentGateway;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalUploadStorageGateway;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalZeroCopyDownloadGateway;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.verification.FilenamePolicyVerifier;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.verification.LengthVerifier;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.verification.LocalVerificationContentReader;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.verification.MediaTypeVerifier;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.verification.ScriptableContentPolicy;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.verification.Sha256Verifier;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.verification.VerificationContentReader;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.verification.VerificationCoordinator;
|
||||
import dev.caskeleton.adapter.outbound.persistence.fileserver.FileserverSchemaActivation;
|
||||
import dev.caskeleton.application.fileserver.admin.ContentReferenceLedger;
|
||||
import dev.caskeleton.application.fileserver.admin.OrphanScanPort;
|
||||
import dev.caskeleton.application.fileserver.admin.StorageHealthPort;
|
||||
import dev.caskeleton.application.fileserver.api.DefaultFileStateMachine;
|
||||
import dev.caskeleton.application.fileserver.api.FileStateMachine;
|
||||
import dev.caskeleton.application.fileserver.api.content.PublishMode;
|
||||
import dev.caskeleton.application.fileserver.api.metadata.FileMetadataStore;
|
||||
import dev.caskeleton.application.fileserver.api.metadata.UploadSessionStore;
|
||||
import dev.caskeleton.application.fileserver.api.security.FileVerifier;
|
||||
import dev.caskeleton.application.fileserver.api.security.OriginalFilenamePolicy;
|
||||
import dev.caskeleton.application.fileserver.cleanup.CleanupContentGateway;
|
||||
import dev.caskeleton.application.fileserver.download.DownloadContentGateway;
|
||||
import dev.caskeleton.application.fileserver.download.ZeroCopyDownloadGateway;
|
||||
import dev.caskeleton.application.fileserver.lifecycle.CopyContentGateway;
|
||||
import dev.caskeleton.application.fileserver.quota.StorageUsageProbe;
|
||||
import dev.caskeleton.application.fileserver.recovery.ReconciliationContentProbe;
|
||||
import dev.caskeleton.application.fileserver.recovery.StagingUploadLocator;
|
||||
import dev.caskeleton.application.fileserver.upload.FileVerificationService;
|
||||
import dev.caskeleton.application.fileserver.upload.UploadContentGateway;
|
||||
import dev.caskeleton.application.fileserver.upload.UploadStorageGateway;
|
||||
import dev.caskeleton.bootstrap.runtime.startup.StartupFailures;
|
||||
import java.nio.file.Path;
|
||||
import java.time.Clock;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.jdbc.core.JdbcOperations;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* Binds the application's storage ports to the local filesystem platform.
|
||||
*
|
||||
* <p>The capability probe runs once, at startup, and its result is a bean rather than a repeated
|
||||
* call: every downstream decision — which publish strategy is legal, what the admin plane may
|
||||
* advertise — has to be made from one consistent set of facts about the volume. Re-probing per
|
||||
* request would let the answer change underneath a half-finished publish.
|
||||
*
|
||||
* <p>Startup fails when the mandatory checks did not pass. A file capability that cannot create a
|
||||
* file atomically, cannot keep staging and content on one FileStore, or follows symlinks is not
|
||||
* degraded — it is unsafe, and starting anyway would defer that discovery to the first upload.
|
||||
*/
|
||||
/** Storage composition aggregator; concrete concerns remain separately reviewable. */
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class FileserverStorageConfiguration {
|
||||
|
||||
/**
|
||||
* The three storage invariants are pinned, not configured.
|
||||
*
|
||||
* <p>Staging and content on one file store, a refusal to follow symbolic links, and a force
|
||||
* before publish are what make an atomic publish atomic and a namespace a boundary. A deployment
|
||||
* that could switch them off would be running a different capability under the same name and the
|
||||
* same tests, so they are constants here rather than settings.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
LocalStorageProperties fileserverStorageProperties(FileserverPlatformSettings settings) {
|
||||
FileserverPlatformSettings.Storage storage = settings.storage();
|
||||
requireStorageRootIsIsolated(storage);
|
||||
return new LocalStorageProperties(
|
||||
storage.root(),
|
||||
publishMode(storage.publishMode()),
|
||||
true,
|
||||
true,
|
||||
(int) storage.bufferSize().toBytes(),
|
||||
settings.upload().maxFileSize().toBytes(),
|
||||
true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refuses to start until the Fileserver schema stream is applied and promoted.
|
||||
*
|
||||
* <p>Paired with the storage probe below: one proves the volume can hold the bytes, the other
|
||||
* proves the database sanctions the records. A capability that starts with either unproven fails
|
||||
* on a user's first upload instead of on the deployment that caused it.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnBean(JdbcOperations.class)
|
||||
FileserverSchemaActivation fileserverSchemaActivation(JdbcOperations jdbc) {
|
||||
FileserverSchemaActivation activation = new FileserverSchemaActivation(jdbc);
|
||||
activation.requireActive();
|
||||
return activation;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
LocalStorageProbeResult fileserverStorageProbeResult(LocalStorageProperties properties) {
|
||||
LocalStorageProbeResult result = new LocalStorageCapabilityProbe(properties).run();
|
||||
if (!result.mandatoryChecksPassed()) {
|
||||
throw StartupFailures.envValidation(
|
||||
"fileserver storage root failed a mandatory capability probe: "
|
||||
+ result.failures()
|
||||
+ "; the capability refuses to start rather than publish files it cannot place "
|
||||
+ "atomically");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
LocalBlockingContentStore fileserverContentStore(
|
||||
LocalStorageProperties properties, LocalStorageProbeResult probeResult) {
|
||||
return new LocalBlockingContentStore(properties, probeResult);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
UploadStorageGateway fileserverUploadStorageGateway(LocalBlockingContentStore store) {
|
||||
return new LocalUploadStorageGateway(store);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
UploadContentGateway fileserverUploadContentGateway(
|
||||
LocalBlockingContentStore store,
|
||||
FileMetadataStore metadataStore,
|
||||
UploadSessionStore sessionStore,
|
||||
FileserverPlatformSettings settings) {
|
||||
return new LocalUploadContentGateway(
|
||||
store, metadataStore, sessionStore, settings.upload().maxFileSize().toBytes());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
DownloadContentGateway fileserverDownloadContentGateway(LocalBlockingContentStore store) {
|
||||
return new LocalDownloadContentGateway(store);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
CopyContentGateway fileserverCopyContentGateway(
|
||||
LocalBlockingContentStore store, FileserverPlatformSettings settings) {
|
||||
return new LocalCopyContentGateway(store, settings.upload().maxFileSize().toBytes());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
CleanupContentGateway fileserverCleanupContentGateway(LocalBlockingContentStore store) {
|
||||
return new LocalCleanupContentGateway(store);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
ZeroCopyDownloadGateway fileserverZeroCopyDownloadGateway(LocalBlockingContentStore store) {
|
||||
return new LocalZeroCopyDownloadGateway(store);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
StorageHealthPort fileserverStorageHealth(
|
||||
LocalStorageProperties properties,
|
||||
LocalStorageProbeResult probeResult,
|
||||
LocalBlockingContentStore store) {
|
||||
return new LocalStorageHealthAdapter(properties, probeResult, store);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
OrphanScanPort fileserverOrphanScan(
|
||||
ContentReferenceLedger ledger,
|
||||
LocalStorageProperties properties,
|
||||
FileserverPlatformSettings settings,
|
||||
Clock clock) {
|
||||
return new LocalOrphanScanAdapter(
|
||||
ledger, properties, settings.admin().orphanMinimumAge(), clock);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
StorageUsageProbe fileserverStorageUsageProbe(LocalStorageProperties properties) {
|
||||
return new LocalStorageUsageProbe(properties.root());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
ReconciliationContentProbe fileserverReconciliationProbe(
|
||||
LocalBlockingContentStore store, StagingUploadLocator stagingLocator) {
|
||||
return new LocalReconciliationContentProbe(store, stagingLocator);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
OriginalFilenamePolicy fileserverFilenamePolicy() {
|
||||
return OriginalFilenamePolicy.standard();
|
||||
}
|
||||
|
||||
/**
|
||||
* The transition table, shared by everything that changes a file's state.
|
||||
*
|
||||
* <p>One instance rather than one per store. The metadata store rejects an illegal transition
|
||||
* before it reaches SQL, and a second copy of the table is a second place for the legal edges to
|
||||
* drift.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
FileStateMachine fileserverStateMachine() {
|
||||
return new DefaultFileStateMachine();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
VerificationContentReader fileserverVerificationContentReader(LocalBlockingContentStore store) {
|
||||
return new LocalVerificationContentReader(store);
|
||||
}
|
||||
|
||||
/**
|
||||
* The verification chain, in the order the design fixes.
|
||||
*
|
||||
* <p>Order does not change the verdict — precedence over the collected results does that — but it
|
||||
* does decide how much work a doomed upload causes. The cheap structural checks run before the
|
||||
* ones that read content.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
FileVerificationService fileserverVerificationService(
|
||||
VerificationContentReader contentReader,
|
||||
OriginalFilenamePolicy filenamePolicy,
|
||||
FileserverPlatformSettings settings) {
|
||||
List<FileVerifier> verifiers =
|
||||
List.of(
|
||||
new LengthVerifier(settings.upload().maxFileSize().toBytes()),
|
||||
new Sha256Verifier(),
|
||||
new FilenamePolicyVerifier(filenamePolicy),
|
||||
new MediaTypeVerifier(contentReader, settings.verification().requireMediaTypeVerdict()),
|
||||
new ScriptableContentPolicy(
|
||||
contentReader, settings.verification().inlineSafeProfile()));
|
||||
return new VerificationCoordinator(verifiers, settings.verification().timeout());
|
||||
}
|
||||
|
||||
/**
|
||||
* Refuses a storage root that overlaps something the process already serves or reads.
|
||||
*
|
||||
* <p>A root under a web root turns every upload into a published file; a root under a
|
||||
* configuration directory turns one into a configuration change. Both are checked here because
|
||||
* the path is only known once, at binding time.
|
||||
*/
|
||||
private static void requireStorageRootIsIsolated(FileserverPlatformSettings.Storage storage) {
|
||||
Path root = storage.root().toAbsolutePath().normalize();
|
||||
for (Path forbidden : storage.forbiddenRootAncestors()) {
|
||||
Path ancestor = forbidden.toAbsolutePath().normalize();
|
||||
if (root.startsWith(ancestor)) {
|
||||
throw StartupFailures.envValidation(
|
||||
"fileserver storage root must not live under a configured forbidden ancestor");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static PublishMode publishMode(String configured) {
|
||||
String canonical = configured.trim().toUpperCase(Locale.ROOT).replace('-', '_');
|
||||
try {
|
||||
return PublishMode.valueOf(canonical);
|
||||
} catch (IllegalArgumentException unknown) {
|
||||
throw StartupFailures.envValidation(
|
||||
FileserverPlatformSettings.PREFIX
|
||||
+ ".storage.publish-mode must be one of atomic-move-required, "
|
||||
+ "atomic-move-preferred, metadata-pointer",
|
||||
unknown);
|
||||
}
|
||||
}
|
||||
}
|
||||
@Import({
|
||||
FileserverLocalStorageCoreConfiguration.class,
|
||||
FileserverStorageGatewayConfiguration.class,
|
||||
FileserverStorageOperationsConfiguration.class,
|
||||
FileserverVerificationConfiguration.class
|
||||
})
|
||||
class FileserverStorageConfiguration {}
|
||||
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.fileserver;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalBlockingContentStore;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalCleanupContentGateway;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalCopyContentGateway;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalDownloadContentGateway;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalUploadContentGateway;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalUploadStorageGateway;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalZeroCopyDownloadGateway;
|
||||
import dev.caskeleton.application.fileserver.api.metadata.FileMetadataStore;
|
||||
import dev.caskeleton.application.fileserver.api.metadata.UploadSessionStore;
|
||||
import dev.caskeleton.application.fileserver.cleanup.CleanupContentGateway;
|
||||
import dev.caskeleton.application.fileserver.download.DownloadContentGateway;
|
||||
import dev.caskeleton.application.fileserver.download.ZeroCopyDownloadGateway;
|
||||
import dev.caskeleton.application.fileserver.lifecycle.CopyContentGateway;
|
||||
import dev.caskeleton.application.fileserver.upload.UploadContentGateway;
|
||||
import dev.caskeleton.application.fileserver.upload.UploadStorageGateway;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
class FileserverStorageGatewayConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
UploadStorageGateway fileserverUploadStorageGateway(LocalBlockingContentStore store) {
|
||||
return new LocalUploadStorageGateway(store);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
UploadContentGateway fileserverUploadContentGateway(
|
||||
LocalBlockingContentStore store,
|
||||
FileMetadataStore metadataStore,
|
||||
UploadSessionStore sessionStore,
|
||||
FileserverPlatformSettings settings) {
|
||||
return new LocalUploadContentGateway(
|
||||
store, metadataStore, sessionStore, settings.upload().maxFileSize().toBytes());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
DownloadContentGateway fileserverDownloadContentGateway(LocalBlockingContentStore store) {
|
||||
return new LocalDownloadContentGateway(store);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
CopyContentGateway fileserverCopyContentGateway(
|
||||
LocalBlockingContentStore store, FileserverPlatformSettings settings) {
|
||||
return new LocalCopyContentGateway(store, settings.upload().maxFileSize().toBytes());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
CleanupContentGateway fileserverCleanupContentGateway(LocalBlockingContentStore store) {
|
||||
return new LocalCleanupContentGateway(store);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
ZeroCopyDownloadGateway fileserverZeroCopyDownloadGateway(LocalBlockingContentStore store) {
|
||||
return new LocalZeroCopyDownloadGateway(store);
|
||||
}
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.fileserver;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalBlockingContentStore;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalOrphanScanAdapter;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalReconciliationContentProbe;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalStorageHealthAdapter;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalStorageProbeResult;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalStorageProperties;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalStorageUsageProbe;
|
||||
import dev.caskeleton.application.fileserver.admin.ContentReferenceLedger;
|
||||
import dev.caskeleton.application.fileserver.admin.OrphanScanPort;
|
||||
import dev.caskeleton.application.fileserver.admin.StorageHealthPort;
|
||||
import dev.caskeleton.application.fileserver.quota.StorageUsageProbe;
|
||||
import dev.caskeleton.application.fileserver.recovery.ReconciliationContentProbe;
|
||||
import dev.caskeleton.application.fileserver.recovery.StagingUploadLocator;
|
||||
import java.time.Clock;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
class FileserverStorageOperationsConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
StorageHealthPort fileserverStorageHealth(
|
||||
LocalStorageProperties properties,
|
||||
LocalStorageProbeResult probeResult,
|
||||
LocalBlockingContentStore store) {
|
||||
return new LocalStorageHealthAdapter(properties, probeResult, store);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
OrphanScanPort fileserverOrphanScan(
|
||||
ContentReferenceLedger ledger,
|
||||
LocalStorageProperties properties,
|
||||
FileserverPlatformSettings settings,
|
||||
Clock clock) {
|
||||
return new LocalOrphanScanAdapter(
|
||||
ledger, properties, settings.admin().orphanMinimumAge(), clock);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
StorageUsageProbe fileserverStorageUsageProbe(LocalStorageProperties properties) {
|
||||
return new LocalStorageUsageProbe(properties.root());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
ReconciliationContentProbe fileserverReconciliationProbe(
|
||||
LocalBlockingContentStore store, StagingUploadLocator stagingLocator) {
|
||||
return new LocalReconciliationContentProbe(store, stagingLocator);
|
||||
}
|
||||
}
|
||||
+147
@@ -0,0 +1,147 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.fileserver;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalBlockingContentStore;
|
||||
import dev.caskeleton.adapter.outbound.identifier.RandomUploadIdentifierFactory;
|
||||
import dev.caskeleton.application.fileserver.api.metadata.FileMetadataStore;
|
||||
import dev.caskeleton.application.fileserver.api.metadata.FileQuotaService;
|
||||
import dev.caskeleton.application.fileserver.api.metadata.UploadSessionStore;
|
||||
import dev.caskeleton.application.fileserver.api.security.FileAccessPolicy;
|
||||
import dev.caskeleton.application.fileserver.api.security.OriginalFilenamePolicy;
|
||||
import dev.caskeleton.application.fileserver.cleanup.CleanupQueue;
|
||||
import dev.caskeleton.application.fileserver.concurrency.DefaultWriterLeaseCoordinator;
|
||||
import dev.caskeleton.application.fileserver.concurrency.WriterLeaseCoordinator;
|
||||
import dev.caskeleton.application.fileserver.observability.FileserverMetricsPort;
|
||||
import dev.caskeleton.application.fileserver.quota.DefaultTransferAdmissionController;
|
||||
import dev.caskeleton.application.fileserver.quota.StorageUsageProbe;
|
||||
import dev.caskeleton.application.fileserver.quota.TransferAdmissionController;
|
||||
import dev.caskeleton.application.fileserver.quota.TransferAdmissionProperties;
|
||||
import dev.caskeleton.application.fileserver.recovery.RecoveryQueue;
|
||||
import dev.caskeleton.application.fileserver.upload.DefaultFinalizeUploadService;
|
||||
import dev.caskeleton.application.fileserver.upload.DefaultSingleShotUploadService;
|
||||
import dev.caskeleton.application.fileserver.upload.DefaultUploadApplicationService;
|
||||
import dev.caskeleton.application.fileserver.upload.FileVerificationService;
|
||||
import dev.caskeleton.application.fileserver.upload.FinalizeUploadService;
|
||||
import dev.caskeleton.application.fileserver.upload.QuotaCommitGateway;
|
||||
import dev.caskeleton.application.fileserver.upload.SingleShotUploadService;
|
||||
import dev.caskeleton.application.fileserver.upload.UploadApplicationService;
|
||||
import dev.caskeleton.application.fileserver.upload.UploadContentGateway;
|
||||
import dev.caskeleton.application.fileserver.upload.UploadIdentifierFactory;
|
||||
import dev.caskeleton.application.fileserver.upload.UploadPolicy;
|
||||
import dev.caskeleton.application.fileserver.upload.UploadStorageGateway;
|
||||
import dev.caskeleton.application.transaction.PolicyTransactionPort;
|
||||
import dev.caskeleton.application.transaction.TransactionPort;
|
||||
import java.time.Clock;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
class FileserverUploadServiceConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
UploadIdentifierFactory fileserverIdentifierFactory() {
|
||||
return new RandomUploadIdentifierFactory();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
TransferAdmissionProperties fileserverAdmissionProperties(FileserverPlatformSettings settings) {
|
||||
FileserverPlatformSettings.Quota quota = settings.quota();
|
||||
return new TransferAdmissionProperties(
|
||||
quota.instanceUploadPermits(),
|
||||
quota.scopeUploadPermits(),
|
||||
quota.directDownloadPermits(),
|
||||
quota.softHighWater(),
|
||||
quota.hardHighWater());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
TransferAdmissionController fileserverAdmissionController(
|
||||
TransferAdmissionProperties properties,
|
||||
StorageUsageProbe usageProbe,
|
||||
FileserverPlatformSettings settings) {
|
||||
return new DefaultTransferAdmissionController(
|
||||
properties, usageProbe, settings.upload().maxFileSize().toBytes());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
UploadApplicationService fileserverUploadService(
|
||||
FileMetadataStore metadataStore,
|
||||
UploadSessionStore sessionStore,
|
||||
WriterLeaseCoordinator leaseCoordinator,
|
||||
UploadStorageGateway storageGateway,
|
||||
FileQuotaService quotaService,
|
||||
TransferAdmissionController admissionController,
|
||||
FileAccessPolicy accessPolicy,
|
||||
OriginalFilenamePolicy filenamePolicy,
|
||||
CleanupQueue cleanupQueue,
|
||||
UploadIdentifierFactory identifierFactory,
|
||||
UploadPolicy uploadPolicy,
|
||||
ObjectProvider<FileserverMetricsPort> metrics,
|
||||
PolicyTransactionPort transactions,
|
||||
Clock clock) {
|
||||
return new DefaultUploadApplicationService(
|
||||
metadataStore,
|
||||
sessionStore,
|
||||
leaseCoordinator,
|
||||
storageGateway,
|
||||
quotaService,
|
||||
admissionController,
|
||||
accessPolicy,
|
||||
filenamePolicy,
|
||||
cleanupQueue,
|
||||
identifierFactory,
|
||||
uploadPolicy,
|
||||
FileserverMetricsSupport.metricsOrNoop(metrics),
|
||||
transactions,
|
||||
clock);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
FinalizeUploadService fileserverFinalizeService(
|
||||
FileMetadataStore metadataStore,
|
||||
UploadSessionStore sessionStore,
|
||||
UploadContentGateway contentGateway,
|
||||
FileVerificationService verificationService,
|
||||
QuotaCommitGateway quotaGateway,
|
||||
CleanupQueue cleanupQueue,
|
||||
RecoveryQueue recoveryQueue,
|
||||
LocalBlockingContentStore store,
|
||||
PolicyTransactionPort transactions,
|
||||
Clock clock) {
|
||||
return new DefaultFinalizeUploadService(
|
||||
metadataStore,
|
||||
sessionStore,
|
||||
contentGateway,
|
||||
verificationService,
|
||||
quotaGateway,
|
||||
cleanupQueue,
|
||||
recoveryQueue,
|
||||
store.effectivePublishMode(),
|
||||
transactions,
|
||||
clock);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
SingleShotUploadService fileserverSingleShotUploadService(
|
||||
UploadApplicationService uploadService, FinalizeUploadService finalizeService) {
|
||||
return new DefaultSingleShotUploadService(uploadService, finalizeService);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
WriterLeaseCoordinator fileserverWriterLeaseCoordinator(
|
||||
UploadSessionStore sessionStore,
|
||||
UploadPolicy uploadPolicy,
|
||||
TransactionPort transactions,
|
||||
Clock clock) {
|
||||
return new DefaultWriterLeaseCoordinator(
|
||||
sessionStore, uploadPolicy.leaseDuration(), transactions, clock);
|
||||
}
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.fileserver;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalBlockingContentStore;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.verification.FilenamePolicyVerifier;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.verification.LengthVerifier;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.verification.LocalVerificationContentReader;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.verification.MediaTypeVerifier;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.verification.ScriptableContentPolicy;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.verification.Sha256Verifier;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.verification.VerificationContentReader;
|
||||
import dev.caskeleton.adapter.outbound.fileserver.platform.verification.VerificationCoordinator;
|
||||
import dev.caskeleton.application.fileserver.api.DefaultFileStateMachine;
|
||||
import dev.caskeleton.application.fileserver.api.FileStateMachine;
|
||||
import dev.caskeleton.application.fileserver.api.security.FileVerifier;
|
||||
import dev.caskeleton.application.fileserver.api.security.OriginalFilenamePolicy;
|
||||
import dev.caskeleton.application.fileserver.upload.FileVerificationService;
|
||||
import java.util.List;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
class FileserverVerificationConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
OriginalFilenamePolicy fileserverFilenamePolicy() {
|
||||
return OriginalFilenamePolicy.standard();
|
||||
}
|
||||
|
||||
/**
|
||||
* The transition table, shared by everything that changes a file's state.
|
||||
*
|
||||
* <p>One instance rather than one per store. The metadata store rejects an illegal transition
|
||||
* before it reaches SQL, and a second copy of the table is a second place for the legal edges to
|
||||
* drift.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
FileStateMachine fileserverStateMachine() {
|
||||
return new DefaultFileStateMachine();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
VerificationContentReader fileserverVerificationContentReader(LocalBlockingContentStore store) {
|
||||
return new LocalVerificationContentReader(store);
|
||||
}
|
||||
|
||||
/**
|
||||
* The verification chain, in the order the design fixes.
|
||||
*
|
||||
* <p>Order does not change the verdict — precedence over the collected results does that — but it
|
||||
* does decide how much work a doomed upload causes. The cheap structural checks run before the
|
||||
* ones that read content.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
FileVerificationService fileserverVerificationService(
|
||||
VerificationContentReader contentReader,
|
||||
OriginalFilenamePolicy filenamePolicy,
|
||||
FileserverPlatformSettings settings) {
|
||||
List<FileVerifier> verifiers =
|
||||
List.of(
|
||||
new LengthVerifier(settings.upload().maxFileSize().toBytes()),
|
||||
new Sha256Verifier(),
|
||||
new FilenamePolicyVerifier(filenamePolicy),
|
||||
new MediaTypeVerifier(contentReader, settings.verification().requireMediaTypeVerdict()),
|
||||
new ScriptableContentPolicy(
|
||||
contentReader, settings.verification().inlineSafeProfile()));
|
||||
return new VerificationCoordinator(verifiers, settings.verification().timeout());
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.fileserver;
|
||||
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.mapper.MultipartUploadRequestMapper;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.mapper.RawUploadRequestMapper;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.problem.FileserverProblemFactory;
|
||||
import dev.caskeleton.adapter.inbound.web.fileserver.security.FileserverRequestContextFactory;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
class FileserverWebAssemblyConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
FileserverRequestContextFactory fileserverRequestContextFactory(
|
||||
FileserverPlatformSettings properties) {
|
||||
return new FileserverRequestContextFactory(properties.instanceId());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
FileserverProblemFactory fileserverProblemFactory() {
|
||||
return new FileserverProblemFactory();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
RawUploadRequestMapper fileserverRawUploadRequestMapper(FileserverPlatformSettings properties) {
|
||||
return new RawUploadRequestMapper(properties.upload().requireContentLength());
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
MultipartUploadRequestMapper fileserverMultipartUploadRequestMapper() {
|
||||
return new MultipartUploadRequestMapper();
|
||||
}
|
||||
}
|
||||
-82
@@ -1,82 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.httpclient;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.httpclient.dynamic.DefaultDynamicTargetGateway;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.dynamic.DynamicCredentialBinding;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.dynamic.DynamicTargetGateway;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.dynamic.DynamicTargetPolicy;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.dynamic.DynamicTargetPolicyName;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.dynamic.IpAddressClassifier;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.dynamic.ValidatedDnsResolver;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.ClientRuntimeRegistry;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.restclient.BlockingAttemptExecutor;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* H3 Dynamic Target wiring (design §9.4, §22).
|
||||
*
|
||||
* <p>With no configured policy the gateway exists but can reach nothing: every call needs a named
|
||||
* policy, and an unregistered name is an error rather than a permissive default.
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class DynamicTargetAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(name = "dynamicTargetPolicies")
|
||||
Map<DynamicTargetPolicyName, DynamicTargetPolicy> dynamicTargetPolicies(
|
||||
HttpClientPlatformSettings properties) {
|
||||
Map<DynamicTargetPolicyName, DynamicTargetPolicy> policies = new LinkedHashMap<>();
|
||||
for (HttpClientPlatformSettings.DynamicTargetSettings target : properties.dynamicTargets()) {
|
||||
DynamicTargetPolicyName name = new DynamicTargetPolicyName(target.name());
|
||||
policies.put(
|
||||
name,
|
||||
new DynamicTargetPolicy(
|
||||
name,
|
||||
Set.copyOf(target.allowedSchemes()),
|
||||
Set.copyOf(target.allowedPorts()),
|
||||
Set.copyOf(target.allowedHostSuffixes()),
|
||||
Set.copyOf(target.allowedHosts()),
|
||||
target.maxRedirectHops(),
|
||||
target.tracePropagation(),
|
||||
List.copyOf(target.blockedCidrs())));
|
||||
}
|
||||
return Map.copyOf(policies);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(name = "dynamicTargetResolvers")
|
||||
Map<DynamicTargetPolicyName, ValidatedDnsResolver> dynamicTargetResolvers(
|
||||
HttpClientPlatformSettings properties) {
|
||||
Map<DynamicTargetPolicyName, ValidatedDnsResolver> resolvers = new LinkedHashMap<>();
|
||||
for (HttpClientPlatformSettings.DynamicTargetSettings target : properties.dynamicTargets()) {
|
||||
resolvers.put(
|
||||
new DynamicTargetPolicyName(target.name()),
|
||||
new ValidatedDnsResolver(new IpAddressClassifier(target.blockedCidrs())));
|
||||
}
|
||||
return Map.copyOf(resolvers);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
DynamicTargetGateway dynamicTargetGateway(
|
||||
Map<DynamicTargetPolicyName, DynamicTargetPolicy> dynamicTargetPolicies,
|
||||
Map<DynamicTargetPolicyName, ValidatedDnsResolver> dynamicTargetResolvers,
|
||||
ClientRuntimeRegistry runtimes,
|
||||
BlockingAttemptExecutor executor,
|
||||
List<DynamicCredentialBinding> dynamicCredentialBindings,
|
||||
Function<String, String> httpClientSecretResolver) {
|
||||
return new DefaultDynamicTargetGateway(
|
||||
dynamicTargetPolicies,
|
||||
dynamicTargetResolvers,
|
||||
runtimes,
|
||||
executor,
|
||||
dynamicCredentialBindings,
|
||||
httpClientSecretResolver);
|
||||
}
|
||||
}
|
||||
-71
@@ -1,71 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.httpclient;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.ClientProfile;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.ClientRuntime;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.ClientRuntimeRegistry;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.TreeMap;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
|
||||
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
|
||||
|
||||
/**
|
||||
* Operational view of the configured HTTP clients (design §27.3).
|
||||
*
|
||||
* <p>The exposed set is deliberately narrow. Base URL, credential values, trust store paths, and
|
||||
* resolved IPs are absent because an actuator endpoint is reachable by more people than a secret
|
||||
* store is, and "read-only" is not the same as "safe to publish".
|
||||
*/
|
||||
@Endpoint(id = "httpclients")
|
||||
public class HttpClientActuatorEndpoint {
|
||||
|
||||
private final ClientRuntimeRegistry runtimes;
|
||||
|
||||
public HttpClientActuatorEndpoint(ClientRuntimeRegistry runtimes) {
|
||||
this.runtimes = Objects.requireNonNull(runtimes, "client runtime registry");
|
||||
}
|
||||
|
||||
@ReadOperation
|
||||
public Map<String, Object> clients() {
|
||||
Map<String, Object> report = new TreeMap<>();
|
||||
runtimes
|
||||
.names()
|
||||
.forEach(
|
||||
name -> {
|
||||
ClientRuntime runtime = runtimes.current(name);
|
||||
ClientProfile profile = runtime.profile();
|
||||
Map<String, Object> entry = new LinkedHashMap<>();
|
||||
entry.put("generation", runtime.generation().value());
|
||||
entry.put("state", runtime.state().name());
|
||||
entry.put("transport", profile.transport().name());
|
||||
entry.put("api", profile.api().name());
|
||||
entry.put(
|
||||
"protocols", profile.protocols().stream().map(Enum::name).sorted().toList());
|
||||
entry.put("activeLeases", runtime.activeLeases());
|
||||
entry.put("maxTotalConnections", profile.pool().maxTotalConnections());
|
||||
entry.put("credentialType", profile.authentication().type().name());
|
||||
entry.put("tlsProfileId", profile.tls().profileId().orElse("jvm-default"));
|
||||
entry.put("redirectEnabled", profile.redirect().enabled());
|
||||
entry.put("retryPolicy", profile.retry().policy());
|
||||
entry.put("capabilityWarnings", capabilityWarnings(profile));
|
||||
report.put(name.value(), entry);
|
||||
});
|
||||
return Map.copyOf(report);
|
||||
}
|
||||
|
||||
private List<String> capabilityWarnings(ClientProfile profile) {
|
||||
List<String> warnings = new java.util.ArrayList<>();
|
||||
if (profile.experimentalAcknowledgement().isPresent()) {
|
||||
warnings.add("EXPERIMENTAL_TRANSPORT_ACKNOWLEDGED");
|
||||
}
|
||||
if (profile.redirect().enabled() && profile.redirect().allowCrossOrigin()) {
|
||||
warnings.add("CROSS_ORIGIN_REDIRECT_ENABLED");
|
||||
}
|
||||
if (profile.observability().bodyLogging()) {
|
||||
warnings.add("BODY_LOGGING_ENABLED");
|
||||
}
|
||||
return List.copyOf(warnings);
|
||||
}
|
||||
}
|
||||
-89
@@ -1,89 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.httpclient;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.httpclient.auth.ApiKeyHeaderCredentialProvider;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.auth.BasicCredentialProvider;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.auth.CredentialProviderRegistry;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.auth.NoAuthCredentialProvider;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.auth.OAuth2CredentialProvider;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.auth.ReactiveCredentialProviderRegistry;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.auth.ReactiveRequestCredentialProvider;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.auth.StaticBearerCredentialProvider;
|
||||
import dev.caskeleton.bootstrap.runtime.startup.StartupFailures;
|
||||
import java.time.Clock;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.oauth2.client.OAuth2AuthorizedClientManager;
|
||||
|
||||
/**
|
||||
* Credential providers for the declared authentication types (design §20).
|
||||
*
|
||||
* <p>Secret retrieval is an injected function, not a file path in configuration: design §21.2
|
||||
* forbids key material in config files, and this keeps the platform unaware of where secrets live.
|
||||
* OAuth2 is registered only when an authorized client manager exists, so an unconfigured deployment
|
||||
* fails at startup validation rather than at the first call.
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class HttpClientAuthenticationAutoConfiguration {
|
||||
|
||||
/** Header names an API-key profile may use; anything else is rejected (design §20.1). */
|
||||
private static final Set<String> ALLOWED_API_KEY_HEADERS =
|
||||
Set.of("X-Api-Key", "Api-Key", "X-Client-Key");
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(name = "httpClientSecretResolver")
|
||||
Function<String, String> httpClientSecretResolver() {
|
||||
return reference -> {
|
||||
throw StartupFailures.envValidation(
|
||||
"no http client secret resolver is configured for reference '" + reference + "'");
|
||||
};
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
CredentialProviderRegistry httpClientCredentialProviderRegistry(
|
||||
Function<String, String> httpClientSecretResolver,
|
||||
ObjectProvider<OAuth2AuthorizedClientManager> authorizedClientManager,
|
||||
Clock clock) {
|
||||
CredentialProviderRegistry registry =
|
||||
new CredentialProviderRegistry()
|
||||
.register(new NoAuthCredentialProvider())
|
||||
.register(new BasicCredentialProvider(httpClientSecretResolver))
|
||||
.register(
|
||||
new ApiKeyHeaderCredentialProvider(
|
||||
ALLOWED_API_KEY_HEADERS, httpClientSecretResolver))
|
||||
.register(new StaticBearerCredentialProvider(httpClientSecretResolver));
|
||||
authorizedClientManager.ifAvailable(
|
||||
manager -> registry.register(new OAuth2CredentialProvider(manager, clock)));
|
||||
return registry;
|
||||
}
|
||||
|
||||
/**
|
||||
* The reactive counterpart of the blocking registry.
|
||||
*
|
||||
* <p>This used to be {@code fromNonBlocking(new NoAuthCredentialProvider())} — unconditionally,
|
||||
* for every profile. A reactive profile that declared BASIC, an API key or a static bearer
|
||||
* therefore sent no credential at all, and nothing said so: the request went out anonymous and
|
||||
* the 401 came back looking like an upstream problem.
|
||||
*
|
||||
* <p>The three mechanisms registered here resolve a secret and format a header; that is
|
||||
* computation, not I/O, so wrapping the synchronous provider is honest rather than a disguised
|
||||
* block. OAuth2 is deliberately absent — a token load is a network round trip and there is no
|
||||
* non-blocking implementation of it, so {@code HttpClientStartupValidator} refuses the
|
||||
* combination at startup instead of letting it fail on the first call.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
ReactiveRequestCredentialProvider httpClientReactiveCredentialProvider(
|
||||
Function<String, String> httpClientSecretResolver) {
|
||||
return new ReactiveCredentialProviderRegistry()
|
||||
.registerNonBlocking(new NoAuthCredentialProvider())
|
||||
.registerNonBlocking(new BasicCredentialProvider(httpClientSecretResolver))
|
||||
.registerNonBlocking(
|
||||
new ApiKeyHeaderCredentialProvider(ALLOWED_API_KEY_HEADERS, httpClientSecretResolver))
|
||||
.registerNonBlocking(new StaticBearerCredentialProvider(httpClientSecretResolver));
|
||||
}
|
||||
}
|
||||
-179
@@ -1,179 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.httpclient;
|
||||
|
||||
import dev.caskeleton.bootstrap.runtime.startup.StartupFailures;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.RecordComponent;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import org.springframework.core.env.ConfigurableEnvironment;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
import org.springframework.core.env.SystemEnvironmentPropertySource;
|
||||
|
||||
/**
|
||||
* The environment surface of {@link HttpClientPlatformSettings}, derived from the record tree.
|
||||
*
|
||||
* <p>This exists because strict binding cannot see a misspelled environment variable. Spring
|
||||
* resolves {@code APP_HTTPCLIENT_CLIENTS_0_BASE_URL} to {@code app.httpclient.clients[0].base-url}
|
||||
* by mapping the requested property name back to an environment name, but it <em>enumerates</em>
|
||||
* the same variable as {@code app.httpclient.clients[0].base.url} — underscores become dots, never
|
||||
* hyphens. {@code NoUnboundElementsBindHandler} compares against that enumeration, so pointing it
|
||||
* at the system environment reports correctly-spelled variables as unbound while still saying
|
||||
* nothing about a genuinely misspelled one. The check therefore runs the other way round: derive
|
||||
* the names the settings tree accepts, and reject an {@code APP_HTTPCLIENT_} variable that is not
|
||||
* among them.
|
||||
*
|
||||
* <p>Without it {@code APP_HTTPCLIENT_CLIENTS_0_TIMEUOT_TOTAL_CALL} would leave the client running
|
||||
* the default four-second budget while the deployment's manifest says six, and nothing anywhere
|
||||
* would mention it.
|
||||
*/
|
||||
final class HttpClientEnvironmentKeys {
|
||||
|
||||
/** Environment form of {@link HttpClientPlatformSettings#PREFIX}, with its trailing separator. */
|
||||
static final String ENV_PREFIX = "APP_HTTPCLIENT_";
|
||||
|
||||
/** Deepest list nesting {@link #indexLetter} can name. */
|
||||
private static final int MAXIMUM_LIST_DEPTH = 1;
|
||||
|
||||
private static final java.util.regex.Pattern SEGMENT_SEPARATOR =
|
||||
java.util.regex.Pattern.compile("_");
|
||||
|
||||
private HttpClientEnvironmentKeys() {}
|
||||
|
||||
/**
|
||||
* Maps each leaf property path to the environment variable template that sets it.
|
||||
*
|
||||
* <p>A list index is rendered as a letter rather than a number, so the result describes a
|
||||
* template rather than one deployment's cardinality: {@code N} for the outermost list, {@code M}
|
||||
* inside it.
|
||||
*
|
||||
* @return leaf property path to environment variable template, in declaration order
|
||||
*/
|
||||
static Map<String, String> fieldToEnvTemplate() {
|
||||
Map<String, String> templates = new LinkedHashMap<>();
|
||||
collect(HttpClientPlatformSettings.class, "APP_HTTPCLIENT", "", 0, templates);
|
||||
return templates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Refuses an {@code APP_HTTPCLIENT_} variable that maps to no field.
|
||||
*
|
||||
* @param environment the environment to inspect; sources other than the system environment are
|
||||
* covered by strict binding and are not re-checked here
|
||||
* @throws IllegalStateException listing every unrecognised variable, so an operator fixes them in
|
||||
* one pass rather than one restart at a time
|
||||
*/
|
||||
static void rejectUnrecognised(Environment environment) {
|
||||
if (!(environment instanceof ConfigurableEnvironment configurable)) {
|
||||
return;
|
||||
}
|
||||
Set<String> accepted = Set.copyOf(fieldToEnvTemplate().values());
|
||||
Set<String> unrecognised = new TreeSet<>();
|
||||
for (PropertySource<?> source : configurable.getPropertySources()) {
|
||||
if (!(source instanceof SystemEnvironmentPropertySource environmentSource)) {
|
||||
continue;
|
||||
}
|
||||
for (String name : environmentSource.getPropertyNames()) {
|
||||
String canonical = name.toUpperCase(Locale.ROOT);
|
||||
if (canonical.startsWith(ENV_PREFIX) && !accepted.contains(asTemplate(canonical))) {
|
||||
unrecognised.add(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!unrecognised.isEmpty()) {
|
||||
throw StartupFailures.envValidation(
|
||||
"unrecognised HTTP client environment variables "
|
||||
+ unrecognised
|
||||
+ "; see docs/httpclient/env-fields.yaml for the accepted names");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces each index with the letter its depth uses, so a concrete variable can be looked up.
|
||||
*
|
||||
* <p>Only a wholly numeric segment is an index. A field whose name happens to end in digits stays
|
||||
* literal, which is why {@code DRAFT12} would not be mistaken for a position.
|
||||
*/
|
||||
private static String asTemplate(String environmentName) {
|
||||
// -1 keeps trailing empty segments, so a stray trailing underscore stays visible and is
|
||||
// rejected rather than normalised away into a name that happens to match.
|
||||
String[] segments = SEGMENT_SEPARATOR.split(environmentName, -1);
|
||||
int listDepth = 0;
|
||||
StringBuilder template = new StringBuilder(environmentName.length());
|
||||
for (int index = 0; index < segments.length; index++) {
|
||||
if (index > 0) {
|
||||
template.append('_');
|
||||
}
|
||||
String segment = segments[index];
|
||||
if (!segment.isEmpty() && segment.chars().allMatch(Character::isDigit)) {
|
||||
if (listDepth > MAXIMUM_LIST_DEPTH) {
|
||||
// Deeper than any field can express, so it cannot name one. Left literal, which no
|
||||
// template matches, so the variable is reported rather than silently accepted.
|
||||
template.append(segment);
|
||||
continue;
|
||||
}
|
||||
template.append(indexLetter(listDepth));
|
||||
listDepth++;
|
||||
} else {
|
||||
template.append(segment);
|
||||
}
|
||||
}
|
||||
return template.toString();
|
||||
}
|
||||
|
||||
private static void collect(
|
||||
Class<?> type, String envPrefix, String pathPrefix, int listDepth, Map<String, String> into) {
|
||||
for (RecordComponent component : type.getRecordComponents()) {
|
||||
String property = camelToKebab(component.getName());
|
||||
String path = pathPrefix.isEmpty() ? property : pathPrefix + "." + property;
|
||||
String env = envPrefix + "_" + camelToScreamingSnake(component.getName());
|
||||
Class<?> componentType = component.getType();
|
||||
if (componentType.isRecord()) {
|
||||
collect(componentType, env, path, listDepth, into);
|
||||
continue;
|
||||
}
|
||||
if (List.class.isAssignableFrom(componentType)) {
|
||||
String index = indexLetter(listDepth);
|
||||
Class<?> element = elementTypeOf(component);
|
||||
if (element != null && element.isRecord()) {
|
||||
collect(element, env + "_" + index, path + "[" + index + "]", listDepth + 1, into);
|
||||
} else {
|
||||
into.put(path + "[" + index + "]", env + "_" + index);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
into.put(path, env);
|
||||
}
|
||||
}
|
||||
|
||||
/** {@code N} for the outermost list, {@code M} inside it. No settings field nests deeper. */
|
||||
private static String indexLetter(int depth) {
|
||||
return switch (depth) {
|
||||
case 0 -> "N";
|
||||
case 1 -> "M";
|
||||
default ->
|
||||
throw new IllegalStateException(
|
||||
"list nesting deeper than the environment template can express");
|
||||
};
|
||||
}
|
||||
|
||||
private static Class<?> elementTypeOf(RecordComponent component) {
|
||||
if (component.getGenericType() instanceof ParameterizedType parameterized
|
||||
&& parameterized.getActualTypeArguments()[0] instanceof Class<?> element) {
|
||||
return element;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String camelToKebab(String name) {
|
||||
return name.replaceAll("([a-z0-9])([A-Z])", "$1-$2").toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
private static String camelToScreamingSnake(String name) {
|
||||
return name.replaceAll("([a-z0-9])([A-Z])", "$1_$2").toUpperCase(Locale.ROOT);
|
||||
}
|
||||
}
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.httpclient;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.ClientRuntimeRegistry;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnAvailableEndpoint;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Registers the {@code httpclients} actuator endpoint only when it is actually exposed (design
|
||||
* §27.3).
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class HttpClientManagementAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnAvailableEndpoint(endpoint = HttpClientActuatorEndpoint.class)
|
||||
HttpClientActuatorEndpoint httpClientActuatorEndpoint(ClientRuntimeRegistry runtimes) {
|
||||
return new HttpClientActuatorEndpoint(runtimes);
|
||||
}
|
||||
}
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.httpclient;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.httpclient.observation.HttpClientTagPolicy;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.restclient.BlockingExecutionSupport;
|
||||
import io.micrometer.core.instrument.MeterRegistry;
|
||||
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
|
||||
import java.time.Clock;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Observation vocabulary and the shared execution collaborators (design §25).
|
||||
*
|
||||
* <p>A registry is always present: the platform records the separation between logical calls and
|
||||
* physical attempts unconditionally, because that distinction is what makes a retry-heavy incident
|
||||
* readable afterwards.
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class HttpClientObservationAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
HttpClientTagPolicy httpClientTagPolicy() {
|
||||
return HttpClientTagPolicy.standard();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
BlockingExecutionSupport httpClientExecutionSupport(
|
||||
Clock clock, ObjectProvider<MeterRegistry> meterRegistry) {
|
||||
return BlockingExecutionSupport.standard(
|
||||
clock, meterRegistry.getIfAvailable(SimpleMeterRegistry::new));
|
||||
}
|
||||
}
|
||||
-61
@@ -1,61 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.httpclient;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
/**
|
||||
* The one entry point through which the HTTP Client platform exists at all.
|
||||
*
|
||||
* <p>This is an auto-configuration rather than a component-scanned {@code @Configuration}, and it
|
||||
* lives in a package the composition root's scan explicitly excludes. That is the whole point: when
|
||||
* the master switch is absent or false the class is never processed, so none of the configurations
|
||||
* it imports are discovered either. No property is bound, no transport provider is constructed, no
|
||||
* connection pool, TLS context, credential, thread or gateway exists, and a malformed HTTP setting
|
||||
* in a deployment that never wanted outbound HTTP cannot fail its startup.
|
||||
*
|
||||
* <p>The previous shape had nine independently annotated {@code @Configuration} classes inside the
|
||||
* scanned package. Wrapping them in a conditional parent would have changed nothing — the component
|
||||
* scanner finds each child on its own — so the children had to leave the scan together with the
|
||||
* switch. That is why this is a package move rather than an annotation.
|
||||
*
|
||||
* <p>The actuator endpoint is imported here for the same reason, so a deployment cannot expose a
|
||||
* report about a platform it never enabled.
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnProperty(
|
||||
prefix = HttpClientPlatformSettings.PREFIX,
|
||||
name = "enabled",
|
||||
havingValue = "true")
|
||||
@Import({
|
||||
HttpClientResilienceAutoConfiguration.class,
|
||||
HttpClientSecurityAutoConfiguration.class,
|
||||
HttpClientAuthenticationAutoConfiguration.class,
|
||||
HttpClientObservationAutoConfiguration.class,
|
||||
HttpClientTransportAutoConfiguration.class,
|
||||
HttpClientProfileAutoConfiguration.class,
|
||||
HttpServiceClientAutoConfiguration.class,
|
||||
DynamicTargetAutoConfiguration.class,
|
||||
HttpClientManagementAutoConfiguration.class
|
||||
})
|
||||
public class HttpClientPlatformAutoConfiguration {
|
||||
|
||||
/**
|
||||
* Binds the platform settings once the master switch has already been proven true.
|
||||
*
|
||||
* <p>Binding is deliberately not delegated to {@code @ConfigurationPropertiesScan}: that would
|
||||
* bind — and reject — HTTP client detail settings in deployments that never switched the
|
||||
* capability on.
|
||||
*
|
||||
* @param environment the property sources to bind from
|
||||
* @return the strictly bound settings
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
HttpClientPlatformSettings httpClientPlatformSettings(Environment environment) {
|
||||
return HttpClientPlatformSettingsBinder.bind(environment);
|
||||
}
|
||||
}
|
||||
-242
@@ -1,242 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.httpclient;
|
||||
|
||||
import dev.caskeleton.bootstrap.runtime.startup.StartupFailures;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import org.springframework.boot.context.properties.bind.DefaultValue;
|
||||
|
||||
/**
|
||||
* The whole {@code app.httpclient} surface, bound once, strictly, and only while the platform is
|
||||
* on.
|
||||
*
|
||||
* <p>Deliberately <em>not</em> annotated {@code @ConfigurationProperties}. The composition root's
|
||||
* {@code @ConfigurationPropertiesScan} is not selective and cannot be made selective per
|
||||
* deployment, so an annotated class is registered — and bound, and able to fail startup — in every
|
||||
* deployment, including one that never makes an outbound HTTP call. That is precisely the coupling
|
||||
* the master switch exists to remove, so binding is done by {@link
|
||||
* HttpClientPlatformSettingsBinder} from inside the gated auto-configuration and "off" means "never
|
||||
* bound".
|
||||
*
|
||||
* <p>Clients and dynamic targets are indexed lists carrying their own {@code name} rather than maps
|
||||
* keyed by name. A map key becomes a segment of the environment variable name, and the relaxed
|
||||
* binder normalises that segment: {@code payment-api} and {@code payment_api} arrive as the same
|
||||
* {@code PAYMENT_API}, so one profile would replace the other with nothing said about the one that
|
||||
* was lost. Carrying the name as a value makes the collision visible, and the compact constructor
|
||||
* below rejects it.
|
||||
*
|
||||
* <p>Defaults are deliberately unhelpful for production: the design forbids a profile springing
|
||||
* into existence with generous framework defaults, so anything a production profile must state —
|
||||
* hosts, body limits, TLS profile — has no usable default and is caught by startup validation
|
||||
* instead.
|
||||
*
|
||||
* @param enabled master switch for the whole capability
|
||||
* @param clients the Named Client Profiles this deployment declares
|
||||
* @param dynamicTargets the Dynamic Target policies this deployment declares
|
||||
*/
|
||||
public record HttpClientPlatformSettings(
|
||||
@DefaultValue("false") boolean enabled,
|
||||
@DefaultValue List<ClientSettings> clients,
|
||||
@DefaultValue List<DynamicTargetSettings> dynamicTargets) {
|
||||
|
||||
/** Configuration prefix; the canonical environment form is {@code APP_HTTPCLIENT_*}. */
|
||||
public static final String PREFIX = "app.httpclient";
|
||||
|
||||
public HttpClientPlatformSettings {
|
||||
clients = List.copyOf(clients == null ? List.of() : clients);
|
||||
dynamicTargets = List.copyOf(dynamicTargets == null ? List.of() : dynamicTargets);
|
||||
if (enabled && clients.isEmpty()) {
|
||||
// An active platform with nothing to call still holds transport providers, a resilience
|
||||
// registry and five caller-facing gateways that no caller can reach. That is not a working
|
||||
// deployment with an empty configuration; it is a configuration mistake with a running cost.
|
||||
throw StartupFailures.envValidation(
|
||||
"HTTPCLIENT_ACTIVE_WITHOUT_CLIENTS: "
|
||||
+ PREFIX
|
||||
+ ".enabled is true but no client is declared under "
|
||||
+ PREFIX
|
||||
+ ".clients[*]");
|
||||
}
|
||||
requireDistinctNames(clients.stream().map(ClientSettings::name).toList(), PREFIX + ".clients");
|
||||
requireDistinctNames(
|
||||
dynamicTargets.stream().map(DynamicTargetSettings::name).toList(),
|
||||
PREFIX + ".dynamic-targets");
|
||||
}
|
||||
|
||||
/**
|
||||
* Rejects blank, duplicate and environment-colliding names.
|
||||
*
|
||||
* <p>The normalised form is what an operator has to type as an environment variable segment, so
|
||||
* two names that share it cannot both be configured from the environment even though they are
|
||||
* distinct as properties.
|
||||
*/
|
||||
private static void requireDistinctNames(List<String> names, String where) {
|
||||
List<String> seen = new ArrayList<>();
|
||||
Map<String, String> byNormalisedForm = new LinkedHashMap<>();
|
||||
for (String name : names) {
|
||||
if (name == null || name.isBlank()) {
|
||||
throw StartupFailures.envValidation(where + "[*].name must be non-blank");
|
||||
}
|
||||
if (seen.contains(name)) {
|
||||
throw StartupFailures.envValidation(where + " declares '" + name + "' more than once");
|
||||
}
|
||||
seen.add(name);
|
||||
String normalised = name.toUpperCase(Locale.ROOT).replaceAll("[^A-Z0-9]", "");
|
||||
String previous = byNormalisedForm.putIfAbsent(normalised, name);
|
||||
if (previous != null) {
|
||||
throw StartupFailures.envValidation(
|
||||
where
|
||||
+ " declares '"
|
||||
+ previous
|
||||
+ "' and '"
|
||||
+ name
|
||||
+ "', which normalise to the same environment variable segment '"
|
||||
+ normalised
|
||||
+ "'; one would silently replace the other");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* One Named Client Profile as written in configuration.
|
||||
*
|
||||
* @param name the profile name callers address; carried as a value, not as a map key
|
||||
*/
|
||||
public record ClientSettings(
|
||||
String name,
|
||||
@DefaultValue("TRUSTED") String mode,
|
||||
String baseUrl,
|
||||
@DefaultValue List<String> allowedHosts,
|
||||
@DefaultValue List<Integer> allowedPorts,
|
||||
@DefaultValue("REST_CLIENT") String api,
|
||||
@DefaultValue("APACHE") String transport,
|
||||
// The default transport is Apache, whose classic client is HTTP/1.1 only. A profile that
|
||||
// wants HTTP/2 declares it together with a transport that can deliver it.
|
||||
@DefaultValue({"HTTP_1_1"}) List<String> protocols,
|
||||
@DefaultValue Pool pool,
|
||||
@DefaultValue Timeout timeout,
|
||||
@DefaultValue Redirect redirect,
|
||||
@DefaultValue Request request,
|
||||
@DefaultValue Response response,
|
||||
@DefaultValue Authentication authentication,
|
||||
@DefaultValue Retry retry,
|
||||
@DefaultValue Observability observability,
|
||||
@DefaultValue Tls tls,
|
||||
@DefaultValue Proxy proxy,
|
||||
String experimentalAcknowledgement) {}
|
||||
|
||||
/**
|
||||
* One Dynamic Target policy (design §22).
|
||||
*
|
||||
* <p>Dynamic Target policies are configured separately from Named Client Profiles on purpose:
|
||||
* they are a different security boundary, and sharing a configuration block would invite sharing
|
||||
* a credential. Defaults are the most restrictive useful setting.
|
||||
*
|
||||
* @param name the policy name a caller must quote; an unregistered name is an error rather than a
|
||||
* permissive default
|
||||
*/
|
||||
public record DynamicTargetSettings(
|
||||
String name,
|
||||
@DefaultValue({"https"}) List<String> allowedSchemes,
|
||||
@DefaultValue({"443"}) List<Integer> allowedPorts,
|
||||
@DefaultValue List<String> allowedHostSuffixes,
|
||||
@DefaultValue List<String> allowedHosts,
|
||||
@DefaultValue("0") int maxRedirectHops,
|
||||
@DefaultValue("false") boolean tracePropagation,
|
||||
@DefaultValue List<String> blockedCidrs) {}
|
||||
|
||||
/** Connection pool budget (design §14.2). */
|
||||
public record Pool(
|
||||
@DefaultValue("50") int maxTotalConnections,
|
||||
@DefaultValue("25") int maxConnectionsPerRoute,
|
||||
@DefaultValue("100") int maxPendingAcquires,
|
||||
@DefaultValue("200ms") Duration pendingAcquireTimeout,
|
||||
@DefaultValue("30s") Duration maxIdleTime,
|
||||
@DefaultValue("5m") Duration maxLifeTime,
|
||||
@DefaultValue("5s") Duration validateAfterInactivity,
|
||||
@DefaultValue("15s") Duration evictionInterval,
|
||||
@DefaultValue("5s") Duration shutdownTimeout,
|
||||
@DefaultValue("false") boolean requiresRoutePool,
|
||||
@DefaultValue("false") boolean requiresBoundedPendingQueue) {}
|
||||
|
||||
/** Stage timeouts and total call budget (design §15.1). */
|
||||
public record Timeout(
|
||||
@DefaultValue("300ms") Duration dns,
|
||||
@DefaultValue("500ms") Duration connect,
|
||||
@DefaultValue("1s") Duration tlsHandshake,
|
||||
@DefaultValue("500ms") Duration proxyConnect,
|
||||
@DefaultValue("1s") Duration requestWriteIdle,
|
||||
@DefaultValue("2s") Duration responseHeader,
|
||||
@DefaultValue("3s") Duration readIdle,
|
||||
@DefaultValue("4s") Duration totalCall,
|
||||
@DefaultValue("30s") Duration streamingIdle) {}
|
||||
|
||||
/** Redirect policy; disabled by default (design §12.4). */
|
||||
public record Redirect(
|
||||
@DefaultValue("false") boolean enabled,
|
||||
@DefaultValue("0") int maxHops,
|
||||
@DefaultValue("false") boolean allowCrossOrigin) {}
|
||||
|
||||
/** Request-side budget. {@code maxBodyBytes} has no safe default and must be declared. */
|
||||
public record Request(
|
||||
@DefaultValue("0") long maxBodyBytes, @DefaultValue("false") boolean compression) {}
|
||||
|
||||
/** Response-side budget (design §23.2). */
|
||||
public record Response(
|
||||
@DefaultValue("5242880") long maxWireBytes,
|
||||
@DefaultValue("10485760") long maxDecodedBytes,
|
||||
@DefaultValue({"application/json", "application/problem+json"})
|
||||
List<String> allowedContentTypes) {}
|
||||
|
||||
/** Declared authentication (design §20.1). */
|
||||
public record Authentication(
|
||||
@DefaultValue("NONE") String type,
|
||||
String registrationId,
|
||||
@DefaultValue List<String> scopes,
|
||||
String audience,
|
||||
String headerName,
|
||||
String secretReference) {}
|
||||
|
||||
/** Retry budget shape (design §17). */
|
||||
public record Retry(
|
||||
@DefaultValue("none") String policy,
|
||||
@DefaultValue("1") int maxAttempts,
|
||||
@DefaultValue("50ms") Duration baseBackoff,
|
||||
@DefaultValue("200ms") Duration maxBackoff,
|
||||
@DefaultValue("FULL") String jitter,
|
||||
@DefaultValue("HONOR") String retryAfter,
|
||||
String budget) {}
|
||||
|
||||
/** Per-profile observability switches (design §25). */
|
||||
public record Observability(
|
||||
@DefaultValue("true") boolean operationNameRequired,
|
||||
@DefaultValue("false") boolean fullUrlRecording,
|
||||
@DefaultValue("false") boolean bodyLogging) {}
|
||||
|
||||
/**
|
||||
* TLS declaration (design §21).
|
||||
*
|
||||
* <p>{@code trustAll} and {@code allowPlainHttp} exist purely so an operator's unsafe intent is
|
||||
* representable and therefore rejectable at startup. Nothing acts on a true value.
|
||||
*/
|
||||
public record Tls(
|
||||
String profileId,
|
||||
@DefaultValue({"TLSv1.3", "TLSv1.2"}) List<String> protocols,
|
||||
@DefaultValue("true") boolean hostnameVerification,
|
||||
@DefaultValue("false") boolean trustAll,
|
||||
@DefaultValue("false") boolean allowPlainHttp,
|
||||
String trustMaterialReference,
|
||||
String keyMaterialReference) {}
|
||||
|
||||
/** Forward proxy declaration (design §24.3). */
|
||||
public record Proxy(
|
||||
@DefaultValue("false") boolean enabled,
|
||||
@DefaultValue("") String host,
|
||||
@DefaultValue("0") int port,
|
||||
@DefaultValue("HTTP") String type,
|
||||
String credentialProvider,
|
||||
@DefaultValue("500ms") Duration connectTimeout,
|
||||
@DefaultValue("false") boolean importAmbientNoProxy) {}
|
||||
}
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.httpclient;
|
||||
|
||||
import dev.caskeleton.bootstrap.autoconfigure.StrictSettingsBinder;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.env.SystemEnvironmentPropertySource;
|
||||
|
||||
/**
|
||||
* Binds {@link HttpClientPlatformSettings} strictly, and only when asked.
|
||||
*
|
||||
* <p>The mechanics live in {@link StrictSettingsBinder} (BOOT-011). What stays here is this
|
||||
* platform's one genuine difference: strictness needs two mechanisms because one does not cover
|
||||
* both surfaces.
|
||||
*
|
||||
* <p>Property sources that enumerate their keys in property form — YAML, properties files, test
|
||||
* overrides — are checked by the shared binder's unbound-element handler. The system environment is
|
||||
* excluded from it and checked by {@link HttpClientEnvironmentKeys#rejectUnrecognised} instead:
|
||||
* Spring enumerates {@code APP_HTTPCLIENT_CLIENTS_0_BASE_URL} as {@code ...clients[0].base.url}
|
||||
* while binding it as {@code ...clients[0].base-url}, so leaving it to the handler would reject
|
||||
* every correctly spelled variable and still miss the misspelled ones.
|
||||
*/
|
||||
final class HttpClientPlatformSettingsBinder {
|
||||
|
||||
private HttpClientPlatformSettingsBinder() {}
|
||||
|
||||
static HttpClientPlatformSettings bind(Environment environment) {
|
||||
HttpClientEnvironmentKeys.rejectUnrecognised(environment);
|
||||
return StrictSettingsBinder.bind(
|
||||
environment,
|
||||
HttpClientPlatformSettings.PREFIX,
|
||||
HttpClientPlatformSettings.class,
|
||||
source -> !(source.getUnderlyingSource() instanceof SystemEnvironmentPropertySource));
|
||||
}
|
||||
}
|
||||
-117
@@ -1,117 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.httpclient;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.httpclient.api.ClientProfileName;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.auth.CredentialProviderRegistry;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.auth.ReactiveRequestCredentialProvider;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.ClientApiType;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.ClientProfile;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.ClientRuntime;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.ClientRuntimeRegistry;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.RuntimeEnvironment;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.RuntimeGeneration;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.TransportType;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.resilience.ResilienceRegistry;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.restclient.BlockingExecutionSupport;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.restclient.RestClientRuntimeFactory;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.security.TlsPolicyValidator;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.transport.BlockingTransportProvider;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.transport.ReactiveTransportProvider;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.transport.TransportLifecycleListener;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.webclient.WebClientRuntimeFactory;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.random.RandomGenerator;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
/**
|
||||
* Binds profiles, validates them, and publishes the runtime registry (design §27.1, §27.2).
|
||||
*
|
||||
* <p>Validation runs before any runtime is built, so an unsafe configuration cannot create a
|
||||
* connection pool, a TLS context, or a credential before failing. With no {@code http-clients}
|
||||
* entries the registry is empty and the capability holds no resources at all.
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class HttpClientProfileAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
HttpClientProfileFactory httpClientProfileFactory() {
|
||||
return new HttpClientProfileFactory();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
HttpClientStartupValidator httpClientStartupValidator(TlsPolicyValidator tlsPolicyValidator) {
|
||||
// Injected rather than constructed, so a deployment that replaces the TlsPolicyValidator bean
|
||||
// replaces the one startup validation uses too.
|
||||
return new HttpClientStartupValidator(tlsPolicyValidator);
|
||||
}
|
||||
|
||||
@Bean(destroyMethod = "close")
|
||||
@ConditionalOnMissingBean
|
||||
ClientRuntimeRegistry httpClientRuntimeRegistry(
|
||||
Environment environment,
|
||||
HttpClientPlatformSettings properties,
|
||||
HttpClientProfileFactory profileFactory,
|
||||
HttpClientStartupValidator startupValidator,
|
||||
Map<TransportType, BlockingTransportProvider> httpClientBlockingTransportProviders,
|
||||
Map<TransportType, ReactiveTransportProvider> httpClientReactiveTransportProviders,
|
||||
ResilienceRegistry resilienceRegistry,
|
||||
CredentialProviderRegistry credentialProviders,
|
||||
ReactiveRequestCredentialProvider reactiveCredentialProvider,
|
||||
BlockingExecutionSupport executionSupport,
|
||||
TransportLifecycleListener lifecycleListener) {
|
||||
|
||||
Map<ClientProfileName, ClientProfile> profiles = profileFactory.create(properties);
|
||||
startupValidator.validate(profiles, runtimeEnvironment(environment));
|
||||
|
||||
RestClientRuntimeFactory blockingFactory =
|
||||
new RestClientRuntimeFactory(
|
||||
httpClientBlockingTransportProviders,
|
||||
resilienceRegistry,
|
||||
credentialProviders,
|
||||
executionSupport,
|
||||
lifecycleListener,
|
||||
RandomGenerator.getDefault());
|
||||
WebClientRuntimeFactory reactiveFactory =
|
||||
new WebClientRuntimeFactory(
|
||||
httpClientReactiveTransportProviders,
|
||||
resilienceRegistry,
|
||||
reactiveCredentialProvider,
|
||||
executionSupport,
|
||||
lifecycleListener,
|
||||
RandomGenerator.getDefault());
|
||||
|
||||
Map<ClientProfileName, ClientRuntime> runtimes = new LinkedHashMap<>();
|
||||
profiles.forEach(
|
||||
(name, profile) ->
|
||||
runtimes.put(
|
||||
name,
|
||||
profile.api() == ClientApiType.WEB_CLIENT
|
||||
? reactiveFactory.create(profile, new RuntimeGeneration(1))
|
||||
: blockingFactory.create(profile, new RuntimeGeneration(1))));
|
||||
return new ClientRuntimeRegistry(runtimes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps the active profiles onto the HTTP client platform's own production/non-production split.
|
||||
*
|
||||
* <p>Two types named {@code RuntimeEnvironment} meet here and they are different concepts, so the
|
||||
* shared one is spelled out in full rather than imported. {@code
|
||||
* dev.caskeleton.shared.runtime.RuntimeEnvironment} is the repository-wide profile vocabulary —
|
||||
* the single answer to "which environment is this?" (BOOT-002). The imported {@code
|
||||
* ...httpclient.profile.RuntimeEnvironment} is this adapter's binary hardening switch. Deriving
|
||||
* the second from the first is the point: the adapter keeps its own vocabulary while the question
|
||||
* "is this production?" is answered in exactly one place.
|
||||
*/
|
||||
private RuntimeEnvironment runtimeEnvironment(Environment environment) {
|
||||
return dev.caskeleton.shared.runtime.RuntimeEnvironment.isProductionActive(
|
||||
List.of(environment.getActiveProfiles()))
|
||||
? RuntimeEnvironment.PRODUCTION
|
||||
: RuntimeEnvironment.NON_PRODUCTION;
|
||||
}
|
||||
}
|
||||
-153
@@ -1,153 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.httpclient;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.httpclient.api.ClientProfileName;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.AuthenticationSettings;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.AuthenticationType;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.ClientApiType;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.ClientMode;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.ClientObservabilitySettings;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.ClientProfile;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.HttpProtocol;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.JitterStrategy;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.PoolSettings;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.ProxySettings;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.ProxyType;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.RedirectSettings;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.RequestLimits;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.ResponseLimits;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.RetryAfterPolicy;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.RetrySettings;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.TimeoutSettings;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.TlsSettings;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.TransportType;
|
||||
import java.net.URI;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Turns bound properties into immutable profiles (design §11).
|
||||
*
|
||||
* <p>Conversion never repairs a configuration. An absent host allowlist stays absent so the
|
||||
* validator can report it, rather than being silently derived from the base URL — which would make
|
||||
* an unstated security decision on the operator's behalf.
|
||||
*/
|
||||
public final class HttpClientProfileFactory {
|
||||
|
||||
public Map<ClientProfileName, ClientProfile> create(HttpClientPlatformSettings properties) {
|
||||
Map<ClientProfileName, ClientProfile> profiles = new LinkedHashMap<>();
|
||||
for (HttpClientPlatformSettings.ClientSettings client : properties.clients()) {
|
||||
profiles.put(new ClientProfileName(client.name()), toProfile(client));
|
||||
}
|
||||
return Map.copyOf(profiles);
|
||||
}
|
||||
|
||||
public ClientProfile toProfile(HttpClientPlatformSettings.ClientSettings client) {
|
||||
return new ClientProfile(
|
||||
new ClientProfileName(client.name()),
|
||||
ClientMode.valueOf(client.mode().toUpperCase(Locale.ROOT)),
|
||||
client.baseUrl() == null ? null : URI.create(client.baseUrl()),
|
||||
Set.copyOf(client.allowedHosts()),
|
||||
Set.copyOf(client.allowedPorts()),
|
||||
ClientApiType.valueOf(client.api().toUpperCase(Locale.ROOT)),
|
||||
TransportType.valueOf(client.transport().toUpperCase(Locale.ROOT)),
|
||||
client.protocols().stream()
|
||||
.map(protocol -> HttpProtocol.valueOf(protocol.toUpperCase(Locale.ROOT)))
|
||||
.collect(Collectors.toUnmodifiableSet()),
|
||||
pool(client.pool()),
|
||||
timeout(client.timeout()),
|
||||
new RedirectSettings(
|
||||
client.redirect().enabled(),
|
||||
client.redirect().maxHops(),
|
||||
client.redirect().allowCrossOrigin()),
|
||||
new RequestLimits(client.request().maxBodyBytes(), client.request().compression()),
|
||||
new ResponseLimits(
|
||||
client.response().maxWireBytes(),
|
||||
client.response().maxDecodedBytes(),
|
||||
Set.copyOf(client.response().allowedContentTypes())),
|
||||
authentication(client.authentication()),
|
||||
retry(client.retry()),
|
||||
new ClientObservabilitySettings(
|
||||
client.observability().operationNameRequired(),
|
||||
client.observability().fullUrlRecording(),
|
||||
client.observability().bodyLogging()),
|
||||
tls(client.tls()),
|
||||
proxy(client.proxy()),
|
||||
Optional.ofNullable(client.experimentalAcknowledgement()));
|
||||
}
|
||||
|
||||
private PoolSettings pool(HttpClientPlatformSettings.Pool pool) {
|
||||
return new PoolSettings(
|
||||
pool.maxTotalConnections(),
|
||||
pool.maxConnectionsPerRoute(),
|
||||
pool.maxPendingAcquires(),
|
||||
pool.pendingAcquireTimeout(),
|
||||
pool.maxIdleTime(),
|
||||
pool.maxLifeTime(),
|
||||
pool.validateAfterInactivity(),
|
||||
pool.evictionInterval(),
|
||||
pool.shutdownTimeout(),
|
||||
pool.requiresRoutePool(),
|
||||
pool.requiresBoundedPendingQueue());
|
||||
}
|
||||
|
||||
private TimeoutSettings timeout(HttpClientPlatformSettings.Timeout timeout) {
|
||||
return new TimeoutSettings(
|
||||
timeout.dns(),
|
||||
timeout.connect(),
|
||||
timeout.tlsHandshake(),
|
||||
timeout.proxyConnect(),
|
||||
timeout.requestWriteIdle(),
|
||||
timeout.responseHeader(),
|
||||
timeout.readIdle(),
|
||||
timeout.totalCall(),
|
||||
timeout.streamingIdle());
|
||||
}
|
||||
|
||||
private AuthenticationSettings authentication(
|
||||
HttpClientPlatformSettings.Authentication authentication) {
|
||||
return new AuthenticationSettings(
|
||||
AuthenticationType.valueOf(authentication.type().toUpperCase(Locale.ROOT)),
|
||||
Optional.ofNullable(authentication.registrationId()),
|
||||
Set.copyOf(authentication.scopes()),
|
||||
Optional.ofNullable(authentication.audience()),
|
||||
Optional.ofNullable(authentication.headerName()),
|
||||
Optional.ofNullable(authentication.secretReference()));
|
||||
}
|
||||
|
||||
private RetrySettings retry(HttpClientPlatformSettings.Retry retry) {
|
||||
return new RetrySettings(
|
||||
retry.policy(),
|
||||
retry.maxAttempts(),
|
||||
retry.baseBackoff(),
|
||||
retry.maxBackoff(),
|
||||
JitterStrategy.valueOf(retry.jitter().toUpperCase(Locale.ROOT)),
|
||||
RetryAfterPolicy.valueOf(retry.retryAfter().toUpperCase(Locale.ROOT)),
|
||||
Optional.ofNullable(retry.budget()));
|
||||
}
|
||||
|
||||
private TlsSettings tls(HttpClientPlatformSettings.Tls tls) {
|
||||
return new TlsSettings(
|
||||
Optional.ofNullable(tls.profileId()),
|
||||
Set.copyOf(tls.protocols()),
|
||||
tls.hostnameVerification(),
|
||||
tls.trustAll(),
|
||||
tls.allowPlainHttp(),
|
||||
Optional.ofNullable(tls.trustMaterialReference()),
|
||||
Optional.ofNullable(tls.keyMaterialReference()));
|
||||
}
|
||||
|
||||
private ProxySettings proxy(HttpClientPlatformSettings.Proxy proxy) {
|
||||
return new ProxySettings(
|
||||
proxy.enabled(),
|
||||
proxy.host(),
|
||||
proxy.port(),
|
||||
ProxyType.valueOf(proxy.type().toUpperCase(Locale.ROOT)),
|
||||
Optional.ofNullable(proxy.credentialProvider()),
|
||||
proxy.connectTimeout(),
|
||||
proxy.importAmbientNoProxy());
|
||||
}
|
||||
}
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.httpclient;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.httpclient.resilience.ResilienceRegistry;
|
||||
import java.time.Clock;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Per-profile circuit breakers, rate limiters, bulkheads, and retry budgets (design §18).
|
||||
*
|
||||
* <p>The registry is shared but its components are keyed per profile, so a failing upstream cannot
|
||||
* open a breaker or drain a budget that belongs to a healthy one.
|
||||
*
|
||||
* <p>The {@link Clock} comes from the composition root rather than from here. A fallback clock
|
||||
* declared beside the resilience registry was harmless while this configuration was scanned
|
||||
* unconditionally; behind the master switch it would have made the application's clock disappear
|
||||
* whenever outbound HTTP was off, taking Redis, idempotency and the Fileserver with it.
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class HttpClientResilienceAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
ResilienceRegistry httpClientResilienceRegistry(Clock clock) {
|
||||
return ResilienceRegistry.withDefaults(clock);
|
||||
}
|
||||
}
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.httpclient;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.httpclient.security.TlsMaterialProvider;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.security.TlsPolicyValidator;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* TLS material and policy (design §21, §27.1).
|
||||
*
|
||||
* <p>The default material provider supports only the JVM trust store. A deployment that needs a
|
||||
* custom CA or a client certificate supplies its own loader bean, which keeps secret retrieval out
|
||||
* of this module and out of configuration files.
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class HttpClientSecurityAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
TlsPolicyValidator httpClientTlsPolicyValidator() {
|
||||
return new TlsPolicyValidator();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
TlsMaterialProvider httpClientTlsMaterialProvider() {
|
||||
return TlsMaterialProvider.jvmTrustStore();
|
||||
}
|
||||
}
|
||||
-123
@@ -1,123 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.httpclient;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.httpclient.api.ClientProfileName;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.api.error.HttpConfigurationException;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.api.error.HttpFailureMetadata;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.AuthenticationType;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.ClientApiType;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.ClientProfile;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.ClientProfileValidator;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.ClientProfileViolation;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.RuntimeEnvironment;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.security.TlsPolicyValidator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* One fail-closed startup gate for every configured profile (design §27.2).
|
||||
*
|
||||
* <p>All violations are collected before failing so an operator sees the whole configuration
|
||||
* problem at once. Failing on the first one turns a five-minute fix into five deploy cycles.
|
||||
*/
|
||||
public final class HttpClientStartupValidator {
|
||||
|
||||
/** Mechanisms the reactive credential registry can serve without blocking an event loop. */
|
||||
private static final Set<AuthenticationType> NON_BLOCKING_AUTHENTICATION =
|
||||
Set.of(
|
||||
AuthenticationType.NONE,
|
||||
AuthenticationType.BASIC,
|
||||
AuthenticationType.API_KEY_HEADER,
|
||||
AuthenticationType.STATIC_BEARER);
|
||||
|
||||
private final ClientProfileValidator profileValidator = new ClientProfileValidator();
|
||||
private final TlsPolicyValidator tlsPolicyValidator;
|
||||
|
||||
/** Uses the platform's own default policy. */
|
||||
public HttpClientStartupValidator() {
|
||||
this(new TlsPolicyValidator());
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses the container-managed validator.
|
||||
*
|
||||
* <p>{@code HttpClientSecurityAutoConfiguration} publishes a {@code TlsPolicyValidator} bean that
|
||||
* a deployment can replace, and this class used to construct its own instead — so overriding the
|
||||
* bean changed what {@code TlsMaterialProvider} enforced while startup validation went on
|
||||
* applying the default. Two validators, one of them ignored, is worse than either alone.
|
||||
*
|
||||
* @param tlsPolicyValidator the validator the container published
|
||||
*/
|
||||
public HttpClientStartupValidator(TlsPolicyValidator tlsPolicyValidator) {
|
||||
this.tlsPolicyValidator = Objects.requireNonNull(tlsPolicyValidator, "tls policy validator");
|
||||
}
|
||||
|
||||
public void validate(
|
||||
Map<ClientProfileName, ClientProfile> profiles, RuntimeEnvironment environment) {
|
||||
Objects.requireNonNull(profiles, "profiles");
|
||||
Objects.requireNonNull(environment, "runtime environment");
|
||||
|
||||
List<String> violations = new ArrayList<>();
|
||||
Set<String> seenNames = new HashSet<>();
|
||||
|
||||
profiles.forEach(
|
||||
(name, profile) -> {
|
||||
if (!seenNames.add(name.value())) {
|
||||
violations.add("DUPLICATE_CLIENT_NAME profile=" + name.value());
|
||||
}
|
||||
profileValidator.validate(profile, environment).stream()
|
||||
.map(ClientProfileViolation::toString)
|
||||
.forEach(violations::add);
|
||||
reactiveAuthenticationViolation(profile).ifPresent(violations::add);
|
||||
tlsPolicyValidator
|
||||
.validate(profile.tls())
|
||||
.forEach(
|
||||
violation ->
|
||||
violations.add(
|
||||
violation.code()
|
||||
+ " profile="
|
||||
+ name.value()
|
||||
+ " setting="
|
||||
+ violation.detail()));
|
||||
});
|
||||
|
||||
if (!violations.isEmpty()) {
|
||||
throw new HttpConfigurationException(
|
||||
"http client configuration is not safe to start:\n " + String.join("\n ", violations),
|
||||
HttpFailureMetadata.startup(new ClientProfileName("startup")));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refuses a reactive profile whose declared authentication has no non-blocking implementation.
|
||||
*
|
||||
* <p>Only OAuth2 is affected: a token load is a network round trip, and the only provider that
|
||||
* performs it blocks. BASIC, API keys and static bearers resolve a secret and format a header,
|
||||
* which the reactive registry can do without leaving the event loop.
|
||||
*
|
||||
* <p>Before this check the combination started cleanly and then sent every request with no
|
||||
* credential, because the composition root wired a no-auth provider for every reactive profile.
|
||||
* An unauthenticated request that the upstream rejects is a much worse failure than a context
|
||||
* that refuses to start, and it is much harder to attribute.
|
||||
*/
|
||||
private Optional<String> reactiveAuthenticationViolation(ClientProfile profile) {
|
||||
if (profile.api() != ClientApiType.WEB_CLIENT) {
|
||||
return Optional.empty();
|
||||
}
|
||||
AuthenticationType type = profile.authentication().type();
|
||||
if (!NON_BLOCKING_AUTHENTICATION.contains(type)) {
|
||||
return Optional.of(
|
||||
"REACTIVE_AUTHENTICATION_UNSUPPORTED profile="
|
||||
+ profile.name().value()
|
||||
+ " type="
|
||||
+ type
|
||||
+ " supported="
|
||||
+ NON_BLOCKING_AUTHENTICATION);
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
-110
@@ -1,110 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.httpclient;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.httpclient.apache.ApacheBlockingTransportProvider;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.dynamic.CallScopedDnsPin;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.jdk.JdkBlockingTransportProvider;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.ClientMode;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.ClientProfile;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.TransportType;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.reactor.ReactorNettyTransportProvider;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.security.SslContextMaterial;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.security.TlsMaterialProvider;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.security.TlsProfile;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.security.TlsProfileId;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.transport.BlockingTransportProvider;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.transport.ReactiveTransportProvider;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.transport.TransportLifecycleListener;
|
||||
import io.micrometer.core.instrument.MeterRegistry;
|
||||
import java.net.InetAddress;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Registers the Stable transports (design §6.2, §27.1).
|
||||
*
|
||||
* <p>Jetty HTTP/3 is deliberately absent: design D-08 and §32.7 require the Experimental transport
|
||||
* to be opted into explicitly, and auto-registering it here would make "Experimental" a label
|
||||
* rather than a boundary.
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class HttpClientTransportAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
TransportLifecycleListener httpClientTransportLifecycleListener() {
|
||||
return TransportLifecycleListener.noop();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(name = "httpClientBlockingTransportProviders")
|
||||
Map<TransportType, BlockingTransportProvider> httpClientBlockingTransportProviders(
|
||||
ObjectProvider<MeterRegistry> meterRegistry, TlsMaterialProvider tlsMaterialProvider) {
|
||||
Function<ClientProfile, Optional<SslContextMaterial>> tlsResolver =
|
||||
profile -> materialize(profile, tlsMaterialProvider);
|
||||
|
||||
Map<TransportType, BlockingTransportProvider> providers = new EnumMap<>(TransportType.class);
|
||||
providers.put(
|
||||
TransportType.APACHE,
|
||||
new ApacheBlockingTransportProvider(
|
||||
Optional.ofNullable(meterRegistry.getIfAvailable()),
|
||||
tlsResolver,
|
||||
HttpClientTransportAutoConfiguration::dynamicTargetPinning));
|
||||
providers.put(TransportType.JDK, new JdkBlockingTransportProvider(tlsResolver));
|
||||
return Map.copyOf(providers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Supplies the call-scoped pinned addresses to a DYNAMIC profile's transport.
|
||||
*
|
||||
* <p>This used to be {@code profile -> Optional.empty()} for every profile, which silently
|
||||
* discarded the entire SSRF address validation: the dynamic gateway resolved the host, rejected
|
||||
* forbidden answers, pinned the approved addresses — and then the transport resolved the hostname
|
||||
* again and connected to whatever came back the second time. The check ran, produced a correct
|
||||
* verdict, and had no effect on where the socket went.
|
||||
*
|
||||
* <p>Only DYNAMIC profiles are pinned. A trusted profile connects to a base URL an operator
|
||||
* configured, not to a URL a caller supplied, so its destination is not attacker-controlled and
|
||||
* pinning it would break ordinary DNS-based failover.
|
||||
*/
|
||||
private static Optional<Function<String, List<InetAddress>>> dynamicTargetPinning(
|
||||
ClientProfile profile) {
|
||||
if (profile.mode() != ClientMode.DYNAMIC) {
|
||||
return Optional.empty();
|
||||
}
|
||||
return Optional.of(CallScopedDnsPin::addressesFor);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(name = "httpClientReactiveTransportProviders")
|
||||
Map<TransportType, ReactiveTransportProvider> httpClientReactiveTransportProviders(
|
||||
ObjectProvider<MeterRegistry> meterRegistry, TlsMaterialProvider tlsMaterialProvider) {
|
||||
Map<TransportType, ReactiveTransportProvider> providers = new EnumMap<>(TransportType.class);
|
||||
providers.put(
|
||||
TransportType.REACTOR_NETTY,
|
||||
new ReactorNettyTransportProvider(
|
||||
Optional.ofNullable(meterRegistry.getIfAvailable()),
|
||||
profile -> materialize(profile, tlsMaterialProvider),
|
||||
HttpClientTransportAutoConfiguration::dynamicTargetPinning));
|
||||
return Map.copyOf(providers);
|
||||
}
|
||||
|
||||
/** Only a profile that names a TLS profile gets custom material; others use the JVM defaults. */
|
||||
private Optional<SslContextMaterial> materialize(
|
||||
ClientProfile profile, TlsMaterialProvider provider) {
|
||||
return profile
|
||||
.tls()
|
||||
.profileId()
|
||||
.filter(
|
||||
ignored ->
|
||||
profile.tls().trustMaterialReference().isPresent()
|
||||
|| profile.tls().keyMaterialReference().isPresent())
|
||||
.map(id -> provider.materialize(TlsProfile.from(profile.tls(), new TlsProfileId(id))));
|
||||
}
|
||||
}
|
||||
-90
@@ -1,90 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.httpclient;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.httpclient.profile.ClientRuntimeRegistry;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.restclient.BlockingAttemptExecutor;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.restclient.BlockingStreamingGateway;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.restclient.DefaultGenericHttpGateway;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.restclient.GenericHttpGateway;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.service.DefaultHttpServiceRegistry;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.service.DefaultReactiveHttpServiceRegistry;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.service.HttpServiceRegistry;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.service.ReactiveHttpServiceRegistry;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.webclient.DefaultReactiveHttpGateway;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.webclient.DefaultReactiveSseGateway;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.webclient.ReactiveAttemptExecutor;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.webclient.ReactiveSseGateway;
|
||||
import dev.caskeleton.adapter.outbound.httpclient.webclient.ReactiveStreamingGateway;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Publishes the caller-facing entry points (design §9, §27.1).
|
||||
*
|
||||
* <p>H1 typed registries are the intended default; the H2 gateways are published beside them for
|
||||
* the genuinely dynamic cases. H3 lives in its own configuration with its own policy, so it cannot
|
||||
* be reached by accident from here.
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
public class HttpServiceClientAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
BlockingAttemptExecutor httpClientBlockingAttemptExecutor() {
|
||||
return new BlockingAttemptExecutor();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
ReactiveAttemptExecutor httpClientReactiveAttemptExecutor() {
|
||||
return new ReactiveAttemptExecutor();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
GenericHttpGateway genericHttpGateway(
|
||||
ClientRuntimeRegistry runtimes, BlockingAttemptExecutor executor) {
|
||||
return new DefaultGenericHttpGateway(runtimes, executor);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
DefaultReactiveHttpGateway reactiveHttpGateway(
|
||||
ClientRuntimeRegistry runtimes, ReactiveAttemptExecutor executor) {
|
||||
return new DefaultReactiveHttpGateway(runtimes, executor);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
HttpServiceRegistry httpServiceRegistry(
|
||||
ClientRuntimeRegistry runtimes, GenericHttpGateway genericHttpGateway) {
|
||||
// The typed registry runs its calls through the generic gateway, so a typed client and a
|
||||
// generic exchange are the same execution path rather than two that resemble each other.
|
||||
return new DefaultHttpServiceRegistry(runtimes, genericHttpGateway);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
ReactiveHttpServiceRegistry reactiveHttpServiceRegistry(
|
||||
ClientRuntimeRegistry runtimes, DefaultReactiveHttpGateway reactiveHttpGateway) {
|
||||
return new DefaultReactiveHttpServiceRegistry(runtimes, reactiveHttpGateway);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
BlockingStreamingGateway blockingStreamingGateway(ClientRuntimeRegistry runtimes) {
|
||||
return new BlockingStreamingGateway(runtimes);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
ReactiveStreamingGateway reactiveStreamingGateway(ClientRuntimeRegistry runtimes) {
|
||||
return new ReactiveStreamingGateway(runtimes);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
ReactiveSseGateway reactiveSseGateway(ClientRuntimeRegistry runtimes) {
|
||||
return new DefaultReactiveSseGateway(runtimes);
|
||||
}
|
||||
}
|
||||
+4
-9
@@ -4,6 +4,7 @@ import dev.caskeleton.application.idempotency.IdempotencyExecutor;
|
||||
import dev.caskeleton.application.idempotency.IdempotencyStorePort;
|
||||
import java.time.Clock;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
@@ -12,19 +13,13 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
* Wires idempotency execution. {@code @EnableScheduling} activates the {@code IdempotencyReaper}'s
|
||||
* scheduled purge. See README for the design rationale.
|
||||
*/
|
||||
@Configuration
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableScheduling
|
||||
@EnableConfigurationProperties(IdempotencySettings.class)
|
||||
@ConditionalOnProperty(name = "ca-skeleton.capabilities.idempotency.provider", havingValue = "jdbc")
|
||||
public class IdempotencyConfig {
|
||||
|
||||
@Bean
|
||||
public Clock systemClock() {
|
||||
return Clock.systemUTC();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(
|
||||
name = "ca-skeleton.capabilities.idempotency.provider",
|
||||
havingValue = "jdbc")
|
||||
public IdempotencyExecutor idempotencyExecutor(
|
||||
IdempotencyStorePort store, Clock clock, IdempotencySettings properties) {
|
||||
return new IdempotencyExecutor(store, clock, properties.ttl());
|
||||
|
||||
+4
-2
@@ -7,9 +7,10 @@ import dev.caskeleton.application.idempotency.v2.IdempotencyStorePortV2;
|
||||
import dev.caskeleton.bootstrap.runtime.startup.StartupFailures;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.beans.factory.SmartInitializingSingleton;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* Fail-fast exclusivity guard for the JDBC V1 provider and the two owner-safe V2 providers.
|
||||
@@ -33,8 +34,9 @@ import org.springframework.context.annotation.Configuration;
|
||||
* application.idempotency.v2} over the contract the stores implement, so the requirement is real
|
||||
* again rather than a demand nothing could satisfy.
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@EnableConfigurationProperties(IdempotencyProviderSettings.class)
|
||||
@Import({IdempotencyConfig.class, PostgreSqlIdempotencyProviderConfig.class})
|
||||
public class IdempotencyProviderSelectionConfig {
|
||||
|
||||
@Bean
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ public record IdempotencyProviderSettings(Provider provider) {
|
||||
|
||||
@ConstructorBinding
|
||||
public IdempotencyProviderSettings {
|
||||
provider = provider == null ? Provider.JDBC : provider;
|
||||
provider = provider == null ? Provider.DISABLED : provider;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+6
-25
@@ -1,28 +1,19 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.idempotency;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.persistence.postgresql.idempotency.PostgreSqlOwnerSafeIdempotencyStore;
|
||||
import dev.caskeleton.application.idempotency.v2.IdempotencyExecutorV2;
|
||||
import dev.caskeleton.application.idempotency.v2.IdempotencyStorePortV2;
|
||||
import java.time.Duration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.jdbc.core.JdbcOperations;
|
||||
|
||||
/**
|
||||
* Composes the owner-safe V2 request-replay store on the primary PostgreSQL data source.
|
||||
* Composes the application-owned V2 request-replay lifecycle over the selected PostgreSQL store.
|
||||
*
|
||||
* <p>This is the selector the store never had. It carries no Spring stereotype of its own — both
|
||||
* composition roots scan {@code dev.caskeleton.adapter}, and a stereotype there would register the
|
||||
* store in every deployment including the ones running another provider or another vendor entirely
|
||||
* — so the store can only become a bean here, under an explicit provider choice.
|
||||
*
|
||||
* <p>The two conditions the choice needs are not both checkable at composition time. The property
|
||||
* is checked here; the vendor and the capability's schema activation are checked by the store's
|
||||
* guard before any statement runs, because both are facts about the database rather than about the
|
||||
* configuration, and a startup probe would answer them once for a connection pool that outlives the
|
||||
* answer. A wrong vendor or an unsanctioned stream therefore fails the first mutation closed rather
|
||||
* than corrupting a row.
|
||||
* <p>The concrete store is assembled by the JPA leaf under the same provider selector and exposed
|
||||
* only as {@code IdempotencyStorePortV2}. This application configuration owns the lifecycle policy
|
||||
* layered over that port; it does not construct or import the PostgreSQL implementation.
|
||||
*
|
||||
* <p>The lifecycle bounds come from the single registered idempotency TTL rather than from five new
|
||||
* keys. The processing lease is deliberately not derived from it: a lease is how long one attempt
|
||||
@@ -30,6 +21,7 @@ import org.springframework.jdbc.core.JdbcOperations;
|
||||
* not of how long its result stays replayable.
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableConfigurationProperties(IdempotencySettings.class)
|
||||
@ConditionalOnProperty(
|
||||
name = "ca-skeleton.capabilities.idempotency.provider",
|
||||
havingValue = "postgresql")
|
||||
@@ -49,17 +41,6 @@ public class PostgreSqlIdempotencyProviderConfig {
|
||||
/** The replay policy revision this schema stream enforces. */
|
||||
private static final int POLICY_REVISION = 2;
|
||||
|
||||
/**
|
||||
* The owner-safe store, on the application's own primary data source.
|
||||
*
|
||||
* @param jdbc the primary {@code JdbcOperations}; the store's transaction guard identifies its
|
||||
* data source from it so a transaction opened on a different one cannot pass
|
||||
*/
|
||||
@Bean
|
||||
IdempotencyStorePortV2 postgreSqlOwnerSafeIdempotencyStore(JdbcOperations jdbc) {
|
||||
return new PostgreSqlOwnerSafeIdempotencyStore(jdbc);
|
||||
}
|
||||
|
||||
/**
|
||||
* The request-replay lifecycle driven over the store.
|
||||
*
|
||||
|
||||
+7
-6
@@ -33,13 +33,14 @@ public final class DataSourceRequirement {
|
||||
if (isOn(environment, "ca-skeleton.outbox.enabled")) {
|
||||
reasons.add("ca-skeleton.outbox.enabled=true");
|
||||
}
|
||||
if ("jdbc"
|
||||
.equalsIgnoreCase(
|
||||
environment.getProperty("ca-skeleton.capabilities.idempotency.provider", "disabled"))) {
|
||||
reasons.add("ca-skeleton.capabilities.idempotency.provider=jdbc");
|
||||
String idempotencyProvider =
|
||||
environment.getProperty("ca-skeleton.capabilities.idempotency.provider", "disabled").trim();
|
||||
if ("jdbc".equalsIgnoreCase(idempotencyProvider)
|
||||
|| "postgresql".equalsIgnoreCase(idempotencyProvider)) {
|
||||
reasons.add("ca-skeleton.capabilities.idempotency.provider=" + idempotencyProvider);
|
||||
}
|
||||
if (isOn(environment, "ca-skeleton.lock.multi-instance-enabled")) {
|
||||
reasons.add("ca-skeleton.lock.multi-instance-enabled=true");
|
||||
if (isOn(environment, "ca-skeleton.runtime.multi-instance-enabled")) {
|
||||
reasons.add("ca-skeleton.runtime.multi-instance-enabled=true");
|
||||
}
|
||||
if (isOn(environment, MasterSwitch.NOTIFICATION_PLATFORM.property())
|
||||
&& !"none"
|
||||
|
||||
+5
-4
@@ -1,8 +1,9 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.jpa;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.persistence.migration.FlywaySchemaPolicy;
|
||||
import dev.caskeleton.bootstrap.runtime.RuntimeProfileSnapshot;
|
||||
import dev.caskeleton.bootstrap.runtime.startup.StartupFailures;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
@@ -66,10 +67,10 @@ public final class JpaDangerousConfigurationGuard {
|
||||
|
||||
/** Whether the active profiles are all local convenience profiles. */
|
||||
public boolean isLocalConvenience(Environment environment) {
|
||||
String[] active = environment.getActiveProfiles();
|
||||
if (active.length == 0) {
|
||||
List<String> active = RuntimeProfileSnapshot.from(environment).activeProfiles();
|
||||
if (active.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
return Arrays.stream(active).allMatch(safety::isLocalConvenience);
|
||||
return active.stream().allMatch(safety::isLocalConvenience);
|
||||
}
|
||||
}
|
||||
|
||||
-81
@@ -1,81 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.jpa;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.persistence.api.query.NoopQueryObservation;
|
||||
import dev.caskeleton.adapter.outbound.persistence.api.query.QueryObservation;
|
||||
import dev.caskeleton.adapter.outbound.persistence.api.transaction.RetryEventListener;
|
||||
import dev.caskeleton.adapter.outbound.persistence.observation.JpaRetryObservation;
|
||||
import dev.caskeleton.adapter.outbound.persistence.observation.JpaTransactionObservation;
|
||||
import dev.caskeleton.adapter.outbound.persistence.observation.MicrometerQueryObservation;
|
||||
import io.micrometer.core.instrument.MeterRegistry;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Composes the observability half of the platform (design §37).
|
||||
*
|
||||
* <p>Separate from {@link JpaPlatformAutoConfiguration} because it backs off separately, and
|
||||
* because it is the only part of the platform that is genuinely optional at runtime: an application
|
||||
* with no {@link MeterRegistry} gets the no-op observation and everything else still works. That is
|
||||
* why {@link NoopQueryObservation} exists rather than a nullable registry — a null check at every
|
||||
* call site is how "observe when a registry is present" becomes two divergent code paths.
|
||||
*
|
||||
* <p>The persistence-unit tag is required rather than defaulted. It is the dimension that separates
|
||||
* two data sources in the same application, and a default of {@code "default"} makes them
|
||||
* indistinguishable exactly when someone is trying to tell them apart.
|
||||
*/
|
||||
public final class JpaObservabilityAutoConfiguration {
|
||||
|
||||
private final Optional<MeterRegistry> registry;
|
||||
private final String persistenceUnit;
|
||||
|
||||
/**
|
||||
* @param registry the meter registry, or empty when the application installs none
|
||||
* @param persistenceUnit the bounded name distinguishing this persistence unit from others
|
||||
*/
|
||||
public JpaObservabilityAutoConfiguration(
|
||||
Optional<MeterRegistry> registry, String persistenceUnit) {
|
||||
this.registry = Objects.requireNonNull(registry, "registry");
|
||||
this.persistenceUnit = Objects.requireNonNull(persistenceUnit, "persistenceUnit");
|
||||
}
|
||||
|
||||
/** Query observation, or the no-op when no registry is installed. */
|
||||
public QueryObservation queryObservation() {
|
||||
return registry
|
||||
.<QueryObservation>map(meters -> new MicrometerQueryObservation(meters, persistenceUnit))
|
||||
.orElseGet(NoopQueryObservation::instance);
|
||||
}
|
||||
|
||||
/** Transaction observation, when a registry is installed. */
|
||||
public Optional<JpaTransactionObservation> transactionObservation() {
|
||||
return registry.map(meters -> new JpaTransactionObservation(meters, persistenceUnit));
|
||||
}
|
||||
|
||||
/**
|
||||
* The retry listener, or the no-op when no registry is installed.
|
||||
*
|
||||
* <p>Retry attempts are metrics rather than log lines: an optimistic conflict is the expected
|
||||
* cost of concurrency, and logging each at WARN pages someone for a system working as designed.
|
||||
*/
|
||||
public RetryEventListener retryListener() {
|
||||
return registry
|
||||
.<RetryEventListener>map(meters -> new JpaRetryObservation(meters, persistenceUnit))
|
||||
.orElseGet(RetryEventListener::noop);
|
||||
}
|
||||
|
||||
/**
|
||||
* The bounded persistence-unit tag every meter this configuration creates carries.
|
||||
*
|
||||
* <p>Hibernate statistics are collected inside the persistence leaf, through {@code
|
||||
* HibernateStatisticsCollector.of(sessionFactory, batchCounter)}. Building it here would put
|
||||
* {@code org.hibernate} on the composition root's compile classpath, and this repository keeps
|
||||
* ORM types inside the persistence leaf.
|
||||
*/
|
||||
public String persistenceUnit() {
|
||||
return persistenceUnit;
|
||||
}
|
||||
|
||||
/** Whether a meter registry is installed at all. */
|
||||
public boolean instrumented() {
|
||||
return registry.isPresent();
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -30,8 +30,7 @@ public final class JpaOffAutoConfigurationImportFilter
|
||||
"org.springframework.boot.jdbc.autoconfigure.health.DataSourceHealthContributorAutoConfiguration",
|
||||
"org.springframework.boot.jdbc.autoconfigure.metrics.DataSourcePoolMetricsAutoConfiguration",
|
||||
"org.springframework.boot.hibernate.autoconfigure.HibernateJpaAutoConfiguration",
|
||||
"org.springframework.boot.jpa.autoconfigure.JpaBaseConfiguration",
|
||||
"org.springframework.boot.data.jpa.autoconfigure.JpaRepositoriesAutoConfiguration",
|
||||
"org.springframework.boot.data.jpa.autoconfigure.DataJpaRepositoriesAutoConfiguration",
|
||||
"org.springframework.boot.flyway.autoconfigure.FlywayAutoConfiguration");
|
||||
|
||||
private Environment environment;
|
||||
|
||||
+9
-3
@@ -54,12 +54,18 @@ public final class JpaPlatformAutoConfiguration {
|
||||
public List<CapabilitySupport> capabilities() {
|
||||
return List.of(
|
||||
CapabilitySupport.stable(JpaCapability.TRANSACTION_RETRY),
|
||||
CapabilitySupport.stable(JpaCapability.COMPLETION_EVIDENCE),
|
||||
CapabilitySupport.advanced(
|
||||
JpaCapability.COMPLETION_EVIDENCE,
|
||||
"requires an application-owned completion-evidence/reconciliation composition"),
|
||||
CapabilitySupport.stable(JpaCapability.KEYSET_PAGINATION),
|
||||
CapabilitySupport.stable(JpaCapability.BATCH),
|
||||
CapabilitySupport.advanced(
|
||||
JpaCapability.BATCH,
|
||||
"requires hibernate.jdbc.batch_size > 0, ordering settings, statistics and JDBC batch instrumentation"),
|
||||
CapabilitySupport.stable(JpaCapability.SCHEMA_GATE),
|
||||
CapabilitySupport.stable(JpaCapability.RUNTIME_ROLE_VERIFICATION),
|
||||
CapabilitySupport.stable(JpaCapability.OBSERVABILITY),
|
||||
CapabilitySupport.advanced(
|
||||
JpaCapability.OBSERVABILITY,
|
||||
"requires explicit metrics/statistics collector composition"),
|
||||
CapabilitySupport.advanced(
|
||||
JpaCapability.POSTGRESQL_NATIVE_WRITE, "requires a registered statement"),
|
||||
CapabilitySupport.advanced(JpaCapability.POSTGRESQL_WORK_CLAIM, "requires a named queue"),
|
||||
|
||||
+8
-111
@@ -1,16 +1,10 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.jpa;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.persistence.api.error.VendorFailureTranslator;
|
||||
import dev.caskeleton.adapter.outbound.persistence.api.transaction.RetryEventListener;
|
||||
import dev.caskeleton.adapter.outbound.persistence.hibernate.HibernateProviderPolicy;
|
||||
import dev.caskeleton.adapter.outbound.persistence.security.PostgreSqlRuntimeRoleVerifier;
|
||||
import dev.caskeleton.adapter.outbound.persistence.transaction.FullTransactionRetryCoordinator;
|
||||
import dev.caskeleton.adapter.outbound.persistence.transaction.SpringJpaTransactionExecutor;
|
||||
import java.time.Clock;
|
||||
import java.util.function.Supplier;
|
||||
import javax.sql.DataSource;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
@@ -18,46 +12,18 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
/**
|
||||
* Registers the Stable JPA platform as beans, which is what "auto-configuration" was missing.
|
||||
* Application-owned JPA startup safety and management composition.
|
||||
*
|
||||
* <p>Three classes in this package were named {@code ...AutoConfiguration} and were plain
|
||||
* factories: no {@code @AutoConfiguration}, no {@code @Bean}, and no entry in {@code
|
||||
* AutoConfiguration.imports} — while {@code CaSkeletonApplication} deliberately excludes this
|
||||
* package from component scanning, because auto-configuration is the only way it is meant to be
|
||||
* entered. So the capability report listed transaction retry, completion evidence and observability
|
||||
* as Stable, and the running context contained none of them. A developer could deploy code relying
|
||||
* on retry that was never retried.
|
||||
* <p>The persistence leaf owns provider selection, vendor beans, transaction execution and retry.
|
||||
* This configuration consumes those collaborators only to apply application deployment policy:
|
||||
* unsafe JPA settings fail startup, the resolved datasource is reported through a sanitized
|
||||
* actuator view, and application-owned safety settings stay in the composition root.
|
||||
*
|
||||
* <p>This class is the registration. The factories stay: they hold the composition decisions, and
|
||||
* an application that wires its own composition root can still call them directly. What changes is
|
||||
* that a default application now gets the beans.
|
||||
*
|
||||
* <p>Whether this application has relational persistence at all is decided by {@code
|
||||
* PersistenceJpaRootAutoConfiguration}, which imports this class. The condition below is narrower
|
||||
* than it used to look: it gates the add-on beans this class contributes, and was renamed from
|
||||
* {@code app.jpa-platform.enabled} because that name read like a whole-adapter switch while gating
|
||||
* three convenience beans and defaulting to on.
|
||||
*
|
||||
* <p>Conditions match what each bean actually needs. No {@code DataSource} means there is no
|
||||
* database to report on; a foreign {@code PlatformTransactionManager} — a JTA setup, a chained
|
||||
* manager — is kept, and the retry coordinator is built over whatever manager is present rather
|
||||
* than replacing it.
|
||||
*
|
||||
* <p>This class used to carry {@code @ConditionalOnBean(DataSource.class)}. It is imported by
|
||||
* {@code PersistenceJpaRootAutoConfiguration} rather than auto-configured, so that condition was
|
||||
* evaluated while the class was parsed — before the datasource bean definition existed — and was
|
||||
* therefore false in every real deployment. All eight beans below silently disappeared, and nothing
|
||||
* reported it because nothing depended on any of them. It surfaced only when the datasource
|
||||
* validator was finally wired to a caller and the JPA Compose lane answered "No qualifying bean".
|
||||
*
|
||||
* <p>The condition is removed rather than reordered: this class is reached only through the JPA
|
||||
* root, which already carries the master switch, so "is there a datasource" has been answered yes
|
||||
* by the time it is parsed. A bean here that needs one takes it as a parameter, and a missing
|
||||
* datasource with the switch on is then a loud failure — which is the outcome that was wanted,
|
||||
* rather than the layer vanishing.
|
||||
* <p>The add-on switch remains for these application-level diagnostics and guards. It does not
|
||||
* control whether relational persistence exists; the capability master switch is {@code
|
||||
* ca-skeleton.persistence-jpa.enabled} and is owned by the persistence leaf.
|
||||
*/
|
||||
@org.springframework.context.annotation.Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnClass(DataSource.class)
|
||||
@@ -65,25 +31,6 @@ import org.springframework.transaction.PlatformTransactionManager;
|
||||
@EnableConfigurationProperties(JpaSafetySettings.class)
|
||||
public class JpaPlatformRuntimeAutoConfiguration {
|
||||
|
||||
/**
|
||||
* The Hibernate version policy, read from the provider actually on the classpath.
|
||||
*
|
||||
* <p>A bean rather than a constructor call inside the composition, so an application pinning a
|
||||
* different provider version can replace it without replacing the whole composition.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public HibernateProviderPolicy hibernateProviderPolicy() {
|
||||
return HibernateProviderPolicy.fromClasspath();
|
||||
}
|
||||
|
||||
/** The runtime-role privilege verifier. */
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public PostgreSqlRuntimeRoleVerifier postgreSqlRuntimeRoleVerifier() {
|
||||
return new PostgreSqlRuntimeRoleVerifier();
|
||||
}
|
||||
|
||||
/** The composition factory, exposed so an application can reuse its decisions. */
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@@ -139,56 +86,6 @@ public class JpaPlatformRuntimeAutoConfiguration {
|
||||
return new JpaPlatformEndpoint(reportSupplier);
|
||||
}
|
||||
|
||||
/**
|
||||
* The programmatic transaction boundary, over whichever manager the application installed.
|
||||
*
|
||||
* <p>The composed vendor's translator is taken when one exists. Without it the executor's chain
|
||||
* has no SQLSTATE stage, so a serialization failure or deadlock stays a raw {@code
|
||||
* DataAccessException}, never becomes the {@code JpaPersistenceException} the retry coordinator
|
||||
* catches, and contention is not retried at all.
|
||||
*
|
||||
* @param vendorFailures the composed vendor's SQLSTATE translator, when a vendor registered one
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnBean(PlatformTransactionManager.class)
|
||||
public SpringJpaTransactionExecutor jpaTransactionExecutor(
|
||||
PlatformTransactionManager transactionManager,
|
||||
Clock clock,
|
||||
ObjectProvider<VendorFailureTranslator> vendorFailures) {
|
||||
JpaTransactionAutoConfiguration composition = new JpaTransactionAutoConfiguration(clock);
|
||||
VendorFailureTranslator vendor = vendorFailures.getIfAvailable();
|
||||
return vendor == null
|
||||
? composition.transactionExecutor(transactionManager)
|
||||
: composition.transactionExecutor(transactionManager, vendor);
|
||||
}
|
||||
|
||||
/** The whole-transaction retry coordinator. */
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnBean(SpringJpaTransactionExecutor.class)
|
||||
public FullTransactionRetryCoordinator jpaRetryCoordinator(
|
||||
SpringJpaTransactionExecutor executor, RetryEventListener retryListener, Clock clock) {
|
||||
return new JpaTransactionAutoConfiguration(clock)
|
||||
.retryCoordinator(
|
||||
executor,
|
||||
dev.caskeleton.adapter.outbound.persistence.api.transaction.RetryProfile
|
||||
.boundedContention("jpa-platform-default", 3),
|
||||
retryListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* The retry listener.
|
||||
*
|
||||
* <p>The interface's methods all have defaults, so an empty implementation is the honest "no
|
||||
* observer wired" value; an application that wants retry telemetry supplies its own bean.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public RetryEventListener jpaRetryEventListener() {
|
||||
return new RetryEventListener() {};
|
||||
}
|
||||
|
||||
/** Runs the dangerous-configuration guard during refresh. */
|
||||
@Bean
|
||||
public InitializingBean jpaPlatformStartupCheck(
|
||||
|
||||
+4
-3
@@ -1,5 +1,6 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.jpa;
|
||||
|
||||
import dev.caskeleton.shared.runtime.RuntimeEnvironment;
|
||||
import java.util.Set;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.bind.DefaultValue;
|
||||
@@ -15,8 +16,7 @@ import org.springframework.boot.context.properties.bind.DefaultValue;
|
||||
*
|
||||
* <p>{@code localConvenienceProfiles} names the profiles where Open Session In View may be left on
|
||||
* — a developer running a template locally, and nothing else. It is a list rather than a boolean so
|
||||
* that "on in local" cannot silently mean "on in staging" the first time someone reuses the profile
|
||||
* name.
|
||||
* that "on in local" cannot silently expand to another runtime environment when policy changes.
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "app.jpa-platform")
|
||||
public record JpaSafetySettings(
|
||||
@@ -25,7 +25,8 @@ public record JpaSafetySettings(
|
||||
Set<String> schemaMutatingProfiles) {
|
||||
|
||||
/** The profiles that may run with OSIV enabled, when nothing else is configured. */
|
||||
public static final Set<String> DEFAULT_LOCAL_PROFILES = Set.of("local", "test");
|
||||
public static final Set<String> DEFAULT_LOCAL_PROFILES =
|
||||
Set.of(RuntimeEnvironment.LOCAL.profileName(), RuntimeEnvironment.testProfileName());
|
||||
|
||||
public JpaSafetySettings {
|
||||
localConvenienceProfiles =
|
||||
|
||||
-117
@@ -1,117 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.jpa;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.persistence.api.error.VendorFailureTranslator;
|
||||
import dev.caskeleton.adapter.outbound.persistence.api.transaction.JpaRetryPolicy;
|
||||
import dev.caskeleton.adapter.outbound.persistence.api.transaction.RetryEventListener;
|
||||
import dev.caskeleton.adapter.outbound.persistence.api.transaction.RetryProfile;
|
||||
import dev.caskeleton.adapter.outbound.persistence.transaction.CommitFailureClassifier;
|
||||
import dev.caskeleton.adapter.outbound.persistence.transaction.DefaultJpaRetryPolicy;
|
||||
import dev.caskeleton.adapter.outbound.persistence.transaction.FullTransactionRetryCoordinator;
|
||||
import dev.caskeleton.adapter.outbound.persistence.transaction.OptimisticConflictTranslator;
|
||||
import dev.caskeleton.adapter.outbound.persistence.transaction.PersistenceFailureTranslatorChain;
|
||||
import dev.caskeleton.adapter.outbound.persistence.transaction.RetrySleeper;
|
||||
import dev.caskeleton.adapter.outbound.persistence.transaction.SpringJpaTransactionExecutor;
|
||||
import dev.caskeleton.adapter.outbound.persistence.transaction.ThreadRetrySleeper;
|
||||
import java.time.Clock;
|
||||
import java.time.Duration;
|
||||
import java.util.Objects;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
/**
|
||||
* Composes the transaction half of the platform (design §9.3, §17, §19).
|
||||
*
|
||||
* <p>Separate from {@link JpaPlatformAutoConfiguration} because it backs off separately. An
|
||||
* application that already installs its own {@link PlatformTransactionManager} — a JTA setup, a
|
||||
* chained manager across two data sources — must keep it, and the rest of the platform is still
|
||||
* useful to it. Folding the two together would make "I have my own transaction manager" mean "I get
|
||||
* none of the platform".
|
||||
*
|
||||
* <p>Plain construction rather than Spring auto-configuration: this repository's composition root
|
||||
* owns wiring, and an adapter leaf that auto-configured a transaction manager would silently
|
||||
* replace one the application had deliberately chosen.
|
||||
*
|
||||
* <p>There is no declarative retry annotation any more. {@code @RetryableJpaTransaction} lived in
|
||||
* the persistence leaf and documented itself as something an application service would put on its
|
||||
* own methods — which application-core cannot do without importing an outbound adapter and
|
||||
* inverting the dependency this architecture is built on. The canonical boundary is {@code
|
||||
* PolicyTransactionPort.inTransaction(TransactionRequest, Supplier)}; the retry coordinator below
|
||||
* is what implements it, not a second way to ask for the same thing.
|
||||
*/
|
||||
public final class JpaTransactionAutoConfiguration {
|
||||
|
||||
/** How long a logical operation may keep retrying before the budget is spent regardless. */
|
||||
public static final Duration DEFAULT_MAX_RETRY_ELAPSED = Duration.ofSeconds(30);
|
||||
|
||||
private final Clock clock;
|
||||
|
||||
public JpaTransactionAutoConfiguration(Clock clock) {
|
||||
this.clock = Objects.requireNonNull(clock, "clock");
|
||||
}
|
||||
|
||||
/**
|
||||
* The commit-phase classifier the evidence-aware transaction manager is built with.
|
||||
*
|
||||
* <p>The manager itself is constructed inside the persistence leaf, through {@code
|
||||
* EvidenceAwareJpaTransactionManager.standard(entityManagerFactory, clock)}. The composition root
|
||||
* deliberately does not do it here: that would require {@code jakarta.persistence} and {@code
|
||||
* org.hibernate} on the composition root's compile classpath, and this repository keeps ORM types
|
||||
* inside the persistence leaf. What the root owns is the decision — whether to install the
|
||||
* platform's manager at all — and the classifier it uses.
|
||||
*/
|
||||
public CommitFailureClassifier commitFailureClassifier() {
|
||||
return CommitFailureClassifier.standard(clock);
|
||||
}
|
||||
|
||||
/** The programmatic transaction boundary, with no vendor classification. */
|
||||
public SpringJpaTransactionExecutor transactionExecutor(
|
||||
PlatformTransactionManager transactionManager) {
|
||||
return new SpringJpaTransactionExecutor(transactionManager, clock);
|
||||
}
|
||||
|
||||
/**
|
||||
* The programmatic transaction boundary that classifies its attempts with a vendor's SQLSTATEs.
|
||||
*
|
||||
* <p>The overload above builds the catalog-free chain, whose vendor stage returns the failure
|
||||
* unchanged. That is the honest answer when no vendor translator exists, and it is the wrong one
|
||||
* whenever a vendor is composed: a 40001 or 40P01 stays a raw {@code DataAccessException}, never
|
||||
* becomes a {@code JpaPersistenceException}, and so never reaches the retry coordinator's catch.
|
||||
* Contention then goes unretried in exactly the deployments that have a database.
|
||||
*
|
||||
* @param vendorFailures the composed vendor's SQLSTATE translator
|
||||
*/
|
||||
public SpringJpaTransactionExecutor transactionExecutor(
|
||||
PlatformTransactionManager transactionManager, VendorFailureTranslator vendorFailures) {
|
||||
return new SpringJpaTransactionExecutor(
|
||||
transactionManager,
|
||||
clock,
|
||||
new PersistenceFailureTranslatorChain(
|
||||
OptimisticConflictTranslator.withoutCatalog(), vendorFailures));
|
||||
}
|
||||
|
||||
/**
|
||||
* The retry coordinator for one retry profile.
|
||||
*
|
||||
* <p>The policy and the coordinator's budget are built from the <em>same</em> profile on purpose.
|
||||
* Configuring them independently is how a deployment ends up with a policy that says "retry" and
|
||||
* a budget that permits one attempt — which looks like retry being broken rather than like a
|
||||
* misconfiguration.
|
||||
*/
|
||||
public FullTransactionRetryCoordinator retryCoordinator(
|
||||
SpringJpaTransactionExecutor executor,
|
||||
RetryProfile retryProfile,
|
||||
RetryEventListener listener) {
|
||||
return retryCoordinator(executor, DefaultJpaRetryPolicy.forProfile(retryProfile), listener);
|
||||
}
|
||||
|
||||
/** The retry coordinator for an application-supplied policy. */
|
||||
public FullTransactionRetryCoordinator retryCoordinator(
|
||||
SpringJpaTransactionExecutor executor, JpaRetryPolicy policy, RetryEventListener listener) {
|
||||
return new FullTransactionRetryCoordinator(
|
||||
executor, policy, retrySleeper(), clock, DEFAULT_MAX_RETRY_ELAPSED, listener);
|
||||
}
|
||||
|
||||
/** The production sleeper; tests substitute a recording one. */
|
||||
public RetrySleeper retrySleeper() {
|
||||
return new ThreadRetrySleeper();
|
||||
}
|
||||
}
|
||||
+4
-1
@@ -1,5 +1,8 @@
|
||||
package dev.caskeleton.bootstrap.runtime.startup;
|
||||
package dev.caskeleton.bootstrap.autoconfigure.jpa;
|
||||
|
||||
import dev.caskeleton.bootstrap.runtime.startup.FlywayProdSafetyValidator;
|
||||
import dev.caskeleton.bootstrap.runtime.startup.MigrationStartupRunner;
|
||||
import dev.caskeleton.bootstrap.runtime.startup.RequiredEnvironmentValidator;
|
||||
import dev.caskeleton.bootstrap.settings.RuntimeSafetySettings;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.flyway.autoconfigure.FlywayMigrationStrategy;
|
||||
+14
-77
@@ -1,12 +1,6 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.jpa;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.persistence.config.JpaAdapterComponentsConfig;
|
||||
import dev.caskeleton.adapter.outbound.persistence.config.PersistenceVendorSettings;
|
||||
import dev.caskeleton.adapter.outbound.persistence.fileserver.FileserverJpaPersistenceConfig;
|
||||
import dev.caskeleton.adapter.outbound.persistence.h2.H2PersistenceConfig;
|
||||
import dev.caskeleton.adapter.outbound.persistence.notification.configuration.NotificationJpaPersistenceFacade;
|
||||
import dev.caskeleton.adapter.outbound.persistence.postgresql.PostgreSqlPersistenceConfig;
|
||||
import dev.caskeleton.bootstrap.runtime.startup.MigrationStartupConfig;
|
||||
import javax.sql.DataSource;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
@@ -16,89 +10,32 @@ import org.springframework.context.annotation.Import;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
/**
|
||||
* The one place that decides whether this application has relational persistence.
|
||||
* Application startup policy layered over the leaf-owned relational persistence capability.
|
||||
*
|
||||
* <p>Every JPA configuration is reached through this import rather than through the component scan,
|
||||
* so a bean added to any of them next month is gated without anyone remembering to repeat a
|
||||
* condition. That is the difference between a capability that is off and a capability whose known
|
||||
* beans are individually conditioned.
|
||||
* <p>The persistence leaf owns entity/repository discovery, vendor selection, optional capability
|
||||
* persistence registrations, and reusable transaction/retry runtime. This root deliberately does
|
||||
* not reconstruct those implementation details.
|
||||
*
|
||||
* <p>Both vendor configurations are named here, and each is the leaf\'s real entry point: a vendor
|
||||
* config imports the core JPA config, not the reverse. Inverting that to give this class a single
|
||||
* import produced a package cycle inside the leaf, so the export surface admits the two vendor
|
||||
* packages instead. They are mutually exclusive on {@code ca-skeleton.persistence.vendor}, so
|
||||
* naming both lets the selector decide which one assembles while the decision about
|
||||
* <em>whether</em> there is a database stays here, in one place.
|
||||
*
|
||||
* <p><b>The notification facade is named here only now that the payload is protected at rest.</b>
|
||||
* Importing it makes {@code JpaNotificationRequestStore} reachable, and that store used to write
|
||||
* the accepted request's template variables to {@code notification_request.variables_payload} in
|
||||
* plaintext — caller content that can be a reset code, an order total or an address (NTF-INT-007).
|
||||
* It was wired here once before that was true; the at-rest contract test failed on exactly that
|
||||
* fact, which is what it was written to do, and the wiring was reverted rather than the test
|
||||
* relaxed. The envelope came first, {@code NotificationRecordMapper} now takes the protection as a
|
||||
* required constructor argument, and only then does this import become a wiring rather than an
|
||||
* exposure.
|
||||
*
|
||||
* <p>{@code FileserverJpaPersistenceConfig} is named for a related reason. Its six entities map six
|
||||
* {@code fs_*} tables that live only in {@code db/migration/jpa/fileserver}, a stream applied only
|
||||
* when that capability is on, while the primary Flyway location creates none of them. They used to
|
||||
* be in the unconditional entity scan, so {@code ddl-auto=validate} against real PostgreSQL failed
|
||||
* on {@code fs_cleanup_item} in every deployment that had switched the capability off — which was
|
||||
* every JPA-on Compose lane. The scan now carries the capability's own condition, and this is the
|
||||
* only place that knows both that the capability is on and that a JPA vendor is composed. Neither
|
||||
* the leaf's {@code config} package nor a component scan can register it: {@code config} may depend
|
||||
* on {@code api} alone, and the whole persistence package is excluded from the root's scan.
|
||||
* <p>What remains application-owned is startup/deployment policy: migration startup sequencing,
|
||||
* resolved datasource validation, OSIV/DDL safety, and the sanitized management view. The root
|
||||
* carries the same master switch so those checks never bind or run while JPA is disabled; bean
|
||||
* dependencies, not a reference to leaf-internal auto-configuration classes, provide runtime
|
||||
* ordering.
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnProperty(
|
||||
prefix = "ca-skeleton.persistence-jpa",
|
||||
name = "enabled",
|
||||
havingValue = "true")
|
||||
@Import({
|
||||
JpaAdapterComponentsConfig.class,
|
||||
PostgreSqlPersistenceConfig.class,
|
||||
H2PersistenceConfig.class,
|
||||
FileserverJpaPersistenceConfig.class,
|
||||
NotificationJpaPersistenceFacade.class,
|
||||
MigrationStartupConfig.class,
|
||||
JpaPlatformRuntimeAutoConfiguration.class
|
||||
})
|
||||
@Import({MigrationStartupConfig.class, JpaPlatformRuntimeAutoConfiguration.class})
|
||||
public class PersistenceJpaRootAutoConfiguration {
|
||||
|
||||
/**
|
||||
* Runs the datasource validator, which nothing used to run (JPA-INT-002).
|
||||
* Validates the datasource the application actually resolved.
|
||||
*
|
||||
* <p>{@code JpaDataSourceProfileValidator} was created as a bean and never invoked: both of its
|
||||
* methods were reachable only from their own unit test. A validator nobody calls is a comment —
|
||||
* and this one would have failed every deployment if called, because the namespace it read was
|
||||
* supplied by nothing. The two defects cancelled, which is the only reason the application
|
||||
* started.
|
||||
*
|
||||
* <p>Invoked from here rather than from the platform configuration so it runs exactly when JPA is
|
||||
* on and never when it is off, and as an {@link InitializingBean} so the failure lands during
|
||||
* startup rather than at whoever sends the first request.
|
||||
*
|
||||
* <p>The vendor is read from the {@link Environment} rather than injected as {@code
|
||||
* PersistenceVendorSettings}, because that type is not a registered bean here: the composition
|
||||
* root's {@code @ConfigurationPropertiesScan} deliberately excludes the persistence package so an
|
||||
* optional capability cannot bind — or reject — its detail settings in a deployment that never
|
||||
* switched it on. The default matches {@code PostgreSqlPersistenceConfig}'s {@code matchIfMissing
|
||||
* = true}: an unset selector is PostgreSQL, which is the vendor this configuration was
|
||||
* unconditional about before the selector existed.
|
||||
*
|
||||
* <p>The validator is constructed here rather than injected. It is stateless, and the bean that
|
||||
* used to supply it comes from {@code JpaPlatformRuntimeAutoConfiguration}, which carries
|
||||
* {@code @ConditionalOnBean(DataSource.class)} on a plain {@code @Configuration} imported by this
|
||||
* root — a condition evaluated during configuration-class parsing, before the datasource bean
|
||||
* definition is registered. That class therefore drops out silently in the real application,
|
||||
* taking the whole JPA add-on layer with it. Depending on a bean from it would make this check
|
||||
* disappear for the same reason the thing it checks disappeared. The condition-ordering defect is
|
||||
* recorded separately; it is not this task's to fix quietly.
|
||||
*
|
||||
* @param dataSource the resolved datasource, injected so the database checked is the one in use
|
||||
* @param environment the resolved environment, for the vendor selector
|
||||
* @return the startup check
|
||||
* <p>The vendor selector is read from the environment because the persistence settings tree is
|
||||
* intentionally bound only by the enabled leaf. PostgreSQL validation opens the resolved
|
||||
* datasource during startup; H2 local-development selection skips the PostgreSQL product check.
|
||||
*/
|
||||
@Bean
|
||||
public InitializingBean jpaResolvedDataSourceCheck(
|
||||
|
||||
+2
-2
@@ -4,16 +4,16 @@ import dev.caskeleton.application.lock.DistributedLockPort;
|
||||
import io.micrometer.core.instrument.MeterRegistry;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
|
||||
/**
|
||||
* Composition-root wiring for the distributed-lock metrics decorator. See README for the design
|
||||
* rationale.
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
public class DistributedLockConfig {
|
||||
|
||||
/**
|
||||
|
||||
+4
@@ -1,5 +1,7 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.lock;
|
||||
|
||||
import static net.logstash.logback.argument.StructuredArguments.kv;
|
||||
|
||||
import dev.caskeleton.application.lock.DistributedLock;
|
||||
import dev.caskeleton.application.lock.DistributedLockPort;
|
||||
import dev.caskeleton.application.lock.LockAcquisitionTimeoutException;
|
||||
@@ -67,6 +69,8 @@ public final class MeteredDistributedLockPort implements DistributedLockPort {
|
||||
"distributed lock '{}' had already been released by lease expiry before close() "
|
||||
+ "— another instance may have entered the critical section (D6 efficiency-lock boundary)",
|
||||
key,
|
||||
kv("capability", "distributed-lock"),
|
||||
kv("warning.kind", "lease-expired-before-close"),
|
||||
e);
|
||||
incrementLeaseExpired();
|
||||
}
|
||||
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.mongo;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.mongo.autoconfigure.MongoPlatformHealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Registers the Mongo platform's Actuator health contributor.
|
||||
*
|
||||
* <p>Conditioned on the master switch as well as on the adapter's bean: with Mongo off there is no
|
||||
* {@code MongoPlatformHealthIndicator} to delegate to, and a health entry for a capability the
|
||||
* deployment does not run is a question an operator has to answer for nothing.
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnProperty(
|
||||
prefix = "ca-skeleton.persistence-mongo",
|
||||
name = "enabled",
|
||||
havingValue = "true")
|
||||
public class MongoPlatformHealthConfig {
|
||||
|
||||
/**
|
||||
* Returns the Actuator-visible contributor for the Mongo platform.
|
||||
*
|
||||
* @param platform the adapter's health view
|
||||
* @return the contributor
|
||||
*/
|
||||
@Bean("mongoPlatformHealthContributor")
|
||||
@ConditionalOnBean(MongoPlatformHealthIndicator.class)
|
||||
@ConditionalOnMissingBean(MongoPlatformHealthContributor.class)
|
||||
public MongoPlatformHealthContributor mongoPlatformHealthContributor(
|
||||
MongoPlatformHealthIndicator platform) {
|
||||
return new MongoPlatformHealthContributor(platform);
|
||||
}
|
||||
}
|
||||
-47
@@ -1,47 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.mongo;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.mongo.autoconfigure.MongoPlatformHealthIndicator;
|
||||
import java.util.Objects;
|
||||
import org.springframework.boot.health.contributor.Health;
|
||||
import org.springframework.boot.health.contributor.HealthIndicator;
|
||||
|
||||
/**
|
||||
* Puts the Mongo platform's health where Actuator can read it.
|
||||
*
|
||||
* <p>{@code MongoPlatformHealthIndicator} computes everything an operator needs — topology
|
||||
* mismatch, secondary availability, the bounded detail map — and was named as though Actuator would
|
||||
* surface it. It implements neither {@code HealthIndicator} nor {@code HealthContributor}, so
|
||||
* Actuator never saw it: the platform had a health view that nothing could read, and a name that
|
||||
* said otherwise.
|
||||
*
|
||||
* <p>The adapter is not the place to fix that. It carries no Actuator dependency, and the delivery
|
||||
* platform already established the shape this follows: the adapter computes the facts, the
|
||||
* composition root — which owns the management surface — decides how they map onto {@code Health}.
|
||||
* See {@code NotificationHealthEndpoint}.
|
||||
*
|
||||
* <p>Degraded secondary availability reports UP with detail rather than DOWN, matching the
|
||||
* adapter's own reasoning: majority writes still succeed while a majority of voting members is
|
||||
* reachable, and taking the instance out of rotation for a replica-set problem removes capacity
|
||||
* from a cluster that is already short of it. A topology mismatch is the case that fails readiness,
|
||||
* because this instance is talking to a cluster nobody declared.
|
||||
*/
|
||||
public class MongoPlatformHealthContributor implements HealthIndicator {
|
||||
|
||||
private final MongoPlatformHealthIndicator platform;
|
||||
|
||||
/**
|
||||
* Creates the contributor.
|
||||
*
|
||||
* @param platform the adapter's health view
|
||||
*/
|
||||
public MongoPlatformHealthContributor(MongoPlatformHealthIndicator platform) {
|
||||
this.platform = Objects.requireNonNull(platform, "platform");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Health health() {
|
||||
Health.Builder builder = platform.ready() ? Health.up() : Health.down();
|
||||
platform.details().forEach(builder::withDetail);
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
+29
-142
@@ -1,14 +1,13 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.notification;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.autoconfigure.NotificationPlatformSettings;
|
||||
import dev.caskeleton.adapter.inbound.web.notification.platform.callback.ProviderCallbackIngress;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.callback.ProviderCallbackAdapterRegistry;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.dispatch.NotificationDispatchProperties;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.dispatch.ProviderRuntimeRegistry;
|
||||
import dev.caskeleton.application.notification.platform.callback.CallbackPayloadProtectionPort;
|
||||
import dev.caskeleton.application.notification.platform.callback.DeliveryAttemptResolverPort;
|
||||
import dev.caskeleton.application.notification.platform.callback.DeliveryProjectionStorePort;
|
||||
import dev.caskeleton.application.notification.platform.callback.IngestProviderCallbackApplicationUseCase;
|
||||
import dev.caskeleton.application.notification.platform.callback.NotificationSideEffectPort;
|
||||
import dev.caskeleton.application.notification.platform.callback.ProviderCallbackAdapterRegistry;
|
||||
import dev.caskeleton.application.notification.platform.callback.ProviderEventLedger;
|
||||
import dev.caskeleton.application.notification.platform.callback.ProviderEventProjectionService;
|
||||
import dev.caskeleton.application.notification.platform.callback.ProviderEventProjectorRegistry;
|
||||
@@ -25,45 +24,31 @@ import dev.caskeleton.application.notification.platform.dispatch.NotificationSub
|
||||
import dev.caskeleton.application.notification.platform.dispatch.ProviderDispatchGatewayPort;
|
||||
import dev.caskeleton.application.notification.platform.dispatch.RecipientDeliveryStorePort;
|
||||
import dev.caskeleton.application.notification.platform.dispatch.RecipientLeaseStorePort;
|
||||
import dev.caskeleton.application.notification.platform.dispatch.ReconciliationGatewayPort;
|
||||
import dev.caskeleton.application.notification.platform.dispatch.ReconciliationService;
|
||||
import dev.caskeleton.application.notification.platform.dispatch.RequestFingerprint;
|
||||
import dev.caskeleton.application.notification.platform.dispatch.SyntheticEventFingerprint;
|
||||
import dev.caskeleton.application.notification.platform.dispatch.TemplateRendererRegistry;
|
||||
import dev.caskeleton.application.notification.platform.dispatch.TenantContextPort;
|
||||
import dev.caskeleton.application.notification.platform.observation.NotificationAuditPort;
|
||||
import dev.caskeleton.application.notification.platform.observation.NotificationMetricsPort;
|
||||
import dev.caskeleton.application.notification.platform.observation.NotificationSecurityAuditPort;
|
||||
import dev.caskeleton.application.notification.platform.policy.NotificationEligibilityPolicy;
|
||||
import dev.caskeleton.application.notification.platform.policy.NotificationRetryPolicy;
|
||||
import dev.caskeleton.application.notification.platform.policy.RoutingDecisionEngine;
|
||||
import dev.caskeleton.application.notification.platform.port.in.IngestProviderCallbackUseCase;
|
||||
import dev.caskeleton.application.notification.platform.template.TemplateRegistry;
|
||||
import dev.caskeleton.application.transaction.TransactionPort;
|
||||
import java.time.Clock;
|
||||
import java.time.Duration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Submission, dispatch and the services that record what happened.
|
||||
*
|
||||
* <p>The path a notification travels once it has been accepted, and the callback and reconciliation
|
||||
* services that correct the record afterwards.
|
||||
*
|
||||
* <p>Split out of one 690-line composition class holding 42 beans. A configuration that assembles
|
||||
* codecs, security, templates, policy, providers and workers at once has no boundary a reader can
|
||||
* use: every change to any of them is a change to the same file, and nothing states which beans
|
||||
* belong together (NTF-022).
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
/** Application-owned Notification orchestration and transaction-bound use-case assembly. */
|
||||
@AutoConfiguration(
|
||||
afterName =
|
||||
"dev.caskeleton.adapter.outbound.notification.platform.autoconfigure.NotificationPlatformAutoConfiguration")
|
||||
@ConditionalOnProperty(
|
||||
prefix = "ca-skeleton.notification.platform",
|
||||
name = "enabled",
|
||||
havingValue = "true")
|
||||
public class NotificationPlatformDispatchConfig {
|
||||
|
||||
public class NotificationApplicationCompositionAutoConfiguration {
|
||||
/** N2 orchestration. */
|
||||
@Bean
|
||||
public NotificationSubmissionService notificationOrchestrator(
|
||||
@@ -117,6 +102,7 @@ public class NotificationPlatformDispatchConfig {
|
||||
* @param protector the encryption and keyed-lookup boundary
|
||||
* @param tenants the ambient tenant
|
||||
* @param ids the identifier source for the contact point and correlation ids
|
||||
* @param fingerprints canonical SHA-256 fingerprinting used when the caller supplies no key
|
||||
* @param transactions the write boundary for registration
|
||||
* @param clock the registration time source
|
||||
* @return the use case
|
||||
@@ -129,11 +115,12 @@ public class NotificationPlatformDispatchConfig {
|
||||
dev.caskeleton.application.notification.platform.security.ContactPointProtector protector,
|
||||
TenantContextPort tenants,
|
||||
NotificationIdGeneratorPort ids,
|
||||
RequestFingerprint fingerprints,
|
||||
TransactionPort transactions,
|
||||
Clock clock) {
|
||||
return new dev.caskeleton.application.notification.platform.dispatch
|
||||
.AcceptNotificationApplicationUseCase(
|
||||
submit, contactPoints, protector, tenants, ids, transactions, clock);
|
||||
submit, contactPoints, protector, tenants, ids, fingerprints, transactions, clock);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -210,45 +197,6 @@ public class NotificationPlatformDispatchConfig {
|
||||
.GetNotificationApplicationUseCase(service, transactions);
|
||||
}
|
||||
|
||||
/**
|
||||
* The operator plane, and the narrow port it reaches runtimes through.
|
||||
*
|
||||
* <p>Neither had a bean. The admin service existed in the outbound adapter, fully written, doing
|
||||
* authorization and transaction orchestration, and nothing constructed it — so every operator
|
||||
* capability the platform documented was unreachable.
|
||||
*
|
||||
* @param runtimes the provider runtime registry
|
||||
* @return the control port
|
||||
*/
|
||||
@Bean
|
||||
public dev.caskeleton.application.notification.platform.admin.ProviderRuntimeControlPort
|
||||
providerRuntimeControl(ProviderRuntimeRegistry runtimes) {
|
||||
return new dev.caskeleton.adapter.outbound.notification.platform.dispatch
|
||||
.RegistryProviderRuntimeControl(runtimes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Operator authority, tenant scope and duplicate-risk approval.
|
||||
*
|
||||
* @return the guard
|
||||
*/
|
||||
@Bean
|
||||
public dev.caskeleton.application.notification.platform.admin.AdminAuthorizationGuard
|
||||
adminAuthorizationGuard() {
|
||||
return new dev.caskeleton.application.notification.platform.admin.AdminAuthorizationGuard();
|
||||
}
|
||||
|
||||
/**
|
||||
* The approval an ambiguous redrive requires.
|
||||
*
|
||||
* @return the guard
|
||||
*/
|
||||
@Bean
|
||||
public dev.caskeleton.application.notification.platform.admin.DuplicateRiskGuard
|
||||
duplicateRiskGuard() {
|
||||
return new dev.caskeleton.application.notification.platform.admin.DuplicateRiskGuard();
|
||||
}
|
||||
|
||||
/**
|
||||
* The N4 operator plane.
|
||||
*
|
||||
@@ -263,6 +211,7 @@ public class NotificationPlatformDispatchConfig {
|
||||
* @param audit the audit sink
|
||||
* @param transactions the transaction boundary
|
||||
* @param ids the identifier generator the suppression rows use
|
||||
* @param digests stable SHA-256 used to bind an operation id to its command
|
||||
* @param clock the clock
|
||||
* @return the admin service
|
||||
*/
|
||||
@@ -283,6 +232,7 @@ public class NotificationPlatformDispatchConfig {
|
||||
dev.caskeleton.application.notification.platform.observation.NotificationAuditPort audit,
|
||||
TransactionPort transactions,
|
||||
NotificationIdGeneratorPort ids,
|
||||
dev.caskeleton.application.notification.platform.dispatch.MessageDigestPort digests,
|
||||
Clock clock) {
|
||||
return new dev.caskeleton.application.notification.platform.admin
|
||||
.NotificationAdminApplicationService(
|
||||
@@ -297,62 +247,10 @@ public class NotificationPlatformDispatchConfig {
|
||||
audit,
|
||||
transactions,
|
||||
ids,
|
||||
digests,
|
||||
clock);
|
||||
}
|
||||
|
||||
/** Pre-provider guard chain. */
|
||||
@Bean
|
||||
public DispatchPipeline dispatchPipeline(
|
||||
ContactPointStorePort contactPoints,
|
||||
NotificationEligibilityPolicy eligibility,
|
||||
NotificationMetricsPort metrics) {
|
||||
return new DispatchPipeline(contactPoints, eligibility, metrics);
|
||||
}
|
||||
|
||||
/** Attempt row factory. */
|
||||
@Bean
|
||||
public DeliveryAttemptFactory deliveryAttemptFactory(NotificationIdGeneratorPort ids) {
|
||||
return new DeliveryAttemptFactory(ids);
|
||||
}
|
||||
|
||||
/** Outcome recorder. */
|
||||
@Bean
|
||||
public DispatchOutcomeRecorder dispatchOutcomeRecorder(
|
||||
DeliveryAttemptStorePort attempts,
|
||||
RecipientDeliveryStorePort recipients,
|
||||
dev.caskeleton.application.notification.platform.dispatch.ReconciliationJobStorePort
|
||||
reconciliationJobs,
|
||||
dev.caskeleton.application.notification.platform.callback.ProviderEventLedger ledger,
|
||||
dev.caskeleton.application.notification.platform.callback.ProviderEventProjectionService
|
||||
projection,
|
||||
NotificationMetricsPort metrics,
|
||||
NotificationDispatchProperties properties) {
|
||||
return new DispatchOutcomeRecorder(
|
||||
attempts,
|
||||
recipients,
|
||||
reconciliationJobs,
|
||||
ledger,
|
||||
projection,
|
||||
metrics,
|
||||
properties.leaseDuration());
|
||||
}
|
||||
|
||||
/** Dispatch runtime bounds. */
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public NotificationDispatchProperties notificationDispatchProperties(
|
||||
NotificationPlatformSettings settings) {
|
||||
return new NotificationDispatchProperties(
|
||||
settings.dispatch().claimBatchSize(),
|
||||
settings.dispatch().leaseDuration(),
|
||||
settings.dispatch().pollInterval(),
|
||||
settings.dispatch().maxGlobalConcurrency(),
|
||||
settings.dispatch().maxAdditionalAttempts(),
|
||||
Duration.ofSeconds(2),
|
||||
settings.dispatch().maxQueueAge(),
|
||||
Duration.ofSeconds(20));
|
||||
}
|
||||
|
||||
/** Dispatch orchestration. */
|
||||
@Bean
|
||||
public NotificationDispatchService notificationDispatchService(
|
||||
@@ -402,41 +300,30 @@ public class NotificationPlatformDispatchConfig {
|
||||
ledger, projectors, resolver, projections, sideEffects, transactions, metrics);
|
||||
}
|
||||
|
||||
/** Callback ingestion. */
|
||||
/** Semantic callback ingestion after provider verification has completed. */
|
||||
@Bean
|
||||
public IngestProviderCallbackApplicationUseCase providerCallbackIngestionService(
|
||||
ProviderCallbackAdapterRegistry adapters,
|
||||
ProviderEventLedger ledger,
|
||||
dev.caskeleton.application.transaction.TransactionPort transactions,
|
||||
CallbackPayloadProtectionPort payloadProtection,
|
||||
NotificationSecurityAuditPort securityAudit,
|
||||
NotificationMetricsPort metrics,
|
||||
Clock clock) {
|
||||
return new IngestProviderCallbackApplicationUseCase(
|
||||
adapters, ledger, transactions, payloadProtection, securityAudit, metrics, clock);
|
||||
ledger, transactions, payloadProtection, metrics, clock);
|
||||
}
|
||||
|
||||
/** Provider status correction. */
|
||||
/**
|
||||
* The adapter-to-adapter callback bridge owned by the composition root.
|
||||
*
|
||||
* <p>Raw HTTP remains in the inbound adapter, provider signature verification remains in the
|
||||
* outbound provider integration, and only the verified semantic callback crosses the application
|
||||
* port.
|
||||
*/
|
||||
@Bean
|
||||
public ReconciliationService reconciliationService(
|
||||
DeliveryAttemptStorePort attempts,
|
||||
RecipientDeliveryStorePort recipients,
|
||||
ReconciliationGatewayPort gateway,
|
||||
ProviderEventLedger ledger,
|
||||
ProviderEventProjectionService projection,
|
||||
NotificationAuditPort audit,
|
||||
NotificationMetricsPort metrics,
|
||||
SyntheticEventFingerprint syntheticEventFingerprints,
|
||||
Clock clock) {
|
||||
return new ReconciliationService(
|
||||
attempts,
|
||||
recipients,
|
||||
gateway,
|
||||
ledger,
|
||||
projection,
|
||||
audit,
|
||||
metrics,
|
||||
syntheticEventFingerprints,
|
||||
clock);
|
||||
public ProviderCallbackIngress providerCallbackIngress(
|
||||
ProviderCallbackAdapterRegistry adapters,
|
||||
IngestProviderCallbackUseCase ingestion,
|
||||
NotificationSecurityAuditPort securityAudit) {
|
||||
return new ProviderCallbackIngressBridge(adapters, ingestion, securityAudit);
|
||||
}
|
||||
}
|
||||
-129
@@ -1,129 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.notification;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.autoconfigure.NotificationPlatformSettings;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.dispatch.JacksonRoutingPlanCodec;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.dispatch.SingleTenantContext;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.dispatch.UuidV7Generator;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.security.AesGcmCallbackPayloadProtection;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.security.AesGcmNotificationPayloadProtection;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.security.HmacProviderRequestIdHasher;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.template.JacksonInboxContentCodec;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.template.JacksonTemplateContentCodec;
|
||||
import dev.caskeleton.application.notification.platform.callback.CallbackPayloadProtectionPort;
|
||||
import dev.caskeleton.application.notification.platform.dispatch.NotificationIdGeneratorPort;
|
||||
import dev.caskeleton.application.notification.platform.dispatch.NotificationRoutingPlanCodecPort;
|
||||
import dev.caskeleton.application.notification.platform.dispatch.ProviderRequestIdHasherPort;
|
||||
import dev.caskeleton.application.notification.platform.dispatch.TenantContextPort;
|
||||
import dev.caskeleton.application.notification.platform.inbox.InboxContentCodecPort;
|
||||
import dev.caskeleton.application.notification.platform.security.NotificationPayloadProtection;
|
||||
import dev.caskeleton.application.notification.platform.security.SecretMaterialProvider;
|
||||
import dev.caskeleton.application.notification.platform.template.TemplateContentCodecPort;
|
||||
import java.security.SecureRandom;
|
||||
import java.time.Clock;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Codecs, identifiers and keyed hashes.
|
||||
*
|
||||
* <p>The types every other notification configuration needs before it can build anything: how a row
|
||||
* gets its identifier, how a plan or template is encoded, and how a provider request id is hashed.
|
||||
*
|
||||
* <p>Split out of one 690-line composition class holding 42 beans. A configuration that assembles
|
||||
* codecs, security, templates, policy, providers and workers at once has no boundary a reader can
|
||||
* use: every change to any of them is a change to the same file, and nothing states which beans
|
||||
* belong together (NTF-022).
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnProperty(
|
||||
prefix = "ca-skeleton.notification.platform",
|
||||
name = "enabled",
|
||||
havingValue = "true")
|
||||
public class NotificationPlatformCodecConfig {
|
||||
|
||||
/** Time-ordered identifiers for every notification row. */
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public NotificationIdGeneratorPort notificationIdGenerator(Clock clock) {
|
||||
return new UuidV7Generator(clock);
|
||||
}
|
||||
|
||||
/** Single-tenant context; a multi-tenant deployment replaces this bean. */
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public TenantContextPort notificationTenantContext() {
|
||||
return new SingleTenantContext("default");
|
||||
}
|
||||
|
||||
/** Frozen route plan encoding. */
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public NotificationRoutingPlanCodecPort notificationRoutingPlanCodec() {
|
||||
return new JacksonRoutingPlanCodec();
|
||||
}
|
||||
|
||||
/** Template content encoding. */
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public TemplateContentCodecPort notificationTemplateContentCodec() {
|
||||
return new JacksonTemplateContentCodec();
|
||||
}
|
||||
|
||||
/** Inbox content encoding. */
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public InboxContentCodecPort notificationInboxContentCodec() {
|
||||
return new JacksonInboxContentCodec();
|
||||
}
|
||||
|
||||
/** Keyed hash of provider request identifiers. */
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public ProviderRequestIdHasherPort providerRequestIdHasher(SecretMaterialProvider secrets) {
|
||||
return new HmacProviderRequestIdHasher(secrets);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bounded, encrypted raw callback retention.
|
||||
*
|
||||
* <p>It encrypts through the notification payload protection rather than owning a second cipher,
|
||||
* so a retained callback and a retained notification payload are one envelope with one reader —
|
||||
* and, crucially, one that names the key it used. The separate implementation here wrote a bare
|
||||
* nonce and ciphertext, so a payload key rotation left every retained callback unreadable with
|
||||
* nothing in the row to say which key it had needed.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public CallbackPayloadProtectionPort callbackPayloadProtection(
|
||||
SecretMaterialProvider secrets,
|
||||
NotificationPayloadProtection payloadProtection,
|
||||
NotificationPlatformSettings settings) {
|
||||
return new AesGcmCallbackPayloadProtection(
|
||||
secrets,
|
||||
payloadProtection,
|
||||
(int) Math.min(settings.callbacks().maxBodyBytes(), Integer.MAX_VALUE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Encrypted notification variables at rest.
|
||||
*
|
||||
* <p>Required, not optional. {@code NotificationRecordMapper} takes this as a constructor
|
||||
* argument with no fallback, so a deployment either has it or does not start — which is
|
||||
* deliberate: the alternative design, an absent bean meaning "store the variables as they are",
|
||||
* writes recipient addresses and message content to a table in plaintext and reports a healthy
|
||||
* start.
|
||||
*
|
||||
* <p>The nonce source is constructed here rather than injected because there is no {@code
|
||||
* SecureRandom} bean in this application and adding one would make the nonce source something a
|
||||
* deployment could replace. {@link NotificationPlatformPolicyConfig} constructs its own for the
|
||||
* same reason.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public NotificationPayloadProtection notificationPayloadProtection(
|
||||
SecretMaterialProvider secrets) {
|
||||
return new AesGcmNotificationPayloadProtection(secrets, new SecureRandom());
|
||||
}
|
||||
}
|
||||
-122
@@ -1,122 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.notification;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.autoconfigure.NotificationPlatformSettings;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.autoconfigure.NotificationProviderAssembly;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.dispatch.LoggingInboxSignalPublisher;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.dispatch.ProviderRuntimeRegistry;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.observation.LoggingNotificationAudit;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.observation.LoggingNotificationMetrics;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.observation.MicrometerNotificationMetrics;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.observation.NotificationHealthReporter;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.observation.NotificationServingThresholds;
|
||||
import dev.caskeleton.application.notification.platform.api.ProviderProfileId;
|
||||
import dev.caskeleton.application.notification.platform.inbox.NotificationInboxSignalPort;
|
||||
import dev.caskeleton.application.notification.platform.observation.CardinalityGuard;
|
||||
import dev.caskeleton.application.notification.platform.observation.NotificationAuditPort;
|
||||
import dev.caskeleton.application.notification.platform.observation.NotificationMetricsPort;
|
||||
import dev.caskeleton.application.notification.platform.observation.NotificationSecurityAuditPort;
|
||||
import dev.caskeleton.application.notification.platform.observation.NotificationServingStatePort;
|
||||
import dev.caskeleton.bootstrap.autoconfigure.notification.observation.NotificationHealthEndpoint;
|
||||
import dev.caskeleton.bootstrap.autoconfigure.notification.observation.NotificationObservationConvention;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Metrics, health and audit.
|
||||
*
|
||||
* <p>What the platform reports about itself. Kept apart from the beans it observes so that changing
|
||||
* an audit sink cannot disturb the dispatch graph.
|
||||
*
|
||||
* <p>Split out of one 690-line composition class holding 42 beans. A configuration that assembles
|
||||
* codecs, security, templates, policy, providers and workers at once has no boundary a reader can
|
||||
* use: every change to any of them is a change to the same file, and nothing states which beans
|
||||
* belong together (NTF-022).
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnProperty(
|
||||
prefix = "ca-skeleton.notification.platform",
|
||||
name = "enabled",
|
||||
havingValue = "true")
|
||||
public class NotificationPlatformObservabilityConfig {
|
||||
|
||||
/** Metric tag guard. */
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public CardinalityGuard notificationCardinalityGuard() {
|
||||
return new CardinalityGuard();
|
||||
}
|
||||
|
||||
/**
|
||||
* Metrics sink.
|
||||
*
|
||||
* <p>Chosen here rather than through two competing {@code @ConditionalOnMissingBean} definitions:
|
||||
* which of the two wins would then depend on configuration ordering, and the failure mode is a
|
||||
* deployment that silently logs its metrics instead of exporting them.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public NotificationMetricsPort notificationMetrics(
|
||||
CardinalityGuard guard, ObjectProvider<io.micrometer.core.instrument.MeterRegistry> meters) {
|
||||
io.micrometer.core.instrument.MeterRegistry registry = meters.getIfAvailable();
|
||||
return registry == null
|
||||
? new LoggingNotificationMetrics(guard)
|
||||
: new MicrometerNotificationMetrics(registry, guard);
|
||||
}
|
||||
|
||||
/** Naming and tagging convention shared by dispatch and callback observations. */
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public NotificationObservationConvention notificationObservationConvention(
|
||||
CardinalityGuard guard) {
|
||||
return new NotificationObservationConvention(guard);
|
||||
}
|
||||
|
||||
/** Operational snapshot source for the actuator endpoint. */
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public NotificationHealthReporter notificationHealthReporter(
|
||||
ProviderRuntimeRegistry runtimes,
|
||||
NotificationPlatformSettings settings,
|
||||
NotificationProviderAssembly.AssembledPlatform platform,
|
||||
NotificationServingStatePort servingState) {
|
||||
return new NotificationHealthReporter(
|
||||
runtimes,
|
||||
settings.providers().keySet().stream().map(ProviderProfileId::new).toList(),
|
||||
servingState,
|
||||
platform.routes().keySet(),
|
||||
NotificationServingThresholds.DEFAULT);
|
||||
}
|
||||
|
||||
/** Actuator endpoint and health indicator for the platform. */
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public NotificationHealthEndpoint notificationHealthEndpoint(
|
||||
NotificationHealthReporter reporter) {
|
||||
return new NotificationHealthEndpoint(reporter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Audit sink, which is also the security audit port.
|
||||
*
|
||||
* <p>One bean. {@link LoggingNotificationAudit} implements both {@link NotificationAuditPort} and
|
||||
* {@link NotificationSecurityAuditPort}, so a dependency on either type resolves to it; adding a
|
||||
* {@code @Bean} method per port registered the same object under two more names and made the
|
||||
* concrete type ambiguous, which is a startup failure rather than a preference — the same defect
|
||||
* NotificationJpaPersistenceFacade carried for the delivery attempt store.
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public LoggingNotificationAudit notificationAudit() {
|
||||
return new LoggingNotificationAudit();
|
||||
}
|
||||
|
||||
/** Inbox signal sink. */
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public NotificationInboxSignalPort notificationInboxSignalPort() {
|
||||
return new LoggingInboxSignalPublisher();
|
||||
}
|
||||
}
|
||||
-146
@@ -1,146 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.notification;
|
||||
|
||||
import dev.caskeleton.application.notification.platform.dispatch.CanonicalNotificationPlanWriter;
|
||||
import dev.caskeleton.application.notification.platform.dispatch.MessageDigestPort;
|
||||
import dev.caskeleton.application.notification.platform.dispatch.NotificationIdGeneratorPort;
|
||||
import dev.caskeleton.application.notification.platform.dispatch.NotificationRoutePlannerPort;
|
||||
import dev.caskeleton.application.notification.platform.dispatch.RequestFingerprint;
|
||||
import dev.caskeleton.application.notification.platform.dispatch.SyntheticEventFingerprint;
|
||||
import dev.caskeleton.application.notification.platform.policy.CompositeNotificationEligibilityPolicy;
|
||||
import dev.caskeleton.application.notification.platform.policy.DefaultNotificationRetryPolicy;
|
||||
import dev.caskeleton.application.notification.platform.policy.JitterSource;
|
||||
import dev.caskeleton.application.notification.platform.policy.NotificationEligibilityPolicy;
|
||||
import dev.caskeleton.application.notification.platform.policy.NotificationRetryPolicy;
|
||||
import dev.caskeleton.application.notification.platform.policy.PreferenceStorePort;
|
||||
import dev.caskeleton.application.notification.platform.policy.RetryBackoff;
|
||||
import dev.caskeleton.application.notification.platform.policy.RoutingDecisionEngine;
|
||||
import dev.caskeleton.application.notification.platform.policy.SuppressionStorePort;
|
||||
import java.security.SecureRandom;
|
||||
import java.time.Clock;
|
||||
import java.time.Duration;
|
||||
import java.util.Optional;
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Eligibility, retry, routing and deduplication policy.
|
||||
*
|
||||
* <p>The decisions that do not depend on a provider being configured: whether a recipient may be
|
||||
* contacted, when a failure is retried, and what counts as the same request twice.
|
||||
*
|
||||
* <p>Split out of one 690-line composition class holding 42 beans. A configuration that assembles
|
||||
* codecs, security, templates, policy, providers and workers at once has no boundary a reader can
|
||||
* use: every change to any of them is a change to the same file, and nothing states which beans
|
||||
* belong together (NTF-022).
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnProperty(
|
||||
prefix = "ca-skeleton.notification.platform",
|
||||
name = "enabled",
|
||||
havingValue = "true")
|
||||
public class NotificationPlatformPolicyConfig {
|
||||
|
||||
/**
|
||||
* Eligibility: mandatory suppression first, a deployment's own business rule last.
|
||||
*
|
||||
* <p>The extension point is qualified by name, and the back-off is by name, because the obvious
|
||||
* spelling of both is a bean that can only find itself. This method used to take an {@code
|
||||
* ObjectProvider<NotificationEligibilityPolicy>} — its own bean type — under an unqualified
|
||||
* {@code @ConditionalOnMissingBean}: if any other policy bean existed the method would not be
|
||||
* registered at all, so the provider could only ever resolve to this same definition. It was a
|
||||
* self-cycle the container refuses to start with, and the "injected business policy" it
|
||||
* advertised could never have been injected.
|
||||
*
|
||||
* <p>The name split also keeps the mandatory half mandatory. A type-scoped
|
||||
* {@code @ConditionalOnMissingBean} means a deployment that adds a business rule silently
|
||||
* *replaces* the composite, dropping the suppression and preference checks it never meant to
|
||||
* touch. So:
|
||||
*
|
||||
* <ul>
|
||||
* <li>define {@code notificationBusinessEligibilityPolicy} to add a rule — suppression and
|
||||
* preferences still run, and the rule runs last;
|
||||
* <li>define {@code notificationEligibilityPolicy} to take the decision over entirely, which is
|
||||
* then visibly a decision about all three checks.
|
||||
* </ul>
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(name = "notificationEligibilityPolicy")
|
||||
public NotificationEligibilityPolicy notificationEligibilityPolicy(
|
||||
SuppressionStorePort suppressions,
|
||||
PreferenceStorePort preferences,
|
||||
@Qualifier("notificationBusinessEligibilityPolicy")
|
||||
ObjectProvider<NotificationEligibilityPolicy> business) {
|
||||
return new CompositeNotificationEligibilityPolicy(
|
||||
suppressions,
|
||||
preferences,
|
||||
Optional.ofNullable(business.getIfAvailable())
|
||||
.orElseGet(NotificationEligibilityPolicy::permitAll));
|
||||
}
|
||||
|
||||
/** Evidence-aware retry policy. */
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public NotificationRetryPolicy notificationRetryPolicy() {
|
||||
SecureRandom random = new SecureRandom();
|
||||
JitterSource jitter = bound -> bound <= 1 ? 0 : Math.floorMod(random.nextLong(), bound);
|
||||
return new DefaultNotificationRetryPolicy(RetryBackoff.DEFAULT, jitter, Duration.ofMinutes(1));
|
||||
}
|
||||
|
||||
/** Stable routing engine. */
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public RoutingDecisionEngine routingDecisionEngine() {
|
||||
return new RoutingDecisionEngine();
|
||||
}
|
||||
|
||||
/** Canonical request fingerprint. */
|
||||
@Bean
|
||||
public RequestFingerprint requestFingerprint(MessageDigestPort digest) {
|
||||
return new RequestFingerprint(digest);
|
||||
}
|
||||
|
||||
/**
|
||||
* Identity of an event the platform synthesised from a provider's answer.
|
||||
*
|
||||
* @param digest the hashing boundary
|
||||
* @return the fingerprint
|
||||
*/
|
||||
@Bean
|
||||
public SyntheticEventFingerprint syntheticEventFingerprint(MessageDigestPort digest) {
|
||||
return new SyntheticEventFingerprint(digest);
|
||||
}
|
||||
|
||||
/** Durable row factory for a submission. */
|
||||
@Bean
|
||||
public CanonicalNotificationPlanWriter canonicalNotificationPlanWriter(
|
||||
NotificationIdGeneratorPort ids, NotificationRoutePlannerPort routePlanner) {
|
||||
// No variables codec: the stored payload comes from the same canonical encoding the fingerprint
|
||||
// is taken over, so there is no second encoder for the two to disagree about.
|
||||
return new CanonicalNotificationPlanWriter(ids, routePlanner);
|
||||
}
|
||||
|
||||
/**
|
||||
* The deduplication window claim.
|
||||
*
|
||||
* <p>The store implementation and the service both existed; neither was ever registered as a
|
||||
* bean, so nothing could call them. A caller who asked for a dedup window received every
|
||||
* duplicate — the contract was public, accepted, validated, and inert.
|
||||
*
|
||||
* @param store the durable window claims
|
||||
* @param clock the clock the window buckets are computed from
|
||||
* @return the service
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public dev.caskeleton.application.notification.platform.policy.DeduplicationService
|
||||
notificationDeduplicationService(
|
||||
dev.caskeleton.application.notification.platform.policy.DeduplicationStorePort store,
|
||||
Clock clock) {
|
||||
return new dev.caskeleton.application.notification.platform.policy.DeduplicationService(
|
||||
store, clock);
|
||||
}
|
||||
}
|
||||
-136
@@ -1,136 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.notification;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.autoconfigure.NotificationPlatformSettings;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.autoconfigure.NotificationProviderAssembly;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.autoconfigure.ProviderRuntimeAssembler;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.dispatch.CapabilityReconciliationGateway;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.dispatch.MapTemplateRendererRegistry;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.dispatch.ProviderRuntimeRegistry;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.dispatch.RegistryProviderDispatchGateway;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.template.CanonicalNotificationRenderer;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.template.NotificationTemplateEngine;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.template.ThymeleafNotificationRenderer;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.template.ThymeleafStringTemplateEngine;
|
||||
import dev.caskeleton.application.notification.platform.api.routing.Channel;
|
||||
import dev.caskeleton.application.notification.platform.dispatch.NotificationRoutePlannerPort;
|
||||
import dev.caskeleton.application.notification.platform.dispatch.ProviderDispatchGatewayPort;
|
||||
import dev.caskeleton.application.notification.platform.dispatch.ReconciliationGatewayPort;
|
||||
import dev.caskeleton.application.notification.platform.dispatch.TemplateRendererRegistry;
|
||||
import dev.caskeleton.application.notification.platform.template.NotificationTemplateRenderer;
|
||||
import dev.caskeleton.application.notification.platform.template.TemplateRegistry;
|
||||
import dev.caskeleton.application.notification.platform.template.TemplateVariableValidator;
|
||||
import java.util.List;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Provider assembly, routing and the gateways built on it.
|
||||
*
|
||||
* <p>One assembly step produces the runtime registry, the channel routes and the reconciliation
|
||||
* map; the gateways read from what it produced rather than from empty collections.
|
||||
*
|
||||
* <p>Split out of one 690-line composition class holding 42 beans. A configuration that assembles
|
||||
* codecs, security, templates, policy, providers and workers at once has no boundary a reader can
|
||||
* use: every change to any of them is a change to the same file, and nothing states which beans
|
||||
* belong together (NTF-022).
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnProperty(
|
||||
prefix = "ca-skeleton.notification.platform",
|
||||
name = "enabled",
|
||||
havingValue = "true")
|
||||
public class NotificationPlatformProviderConfig {
|
||||
|
||||
/**
|
||||
* Channel renderers built on the configured engine and the shared validator.
|
||||
*
|
||||
* <p>Every channel gets the same engine on purpose. Rendering the email body with one engine and
|
||||
* the push body with another would mean two escaping policies for the same variable, and the
|
||||
* content digest — which a retry uses to prove it sent the same thing — would depend on which
|
||||
* channel rendered it.
|
||||
*/
|
||||
@Bean
|
||||
public TemplateRendererRegistry notificationTemplateRendererRegistry(
|
||||
TemplateRegistry templates,
|
||||
TemplateVariableValidator validator,
|
||||
NotificationTemplateEngine engine) {
|
||||
List<NotificationTemplateRenderer> renderers =
|
||||
List.of(Channel.values()).stream()
|
||||
.map(channel -> renderer(channel, templates, validator, engine))
|
||||
.toList();
|
||||
return new MapTemplateRendererRegistry(renderers);
|
||||
}
|
||||
|
||||
private static NotificationTemplateRenderer renderer(
|
||||
Channel channel,
|
||||
TemplateRegistry templates,
|
||||
TemplateVariableValidator validator,
|
||||
NotificationTemplateEngine engine) {
|
||||
// Named types rather than one generic renderer, so a stack trace and a bean name say which
|
||||
// engine actually produced the content.
|
||||
return engine instanceof ThymeleafStringTemplateEngine thymeleaf
|
||||
? new ThymeleafNotificationRenderer(channel, templates, validator, thymeleaf)
|
||||
: new CanonicalNotificationRenderer(channel, templates, validator, engine);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assembles every configured provider profile, or refuses to start.
|
||||
*
|
||||
* <p>This bean is the whole of NTF-001. The registry, the route map and the reconciliation map
|
||||
* were each constructed empty, so configuring a provider changed nothing about what the runtime
|
||||
* could do: requests reached durable acceptance and then found no eligible route. Assembly is now
|
||||
* one step that either produces a working platform or names what stopped it, before the dispatch
|
||||
* worker starts.
|
||||
*
|
||||
* @param assemblers one assembler per supported provider family
|
||||
* @param settings the bound platform configuration
|
||||
* @return the assembled platform
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public NotificationProviderAssembly.AssembledPlatform assembledNotificationPlatform(
|
||||
java.util.List<ProviderRuntimeAssembler> assemblers, NotificationPlatformSettings settings) {
|
||||
// The persistence facade already refuses to start until the notification schema stream is
|
||||
// applied and promoted, and it declares that bean before its stores. Duplicating the gate here
|
||||
// would reach past the persistence leaf's export surface for no additional safety.
|
||||
return new NotificationProviderAssembly(assemblers).assemble(settings, settings.mode());
|
||||
}
|
||||
|
||||
/** The registry the assembly filled, rather than an empty one. */
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public ProviderRuntimeRegistry providerRuntimeRegistry(
|
||||
NotificationProviderAssembly.AssembledPlatform platform) {
|
||||
return platform.runtimes();
|
||||
}
|
||||
|
||||
/** Outbound provider call with permit and health handling. */
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public ProviderDispatchGatewayPort providerDispatchGateway(ProviderRuntimeRegistry runtimes) {
|
||||
return new RegistryProviderDispatchGateway(runtimes);
|
||||
}
|
||||
|
||||
/** Provider status query routing. */
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public ReconciliationGatewayPort reconciliationGateway(
|
||||
ProviderRuntimeRegistry runtimes, NotificationProviderAssembly.AssembledPlatform platform) {
|
||||
return new CapabilityReconciliationGateway(platform.reconciliations(), runtimes);
|
||||
}
|
||||
|
||||
/** Route planning from the configured channel-to-profile map. */
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public NotificationRoutePlannerPort notificationRoutePlanner(
|
||||
NotificationProviderAssembly.AssembledPlatform platform) {
|
||||
// The adapter supplies the configured catalogue; the application decides eligibility, order and
|
||||
// fallback. Those decisions used to be made inside ConfiguredRoutePlanner, in the outbound
|
||||
// adapter, where no application test could reach them.
|
||||
return new dev.caskeleton.application.notification.platform.dispatch.PolicyRoutePlanner(
|
||||
new dev.caskeleton.adapter.outbound.notification.platform.dispatch.ConfiguredProfileCatalog(
|
||||
platform.routes()));
|
||||
}
|
||||
}
|
||||
-70
@@ -1,70 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.notification;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.autoconfigure.NotificationPlatformSettings;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.callback.MapProviderCallbackAdapterRegistry;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.callback.MapProviderEventProjectorRegistry;
|
||||
import dev.caskeleton.application.notification.platform.api.ProviderId;
|
||||
import dev.caskeleton.application.notification.platform.api.ProviderProfileId;
|
||||
import dev.caskeleton.application.notification.platform.callback.CallbackLimits;
|
||||
import dev.caskeleton.application.notification.platform.callback.ProviderCallbackAdapter;
|
||||
import dev.caskeleton.application.notification.platform.callback.ProviderCallbackAdapterRegistry;
|
||||
import dev.caskeleton.application.notification.platform.callback.ProviderEventProjector;
|
||||
import dev.caskeleton.application.notification.platform.callback.ProviderEventProjectorRegistry;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Registries assembled from whatever provider beans the deployment actually declared.
|
||||
*
|
||||
* <p>Both registries are built from the bean list rather than a hard-coded switch, so adding a
|
||||
* provider is a matter of contributing a bean — the plan's requirement that a new adapter needs no
|
||||
* change to the core.
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnProperty(
|
||||
prefix = "ca-skeleton.notification.platform",
|
||||
name = "enabled",
|
||||
havingValue = "true")
|
||||
public class NotificationPlatformRegistriesConfig {
|
||||
|
||||
/** Projector lookup by provider family. */
|
||||
@Bean
|
||||
public ProviderEventProjectorRegistry providerEventProjectorRegistry(
|
||||
List<ProviderEventProjector> projectors) {
|
||||
Map<ProviderId, ProviderEventProjector> byProvider = new HashMap<>();
|
||||
projectors.forEach(projector -> byProvider.put(projector.providerId(), projector));
|
||||
return new MapProviderEventProjectorRegistry(byProvider);
|
||||
}
|
||||
|
||||
/** Callback adapter lookup by configured profile. */
|
||||
@Bean
|
||||
public ProviderCallbackAdapterRegistry providerCallbackAdapterRegistry(
|
||||
List<ProviderCallbackAdapter> adapters, NotificationPlatformSettings settings) {
|
||||
Map<String, ProviderCallbackAdapter> byProvider = new HashMap<>();
|
||||
adapters.forEach(adapter -> byProvider.put(adapter.providerId().value(), adapter));
|
||||
|
||||
Map<ProviderProfileId, ProviderCallbackAdapter> byProfile = new HashMap<>();
|
||||
settings
|
||||
.providers()
|
||||
.forEach(
|
||||
(profileId, provider) -> {
|
||||
ProviderCallbackAdapter adapter =
|
||||
byProvider.get(provider.type().toLowerCase(java.util.Locale.ROOT));
|
||||
if (adapter != null) {
|
||||
byProfile.put(new ProviderProfileId(profileId), adapter);
|
||||
}
|
||||
});
|
||||
|
||||
CallbackLimits limits =
|
||||
new CallbackLimits(
|
||||
settings.callbacks().maxBodyBytes(),
|
||||
Set.of("application/json", "text/plain", "application/x-www-form-urlencoded"));
|
||||
|
||||
return new MapProviderCallbackAdapterRegistry(byProfile, limits);
|
||||
}
|
||||
}
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.notification;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* Composition root for the notification platform.
|
||||
*
|
||||
* <p>Only this class sees every leaf at once, which is what lets application-core stay free of
|
||||
* Spring and every adapter stay unaware of the others.
|
||||
*
|
||||
* <p>The provider runtime registry starts empty on purpose. Registering a provider requires
|
||||
* credentials and a profile, so a deployment that has not configured one gets a platform that
|
||||
* accepts and stores notifications and reports no eligible route — a visible, diagnosable state
|
||||
* rather than a startup failure or a silent drop.
|
||||
*
|
||||
* <p>It holds no beans of its own. It used to hold 42 — codecs, secrets, templates, policy,
|
||||
* providers, dispatch and workers in one 690-line file — which meant there was no place to look up
|
||||
* "what does the provider wiring consist of" other than by reading all of it. Each import below is
|
||||
* one answer to that question.
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnProperty(
|
||||
prefix = "ca-skeleton.notification.platform",
|
||||
name = "enabled",
|
||||
havingValue = "true")
|
||||
@Import({
|
||||
NotificationPlatformCodecConfig.class,
|
||||
NotificationPlatformObservabilityConfig.class,
|
||||
NotificationPlatformProviderConfig.class,
|
||||
NotificationPlatformPolicyConfig.class,
|
||||
NotificationPlatformDispatchConfig.class,
|
||||
NotificationPlatformWorkerConfig.class,
|
||||
// The SMTP provider family. It carries its own narrower condition — a relay must be configured —
|
||||
// so a deployment with the platform on and no spring.mail.host contributes no assembler and any
|
||||
// profile declaring type: SMTP is refused by name at assembly rather than dispatched into
|
||||
// nothing.
|
||||
dev.caskeleton.adapter.outbound.notification.platform.autoconfigure.NotificationSmtpProviderConfig
|
||||
.class,
|
||||
})
|
||||
public class NotificationPlatformRuntimeConfig {}
|
||||
-287
@@ -1,287 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.notification;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.autoconfigure.NotificationPlatformSettings;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.autoconfigure.NotificationSecretRequirements;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.security.SettingsSecretMaterialProvider;
|
||||
import dev.caskeleton.application.notification.platform.security.SecretKeyMaterial;
|
||||
import dev.caskeleton.application.notification.platform.security.SecretMaterialProvider;
|
||||
import dev.caskeleton.application.notification.platform.security.SecretPurpose;
|
||||
import dev.caskeleton.bootstrap.runtime.startup.StartupFailures;
|
||||
import java.util.Base64;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Key material for the notification platform.
|
||||
*
|
||||
* <p>Values arrive base64-encoded from the environment. The class documented a strict startup check
|
||||
* and did not perform one: a blank value was skipped silently, so a deployment missing its contact
|
||||
* encryption key started and failed on the first contact point instead of at boot; nothing checked
|
||||
* key length, so a four-byte key was accepted; and nothing checked that two purposes had been given
|
||||
* different material, so one leaked key could be every key.
|
||||
*
|
||||
* <p>Key ids were constants — {@code contact-enc}, {@code payload-enc} — so replacing the material
|
||||
* behind one produced ciphertext indistinguishable from the old, under the same id, and nothing
|
||||
* could decrypt what came before. Each purpose now names its own active key id and may carry
|
||||
* historical keys, which is what makes a rotation survivable rather than destructive.
|
||||
*
|
||||
* <p>A retired key is declared under the purpose it served, because a key's purpose is not
|
||||
* recoverable from its id and every consumer that checks one refuses a key carrying the wrong one.
|
||||
* Filing every retired key under contact encryption made a rotation of any other purpose worse than
|
||||
* no rotation at all: {@code ProviderCredentialManager} rejects a generation whose key is not a
|
||||
* provider credential, so draining the previous generation — the thing historical keys exist for —
|
||||
* failed on the first in-flight attempt.
|
||||
*
|
||||
* <p>What is demanded follows what is switched on. All eight purposes were required of every
|
||||
* deployment, so an SMTP-only platform with callbacks off had to provision and rotate a Web Push
|
||||
* signing key, a provider credential and two callback keys that nothing could reach — and a key
|
||||
* that exists and is never used is a key nobody notices leaking. {@link
|
||||
* NotificationSecretRequirements} decides the set; the fail-closed half is unchanged, because a
|
||||
* capability that is on and missing its key still refuses the boot.
|
||||
*
|
||||
* <p>No message here carries key material. A deployment learns which purpose or which key id is
|
||||
* wrong and nothing about what it holds, because a startup failure is written to a log that a
|
||||
* secret must never reach.
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnProperty(
|
||||
prefix = "ca-skeleton.notification.platform",
|
||||
name = "enabled",
|
||||
havingValue = "true")
|
||||
@EnableConfigurationProperties(NotificationPlatformSecretsConfig.NotificationSecretsSettings.class)
|
||||
public class NotificationPlatformSecretsConfig {
|
||||
|
||||
/** Base64 key material bound from the environment. */
|
||||
@ConfigurationProperties("ca-skeleton.notification.platform.secrets")
|
||||
public record NotificationSecretsSettings(
|
||||
String contactEncryptionKey,
|
||||
String contactLookupHmacKey,
|
||||
String callbackSigningKey,
|
||||
String providerCredentialKey,
|
||||
String payloadEncryptionKey,
|
||||
String vapidSigningKey,
|
||||
String providerRequestLookupHmacKey,
|
||||
String callbackFingerprintHmacKey,
|
||||
Map<String, String> activeKeyIds,
|
||||
Map<String, Map<String, String>> historicalKeys) {
|
||||
|
||||
/** Defaults the two maps so an unset property is an empty map rather than a null. */
|
||||
public NotificationSecretsSettings {
|
||||
activeKeyIds = activeKeyIds == null ? Map.of() : Map.copyOf(activeKeyIds);
|
||||
historicalKeys =
|
||||
historicalKeys == null
|
||||
? Map.of()
|
||||
: historicalKeys.entrySet().stream()
|
||||
.collect(
|
||||
java.util.stream.Collectors.toUnmodifiableMap(
|
||||
Map.Entry::getKey, entry -> Map.copyOf(entry.getValue())));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Secret provider assembled from the bound settings.
|
||||
*
|
||||
* @param platform the platform configuration, which decides which purposes are reachable
|
||||
* @param settings the bound key material
|
||||
* @return the provider
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public SecretMaterialProvider notificationSecretMaterialProvider(
|
||||
NotificationPlatformSettings platform, NotificationSecretsSettings settings) {
|
||||
Objects.requireNonNull(settings, "settings");
|
||||
Objects.requireNonNull(platform, "platform");
|
||||
Set<SecretPurpose> required = NotificationSecretRequirements.requiredBy(platform);
|
||||
|
||||
Map<SecretPurpose, SecretKeyMaterial> active = new EnumMap<>(SecretPurpose.class);
|
||||
configured(settings)
|
||||
.forEach((purpose, base64) -> put(active, settings, purpose, base64, required));
|
||||
|
||||
Map<String, SecretKeyMaterial> historical = historical(settings);
|
||||
requireDistinctMaterial(active, historical);
|
||||
return new SettingsSecretMaterialProvider(active, historical);
|
||||
}
|
||||
|
||||
/** The bound value for each purpose, in a fixed order so a failure names the same one twice. */
|
||||
private static Map<SecretPurpose, String> configured(NotificationSecretsSettings settings) {
|
||||
Map<SecretPurpose, String> values = new EnumMap<>(SecretPurpose.class);
|
||||
values.put(SecretPurpose.CONTACT_ENCRYPTION, settings.contactEncryptionKey());
|
||||
values.put(SecretPurpose.CONTACT_LOOKUP_HMAC, settings.contactLookupHmacKey());
|
||||
values.put(SecretPurpose.CALLBACK_SIGNING, settings.callbackSigningKey());
|
||||
values.put(SecretPurpose.PROVIDER_CREDENTIAL, settings.providerCredentialKey());
|
||||
values.put(SecretPurpose.PAYLOAD_ENCRYPTION, settings.payloadEncryptionKey());
|
||||
values.put(SecretPurpose.VAPID_SIGNING, settings.vapidSigningKey());
|
||||
values.put(SecretPurpose.PROVIDER_REQUEST_LOOKUP_HMAC, settings.providerRequestLookupHmacKey());
|
||||
values.put(SecretPurpose.CALLBACK_FINGERPRINT_HMAC, settings.callbackFingerprintHmacKey());
|
||||
return values;
|
||||
}
|
||||
|
||||
/**
|
||||
* Binds one purpose's active key, or fails the boot when the configuration can reach it.
|
||||
*
|
||||
* <p>A blank value used to be skipped for every purpose, so the platform started without the key
|
||||
* and discovered it on the first contact point — in production, on a user's notification, hours
|
||||
* after the deployment that caused it. It is now skipped only for a purpose this configuration
|
||||
* has switched off, and supplying one anyway is still validated: an unused key that is present
|
||||
* and wrong is a key that fails the day the capability is turned on.
|
||||
*/
|
||||
private static void put(
|
||||
Map<SecretPurpose, SecretKeyMaterial> target,
|
||||
NotificationSecretsSettings settings,
|
||||
SecretPurpose purpose,
|
||||
String base64,
|
||||
Set<SecretPurpose> required) {
|
||||
boolean supplied = base64 != null && !base64.isBlank();
|
||||
if (!supplied) {
|
||||
if (required.contains(purpose)) {
|
||||
throw StartupFailures.envValidation(
|
||||
"notification secret for "
|
||||
+ purpose
|
||||
+ " is not configured; the capability that uses it is enabled, so the platform"
|
||||
+ " cannot start without it");
|
||||
}
|
||||
return;
|
||||
}
|
||||
String keyId = settings.activeKeyIds().get(purpose.name());
|
||||
if (keyId == null || keyId.isBlank()) {
|
||||
throw StartupFailures.envValidation(
|
||||
"no active key id configured for "
|
||||
+ purpose
|
||||
+ "; a constant id makes a rotation indistinguishable from the key it replaced, so"
|
||||
+ " nothing can decrypt what was written before it");
|
||||
}
|
||||
target.put(purpose, material(purpose, keyId, base64));
|
||||
}
|
||||
|
||||
/**
|
||||
* The keys kept so data written before a rotation can still be read.
|
||||
*
|
||||
* <p>Declared per purpose — {@code historical-keys.PAYLOAD_ENCRYPTION.payload-2026-01} — because
|
||||
* every consumer that resolves a key by id checks the purpose it carries. Retired keys filed
|
||||
* under one purpose regardless of what they served made the historical map worse than empty: a
|
||||
* retired provider credential resolved, failed its purpose check, and the drain it was kept for
|
||||
* failed on the first in-flight attempt.
|
||||
*/
|
||||
private static Map<String, SecretKeyMaterial> historical(NotificationSecretsSettings settings) {
|
||||
Map<String, SecretKeyMaterial> historical = new java.util.LinkedHashMap<>();
|
||||
settings
|
||||
.historicalKeys()
|
||||
.forEach(
|
||||
(purposeName, keys) -> {
|
||||
SecretPurpose purpose = purposeOf(purposeName);
|
||||
keys.forEach(
|
||||
(keyId, base64) -> {
|
||||
if (settings.activeKeyIds().containsValue(keyId)) {
|
||||
// The same id under two different materials is the one state no reader can
|
||||
// resolve: the envelope names an id and two keys answer to it.
|
||||
throw StartupFailures.envValidation(
|
||||
"key id " + keyId + " is both active and historical");
|
||||
}
|
||||
SecretKeyMaterial previous =
|
||||
historical.put(keyId, material(purpose, keyId, base64));
|
||||
if (previous != null) {
|
||||
throw StartupFailures.envValidation(
|
||||
"key id "
|
||||
+ keyId
|
||||
+ " is declared for both "
|
||||
+ previous.purpose()
|
||||
+ " and "
|
||||
+ purpose);
|
||||
}
|
||||
});
|
||||
});
|
||||
return Map.copyOf(historical);
|
||||
}
|
||||
|
||||
/** Decodes and length-checks one key, active or retired. */
|
||||
private static SecretKeyMaterial material(SecretPurpose purpose, String keyId, String base64) {
|
||||
if (base64 == null || base64.isBlank()) {
|
||||
throw StartupFailures.envValidation(
|
||||
"notification secret " + keyId + " for " + purpose + " has no value");
|
||||
}
|
||||
byte[] material = decode(purpose, keyId, base64);
|
||||
if (material.length < MINIMUM_KEY_BYTES) {
|
||||
throw StartupFailures.envValidation(
|
||||
"notification secret "
|
||||
+ keyId
|
||||
+ " for "
|
||||
+ purpose
|
||||
+ " is "
|
||||
+ material.length
|
||||
+ " bytes; at least "
|
||||
+ MINIMUM_KEY_BYTES
|
||||
+ " are required");
|
||||
}
|
||||
return new SecretKeyMaterial(keyId, purpose, material);
|
||||
}
|
||||
|
||||
/** The purpose a block of retired keys was issued for. */
|
||||
private static SecretPurpose purposeOf(String name) {
|
||||
try {
|
||||
return SecretPurpose.valueOf(name);
|
||||
} catch (IllegalArgumentException unknown) {
|
||||
// Naming the purpose, never the keys under it: a typo here would otherwise be reported by
|
||||
// echoing the block that was misfiled.
|
||||
throw StartupFailures.envValidation(
|
||||
"historical notification secrets are declared under key purpose "
|
||||
+ name
|
||||
+ ", which is not a purpose this platform issues keys for",
|
||||
unknown);
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] decode(SecretPurpose purpose, String keyId, String base64) {
|
||||
try {
|
||||
return Base64.getDecoder().decode(base64);
|
||||
} catch (IllegalArgumentException malformed) {
|
||||
// The id and the purpose, never the value, and never the decoder's own message — a base64
|
||||
// failure report can quote the input it choked on.
|
||||
throw StartupFailures.envValidation(
|
||||
"notification secret " + keyId + " for " + purpose + " is not valid base64");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refuses a configuration where two keys share material.
|
||||
*
|
||||
* <p>Purpose separation is the property that keeps one compromised key from being every key. It
|
||||
* was checked partially, on first use, by whichever component happened to need two keys at once.
|
||||
* Retired keys are included because a rotation that re-declares the material it replaced is a
|
||||
* rotation in name only, and nothing downstream can tell.
|
||||
*/
|
||||
private static void requireDistinctMaterial(
|
||||
Map<SecretPurpose, SecretKeyMaterial> active, Map<String, SecretKeyMaterial> historical) {
|
||||
Map<String, SecretKeyMaterial> seen = new java.util.HashMap<>();
|
||||
java.util.stream.Stream.concat(active.values().stream(), historical.values().stream())
|
||||
.forEach(
|
||||
key -> {
|
||||
// The hex is a map key inside this method and never leaves it; the failure names the
|
||||
// two purposes and ids that collided.
|
||||
String fingerprint = java.util.HexFormat.of().formatHex(key.material());
|
||||
SecretKeyMaterial previous = seen.put(fingerprint, key);
|
||||
if (previous != null) {
|
||||
throw StartupFailures.envValidation(
|
||||
"notification secrets "
|
||||
+ previous.keyId()
|
||||
+ " ("
|
||||
+ previous.purpose()
|
||||
+ ") and "
|
||||
+ key.keyId()
|
||||
+ " ("
|
||||
+ key.purpose()
|
||||
+ ") are the same key");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** The shortest key any purpose here accepts: 256 bits. */
|
||||
private static final int MINIMUM_KEY_BYTES = 32;
|
||||
}
|
||||
-205
@@ -1,205 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.notification;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.dispatch.LeaseRecoveryService;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.dispatch.NotificationBackgroundWorkers;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.dispatch.NotificationDispatchProperties;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.dispatch.NotificationSchedulerWorker;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.dispatch.ProviderEventReplayWorker;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.dispatch.ReconciliationJobWorker;
|
||||
import dev.caskeleton.application.notification.platform.dispatch.NotificationDispatchService;
|
||||
import dev.caskeleton.application.notification.platform.dispatch.RecipientLeaseStorePort;
|
||||
import dev.caskeleton.application.notification.platform.observation.NotificationMetricsPort;
|
||||
import java.util.UUID;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Background workers and their lifecycle.
|
||||
*
|
||||
* <p>Everything that runs on a schedule rather than on a request. They are grouped so that a
|
||||
* deployment reading its own configuration can see, in one place, what this process starts.
|
||||
*
|
||||
* <p>Split out of one 690-line composition class holding 42 beans. A configuration that assembles
|
||||
* codecs, security, templates, policy, providers and workers at once has no boundary a reader can
|
||||
* use: every change to any of them is a change to the same file, and nothing states which beans
|
||||
* belong together (NTF-022).
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnProperty(
|
||||
prefix = "ca-skeleton.notification.platform",
|
||||
name = "enabled",
|
||||
havingValue = "true")
|
||||
public class NotificationPlatformWorkerConfig {
|
||||
|
||||
/*
|
||||
* Queue worker. Started by the application lifecycle, stopped on shutdown.
|
||||
*
|
||||
* <p>The owner carries a per-process nonce, not just a configured name. Every instance used to
|
||||
* call itself {@code notification-worker-1}, so a restarted process and the one it replaced were
|
||||
* the same owner as far as the database was concerned — and a stale process's release could clear
|
||||
* the lease its successor was working under. The nonce makes each incarnation distinguishable;
|
||||
* the lease fence handles the rest.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Asks providers what happened to attempts whose outcome is unknown.
|
||||
*
|
||||
* @param jobs the outstanding questions
|
||||
* @param reconciliation the reconciliation service
|
||||
* @param clock the clock
|
||||
* @param properties the dispatch bounds
|
||||
* @return the worker
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public ReconciliationJobWorker reconciliationJobWorker(
|
||||
dev.caskeleton.application.notification.platform.dispatch.ReconciliationJobStorePort jobs,
|
||||
dev.caskeleton.application.notification.platform.dispatch.ReconciliationService
|
||||
reconciliation,
|
||||
java.time.Clock clock,
|
||||
NotificationDispatchProperties properties) {
|
||||
return new ReconciliationJobWorker(
|
||||
jobs,
|
||||
reconciliation::reconcile,
|
||||
clock,
|
||||
properties.leaseDuration(),
|
||||
properties.claimBatchSize(),
|
||||
properties.maxAdditionalAttempts() + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recovers deliveries a dead worker left in flight.
|
||||
*
|
||||
* <p>The class existed with no bean, no schedule and no caller. The dispatch scheduler's error
|
||||
* path already assumed it: it leaves a lease to expire rather than releasing it optimistically,
|
||||
* on the grounds that recovery will decide what happened. With nothing recovering, that
|
||||
* deliberate choice became a permanent leak.
|
||||
*
|
||||
* @param leases the lease store
|
||||
* @param attempts the attempt store
|
||||
* @param deliveries the delivery store
|
||||
* @param reconciliation reconciles an attempt whose outcome is unknown
|
||||
* @param clock the clock
|
||||
* @param properties the dispatch bounds
|
||||
* @return the recovery service
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public LeaseRecoveryService notificationLeaseRecoveryService(
|
||||
RecipientLeaseStorePort leases,
|
||||
dev.caskeleton.application.notification.platform.dispatch.DeliveryAttemptStorePort attempts,
|
||||
dev.caskeleton.application.notification.platform.dispatch.RecipientDeliveryStorePort
|
||||
deliveries,
|
||||
dev.caskeleton.application.notification.platform.dispatch.ReconciliationService
|
||||
reconciliation,
|
||||
java.time.Clock clock,
|
||||
NotificationDispatchProperties properties) {
|
||||
return new LeaseRecoveryService(
|
||||
leases,
|
||||
attempts,
|
||||
deliveries,
|
||||
reconciliation::reconcile,
|
||||
clock,
|
||||
properties.leaseDuration(),
|
||||
properties.claimBatchSize());
|
||||
}
|
||||
|
||||
/**
|
||||
* Projects provider events that were stored and never applied.
|
||||
*
|
||||
* @param ledger the stored events
|
||||
* @param projection the projection service
|
||||
* @param properties the dispatch bounds
|
||||
* @return the replay worker
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public ProviderEventReplayWorker notificationProviderEventReplayWorker(
|
||||
dev.caskeleton.application.notification.platform.callback.ProviderEventLedger ledger,
|
||||
dev.caskeleton.application.notification.platform.callback.ProviderEventProjectionService
|
||||
projection,
|
||||
NotificationDispatchProperties properties) {
|
||||
return new ProviderEventReplayWorker(ledger, projection, properties.claimBatchSize());
|
||||
}
|
||||
|
||||
/**
|
||||
* Everything that starts a thread, and therefore everything {@code INGEST_ONLY} must not have.
|
||||
*
|
||||
* <p>A nested configuration rather than a condition on each bean. Both beans below used to sit on
|
||||
* the parent, which carried the master switch alone, and both call {@code start()} in the factory
|
||||
* method — so a deployment in {@code INGEST_ONLY}, the mode whose whole purpose is to accept and
|
||||
* store without delivering, started the dispatch scheduler, the lease recovery pass, the
|
||||
* provider-event replay worker and the reconciliation job. It accepted requests and then tried to
|
||||
* deliver them, which is the mode not existing.
|
||||
*
|
||||
* <p>Structural because a per-bean condition is one a future bean can forget, and the cost of
|
||||
* forgetting here is not a stray bean — it is a process delivering notifications that an operator
|
||||
* put into a drain. A configuration that is not loaded cannot be forgotten.
|
||||
*
|
||||
* <p>{@code matchIfMissing = true} because {@code SERVING} is the shipped default: an absent mode
|
||||
* must still deliver, or a missing property becomes a silent drain.
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@ConditionalOnProperty(
|
||||
prefix = "ca-skeleton.notification.platform",
|
||||
name = "mode",
|
||||
havingValue = "SERVING",
|
||||
matchIfMissing = true)
|
||||
public static class ServingWorkerConfig {
|
||||
|
||||
/**
|
||||
* Schedules the recovery and replay passes, and stops them on shutdown.
|
||||
*
|
||||
* @param recovery the recovery service
|
||||
* @param replay the replay worker
|
||||
* @param reconciliation the reconciliation worker
|
||||
* @param properties the dispatch bounds
|
||||
* @return the started background workers
|
||||
*/
|
||||
@Bean(destroyMethod = "close")
|
||||
@ConditionalOnMissingBean
|
||||
public NotificationBackgroundWorkers notificationBackgroundWorkers(
|
||||
LeaseRecoveryService recovery,
|
||||
ProviderEventReplayWorker replay,
|
||||
ReconciliationJobWorker reconciliation,
|
||||
NotificationDispatchProperties properties) {
|
||||
NotificationBackgroundWorkers workers =
|
||||
new NotificationBackgroundWorkers(
|
||||
recovery,
|
||||
replay,
|
||||
reconciliation,
|
||||
properties.leaseDuration(),
|
||||
properties.shutdownGrace());
|
||||
workers.start();
|
||||
return workers;
|
||||
}
|
||||
|
||||
/**
|
||||
* The dispatch scheduler.
|
||||
*
|
||||
* @param leases the recipient lease store
|
||||
* @param dispatcher the dispatch service
|
||||
* @param metrics the metrics port
|
||||
* @param properties the dispatch bounds
|
||||
* @param servingState the serving-state port
|
||||
* @return the started scheduler worker
|
||||
*/
|
||||
@Bean(destroyMethod = "close")
|
||||
public NotificationSchedulerWorker notificationSchedulerWorker(
|
||||
RecipientLeaseStorePort leases,
|
||||
NotificationDispatchService dispatcher,
|
||||
NotificationMetricsPort metrics,
|
||||
NotificationDispatchProperties properties,
|
||||
dev.caskeleton.application.notification.platform.observation.NotificationServingStatePort
|
||||
servingState) {
|
||||
String owner = "notification-worker-1:" + UUID.randomUUID();
|
||||
NotificationSchedulerWorker worker =
|
||||
new NotificationSchedulerWorker(
|
||||
leases, dispatcher, metrics, properties, servingState, owner);
|
||||
worker.start();
|
||||
return worker;
|
||||
}
|
||||
}
|
||||
}
|
||||
-55
@@ -1,55 +0,0 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.notification;
|
||||
|
||||
import dev.caskeleton.adapter.outbound.notification.NotificationConfig;
|
||||
import dev.caskeleton.adapter.outbound.notification.NotificationRoutesSettings;
|
||||
import dev.caskeleton.adapter.outbound.notification.email.google.GoogleEmailNotificationAdapterConfig;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.autoconfigure.NotificationPlatformAutoConfiguration;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.autoconfigure.NotificationPlatformSettings;
|
||||
import dev.caskeleton.adapter.outbound.notification.slack.webhook.SlackNotificationAdapterConfig;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* The one place that decides whether this application sends notifications.
|
||||
*
|
||||
* <p>Two things were reached through the composition root's broad scan rather than through any
|
||||
* import: the platform's secrets configuration and its registries. So a deployment with the
|
||||
* notification master off still bound notification settings and still asked for a keyring — and the
|
||||
* off invariant is not "the workers are quiet", it is "the capability owns nothing". Narrowing the
|
||||
* scan removed them; naming them here is what keeps them working when the switch is on.
|
||||
*
|
||||
* <p>The legacy route configurations are imported too. They are on their way out under NTF-INT-004,
|
||||
* and until the delivery platform is the only runtime they still have to assemble when the
|
||||
* capability is enabled — a migration is not a reason to leave a working path unreachable.
|
||||
*
|
||||
* <p>{@link NotificationPlatformAutoConfiguration} is named here for a blunter reason: nothing
|
||||
* named it before. Its name says auto-configuration, but it is a plain {@code @Configuration}, so
|
||||
* it cannot register itself, and the notification leaf ships no {@code AutoConfiguration.imports}.
|
||||
* The only thing in the repository that loaded it was a test doing {@code
|
||||
* AutoConfigurations.of(...)}, which is how six beans — the variables codec, the template engine
|
||||
* and its validator, the contact point protector, the HTTP gateway — passed their tests while
|
||||
* existing in no running application. The local-notification-ingest lane found it the first time
|
||||
* the JPA persistence facade was assembled for real: {@code NotificationRecordMapper} asked for the
|
||||
* variables codec and startup failed.
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@ConditionalOnProperty(
|
||||
prefix = "ca-skeleton.notification.platform",
|
||||
name = "enabled",
|
||||
havingValue = "true")
|
||||
@EnableConfigurationProperties({
|
||||
NotificationPlatformSettings.class,
|
||||
NotificationRoutesSettings.class
|
||||
})
|
||||
@Import({
|
||||
NotificationPlatformAutoConfiguration.class,
|
||||
NotificationPlatformRuntimeConfig.class,
|
||||
NotificationPlatformSecretsConfig.class,
|
||||
NotificationPlatformRegistriesConfig.class,
|
||||
NotificationConfig.class,
|
||||
SlackNotificationAdapterConfig.class,
|
||||
GoogleEmailNotificationAdapterConfig.class
|
||||
})
|
||||
public class NotificationRootAutoConfiguration {}
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
package dev.caskeleton.bootstrap.autoconfigure.notification;
|
||||
|
||||
import dev.caskeleton.adapter.inbound.web.notification.platform.callback.ProviderCallbackHttpRequest;
|
||||
import dev.caskeleton.adapter.inbound.web.notification.platform.callback.ProviderCallbackIngress;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.callback.CallbackLimits;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.callback.CallbackVerificationResult;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.callback.ProviderCallbackAdapter;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.callback.ProviderCallbackAdapterRegistry;
|
||||
import dev.caskeleton.adapter.outbound.notification.platform.callback.ProviderCallbackVerificationRequest;
|
||||
import dev.caskeleton.application.notification.platform.api.CallbackIngestionResult;
|
||||
import dev.caskeleton.application.notification.platform.api.error.CallbackValidationException;
|
||||
import dev.caskeleton.application.notification.platform.api.error.FailureCategory;
|
||||
import dev.caskeleton.application.notification.platform.api.error.NotificationFailureCode;
|
||||
import dev.caskeleton.application.notification.platform.api.error.NotificationFailureDescriptor;
|
||||
import dev.caskeleton.application.notification.platform.observation.NotificationSecurityAuditPort;
|
||||
import dev.caskeleton.application.notification.platform.port.in.IngestProviderCallbackCommand;
|
||||
import dev.caskeleton.application.notification.platform.port.in.IngestProviderCallbackUseCase;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Composition-only bridge from raw inbound HTTP to provider verification and semantic ingestion.
|
||||
*
|
||||
* <p>This class is intentionally in the composition root. The inbound web adapter must not depend
|
||||
* on the outbound notification adapter, and the outbound adapter must not depend on the web
|
||||
* transport. Bootstrap is the one place allowed to know both and connect them.
|
||||
*/
|
||||
final class ProviderCallbackIngressBridge implements ProviderCallbackIngress {
|
||||
|
||||
private final ProviderCallbackAdapterRegistry adapters;
|
||||
private final IngestProviderCallbackUseCase ingestion;
|
||||
private final NotificationSecurityAuditPort securityAudit;
|
||||
|
||||
ProviderCallbackIngressBridge(
|
||||
ProviderCallbackAdapterRegistry adapters,
|
||||
IngestProviderCallbackUseCase ingestion,
|
||||
NotificationSecurityAuditPort securityAudit) {
|
||||
this.adapters = Objects.requireNonNull(adapters, "adapters");
|
||||
this.ingestion = Objects.requireNonNull(ingestion, "ingestion");
|
||||
this.securityAudit = Objects.requireNonNull(securityAudit, "securityAudit");
|
||||
}
|
||||
|
||||
@Override
|
||||
public CallbackIngestionResult ingest(ProviderCallbackHttpRequest request) {
|
||||
Objects.requireNonNull(request, "request");
|
||||
|
||||
CallbackLimits limits = adapters.limitsFor(request.providerProfileId());
|
||||
if (request.bodyLength() > limits.maxBodyBytes()) {
|
||||
securityAudit.callbackRejectedByLimit(request.providerProfileId(), "BODY_TOO_LARGE");
|
||||
throw rejected(NotificationFailureCode.CALLBACK_PAYLOAD_REJECTED);
|
||||
}
|
||||
if (!limits.acceptsContentType(request.contentType().orElse(null))) {
|
||||
securityAudit.callbackRejectedByLimit(request.providerProfileId(), "CONTENT_TYPE_REJECTED");
|
||||
throw rejected(NotificationFailureCode.CALLBACK_PAYLOAD_REJECTED);
|
||||
}
|
||||
|
||||
ProviderCallbackAdapter adapter = adapters.require(request.providerProfileId());
|
||||
if (!adapter.providerId().equals(request.providerId())) {
|
||||
securityAudit.callbackRejectedByLimit(
|
||||
request.providerProfileId(), "PROVIDER_PROFILE_MISMATCH");
|
||||
throw rejected(NotificationFailureCode.CALLBACK_PAYLOAD_REJECTED);
|
||||
}
|
||||
|
||||
ProviderCallbackVerificationRequest verificationRequest =
|
||||
new ProviderCallbackVerificationRequest(
|
||||
request.providerId(),
|
||||
request.providerProfileId(),
|
||||
request.externalUrl(),
|
||||
request.httpMethod(),
|
||||
request.contentType(),
|
||||
request.headers(),
|
||||
request.body(),
|
||||
request.receivedAt());
|
||||
|
||||
CallbackVerificationResult verification = adapter.verify(verificationRequest);
|
||||
if (!verification.valid()) {
|
||||
securityAudit.callbackSignatureRejected(
|
||||
request.providerProfileId(), verification.reasonCode());
|
||||
throw rejected(NotificationFailureCode.CALLBACK_SIGNATURE_INVALID);
|
||||
}
|
||||
|
||||
var verified = verification.verifiedCallback().orElseThrow();
|
||||
return ingestion.handle(
|
||||
new IngestProviderCallbackCommand(
|
||||
request.providerId(),
|
||||
request.providerProfileId(),
|
||||
adapter.normalize(verified),
|
||||
request.body()));
|
||||
}
|
||||
|
||||
private static CallbackValidationException rejected(String code) {
|
||||
return new CallbackValidationException(
|
||||
NotificationFailureDescriptor.preDispatch(
|
||||
code, FailureCategory.CALLBACK_VALIDATION_FAILURE));
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user