Files
clean-architecture-backend-…/src/sample-portfolio/build.gradle
T
donghyeon-kaandClaude Opus 5.5 423a29c46f review-followup Wave 3 라운드 2(P18): outbox canonical 통일, composition 모듈, legacy Kafka seam 삭제
- 결정 7: `LegacyOutboxAppendPort`·legacy 저장 모델·relay·Kafka R0 seam 삭제, 템플릿 JSON encoder(`JsonIntegrationEventEncoder`),
  durable operation·sample 이벤트가 `OutboxAppendPort` + encoder로, persistence-jpa V19(pre-canonical 미발행 row 거부)
- 결정 3: outbox relay·멱등성 executor 조립을 `composition:outbox-relay`·`composition:idempotency`로,
  sample이 복사한 bootstrap 인프라를 `composition:service-runtime`으로(sample `SampleIdempotencyConfig` 복사본 삭제)
- persistence-jpa outbox·멱등성 패키지 feature 기준 이동, messaging outbox·inbox leaf를 reliability / reliability-jdbc-postgresql로
- messaging outbox header를 jsonb로(P18-new-1 — `\`로 끝나는 값이 다음 header를 삼키던 결함)
- 통합(충돌 22건): P25 A-10c(전략 선택 설정 삭제)를 service-runtime `DomainContextConfig`에 적용, P25 startup 예외 통합을
  composition 설정 테스트에, P25 `CommandUseCase.handle` 이름을 PG 통합 테스트에, P15 `EventJson`은 호출자 0이 되어 삭제
- root CLAUDE.md의 legacy seam 문장 수정(P18-new-2)

검증: ./gradlew check architectureCheck verifyDependencyLocks verifyPublicPathSnapshot :app-bootstrap:verifyEnvKeys
configContractCheck :app-bootstrap:integrationTest :sample-portfolio:integrationTest :sample-portfolio:systemTest
persistence-jpa jpaPlatformContractTest·postgresql{Idempotency,OutboxAppendTransactional,OutboxConcurrentRelay,OutboxRowLifecycle}IntegrationTest
:messaging:messaging-reliability-jdbc-postgresql:integrationTest --continue 통과(700 task)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 12:30:01 +09:00

231 lines
12 KiB
Groovy

plugins {
id 'ca.spring-library'
id 'ca.spring-config'
id 'org.springframework.boot'
id 'ca.auxiliary-source-set'
id 'java-test-fixtures'
}
// Fixture/sample module. Production modules must not depend on this module.
// Lean standalone boot: apply the Spring Boot plugin so bootJar / bootRun are available.
def repositoryRootForContractTests = rootProject.projectDir.parentFile
def errorCodeRegistryForContractTests = new File(
repositoryRootForContractTests,
'docs/registries/error-codes.yaml')
tasks.withType(Test).configureEach {
systemProperty 'ca.repository.root', repositoryRootForContractTests.absolutePath
}
tasks.named('test') {
inputs.file(errorCodeRegistryForContractTests)
.withPathSensitivity(PathSensitivity.RELATIVE)
}
auxiliarySourceSets {
sourceSet('integrationTest') {
compilesAgainst 'main', 'testFixtures'
}
sourceSet('systemTest') {
compilesAgainst 'main', 'testFixtures'
}
sourceSet('webSystemTest') {
compilesAgainst 'main', 'testFixtures'
}
}
// The objectstorage adapter (runtimeOnly) pulls in software.amazon.awssdk:s3, whose version is
// managed by the AWS SDK v2 BOM (NOT the Spring Boot BOM). Import that BOM at this consumer's scope
// — mirroring the objectstorage module — so the transitive s3 dependency resolves on this module's
// runtime/test classpath. The AWS-SDK version SSOT stays ext.awsSdkVersion.
dependencyManagement {
imports {
mavenBom "software.amazon.awssdk:bom:${libs.versions.awsSdk.get()}"
}
}
dependencies {
implementation project(':domain-core')
implementation project(':application-core')
implementation project(':application-objectstorage')
// Relational persistence, selected like any capability: the module's auto-configuration
// assembles it. `implementation` rather than `runtimeOnly` because the sample's own adapters
// extend the module's audit base types.
implementation project(':adapter:outbound:persistence-jpa')
implementation project(':adapter:outbound:identifier')
// Object storage adapter provides the canonical staged-publication ports (declared in
// application-objectstorage) the poster image publication use cases run on.
runtimeOnly project(':adapter:outbound:objectstorage')
// The request-idempotency executor, built by the same module app-bootstrap uses rather than a
// sample copy. It composes over the PostgreSQL store persistence-jpa contributes.
runtimeOnly project(':composition:idempotency')
// Tracing, the metrics contract filters, domain-context propagation and user-principal
// pseudonymization: the same module app-bootstrap uses, instead of the sample copies that had
// drifted from it. The sample's public actuator chain overrides the module's by bean name.
runtimeOnly project(':composition:service-runtime')
implementation project(':adapter:inbound:web')
implementation project(':shared-contract')
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-resource-server'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
// UUIDv7 generation (id factory) + UUID/String conversion (persistence mapper, web path).
implementation libs.uuid.creator
// PATCH 3-state (absent / explicit-null / value) via JsonNullable. See README.
implementation libs.jackson.databind.nullable
// Lean standalone boot: actuator + prometheus + tracing runtime + dotenv (mirrors app-bootstrap).
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'io.micrometer:micrometer-registry-prometheus'
implementation 'io.micrometer:micrometer-tracing-bridge-otel'
implementation 'io.opentelemetry:opentelemetry-exporter-otlp'
// Spring dotenv: picks up src/.env when bootRun workingDir = src/ (same as app-bootstrap).
implementation libs.spring.dotenv
// Boot 4 Flyway API/autoconfiguration needed by sample-local persistence configuration.
implementation 'org.springframework.boot:spring-boot-flyway'
// Flyway core API: SamplePostgreSqlPersistenceConfig runs the sample's second migration stream.
implementation 'org.flywaydb:flyway-core'
// Micrometer core for the sample's own meters.
implementation 'io.micrometer:micrometer-core'
// (spring-boot-starter-security is already declared above; it also backs ManagementSecurityConfig.)
// Property-based testing for @ValueObject invariants (registers its own JUnit Platform engine).
testImplementation libs.jqwik
testImplementation libs.archunit.junit5
// The Poster image workflow drives the real executor over the port owner's shared fake store.
testImplementation testFixtures(project(':application-core'))
// Port contracts (`*Contract`) are abstract JUnit classes that the fake and the adapter both extend.
testFixturesImplementation project(':domain-core')
testFixturesImplementation project(':application-objectstorage')
testFixturesImplementation 'org.junit.jupiter:junit-jupiter-api'
testFixturesImplementation 'org.junit.jupiter:junit-jupiter-params'
testFixturesImplementation 'org.assertj:assertj-core'
// Shared factory is compiled without leaking Testcontainers onto ordinary unit-test runtime.
testFixturesCompileOnly 'org.testcontainers:testcontainers-postgresql'
testFixturesCompileOnly 'org.springframework.boot:spring-boot'
testFixturesCompileOnly 'org.springframework.boot:spring-boot-autoconfigure'
// Real PostgreSQL adapter/migration semantics.
// SampleIdempotencyReplayIntegrationTest composes the executor module over the real store.
integrationTestImplementation project(':composition:idempotency')
integrationTestImplementation 'org.testcontainers:testcontainers-postgresql'
integrationTestImplementation 'org.testcontainers:testcontainers-junit-jupiter'
integrationTestImplementation 'org.springframework.boot:spring-boot-testcontainers'
integrationTestImplementation 'org.springframework.boot:spring-boot-data-jpa-test'
integrationTestImplementation 'org.springframework.boot:spring-boot-jpa-test'
integrationTestImplementation 'org.springframework.boot:spring-boot-jdbc-test'
integrationTestRuntimeOnly 'org.postgresql:postgresql'
// Whole standalone application composition with a real PostgreSQL instance.
systemTestImplementation 'org.testcontainers:testcontainers-postgresql'
systemTestImplementation 'org.testcontainers:testcontainers-junit-jupiter'
systemTestImplementation 'org.springframework.boot:spring-boot-testcontainers'
systemTestRuntimeOnly 'org.postgresql:postgresql'
// Real-DB integration test for the persistence adapter (disposable Postgres, real Flyway + JPA).
// @ServiceConnection supplies datasource connection details to Spring context/slice tests.
// Boot 4 split JPA/JDBC slice annotations and TestEntityManager into dedicated test modules.
// Spring Security test support (MockMvc + @WithMockUser) for any slice tests.
testImplementation 'org.springframework.security:spring-security-test'
// TestRestTemplate needs RestTemplateBuilder, and spring-boot-resttestclient stopped
// bringing it transitively in Spring Boot 4.0.x — the capability is still supported, its
// dependency is simply no longer implicit. A module that autowires TestRestTemplate says so.
testImplementation 'org.springframework.boot:spring-boot-restclient'
}
// feature-contract-verification-test-suite §5 — OpenAPI drift gate.
// OpenApiDriftContractTest runs as a normal test (so `check` is release-blocking on drift) AND
// can be invoked through this task to (re)generate the committed snapshot after an intentional
// API change: ./gradlew :sample-portfolio:openapiCheckSnapshot -PapproveOpenApiChange
//
// Declared through `ca.strict-test-lane` rather than hand-registered. The hand-written version set
// `includeTestsMatching` and never set `failOnNoDiscoveredTests`, so renaming or deleting
// OpenApiDriftContractTest left this gate running nothing and reporting success — on the one task
// whose whole job is to notice a change. `requires(...)` turns the class name into a selector the
// convention checks after the run, and the convention supplies the fail-closed discovery this task
// had no way to opt out of losing.
strictTestLanes {
lane('integrationTest') {
integration()
sourceSet = 'integrationTest'
description = 'Runs sample persistence and migration contracts against real PostgreSQL.'
}
lane('systemTest') {
system()
sourceSet = 'systemTest'
description = 'Runs the standalone sample application composition against real PostgreSQL.'
}
lane('webSystemTest') {
system()
sourceSet = 'webSystemTest'
description = 'Runs focused sample HTTP contracts against a real embedded server.'
requires(
'dev.caskeleton.sample.portfolio.adapter.inbound.web.date.DateHeaderContractTest',
'dev.caskeleton.sample.portfolio.adapter.inbound.web.filter.VirtualThreadMdcE2ETest',
'dev.caskeleton.sample.portfolio.adapter.inbound.web.openapi.OpenApiSnapshotTest')
}
lane('openapiCheckSnapshot') {
system()
sourceSet = 'webSystemTest'
description = 'OpenAPI drift gate: runtime springdoc /v3/api-docs vs the committed snapshot. ' +
'-PapproveOpenApiChange regenerates the committed baseline.'
requires('dev.caskeleton.sample.portfolio.adapter.inbound.web.contract.OpenApiDriftContractTest')
systemProperty 'openapi.snapshot.write',
project.hasProperty('approveOpenApiChange') ? 'true' : 'false'
// Pin UTC like the main test task for host-locale independence.
jvmArgs '-Duser.timezone=UTC'
}
}
tasks.named('check') {
dependsOn tasks.named('openapiCheckSnapshot')
// The root `verifyDependencyLocks` aggregate excludes this project, because the sample is
// outside production architecture and runtime-membership policy. A lockfile is a different
// question: this leaf's lock state changed by hundreds of lines and nothing verified it. The
// sample's own `check` is a PR gate job, so verifying it here keeps the exclusion from the
// production aggregate without leaving the lock state unchecked.
dependsOn tasks.named('verifyDependencyLocks')
}
// Named tests that must all run with none skipped: a qualification that quietly skips has certified
// nothing.
strictTestLanes {
lane('posterImageMigrationTest') {
// Real PostgreSQL, so an integration lane: the root integrationCheck runs it (NEW-13e).
integration()
sourceSet = 'integrationTest'
description = 'Runs the non-skipping PostgreSQL Poster image migration/rotation lane.'
requires(
'dev.caskeleton.sample.portfolio.qualification.PosterImageIdempotencyRotationQualificationTest',
'dev.caskeleton.sample.portfolio.qualification.PosterImageRetirementQualificationTest',
'dev.caskeleton.sample.portfolio.qualification.PosterImageV8MigrationQualificationTest')
rejectSkipped = true
jvmArgs '-Duser.timezone=UTC'
shouldRunAfter 'test'
}
lane('messagingSampleContractQualificationTest') {
sourceSet = 'test'
description = 'Runs exact Messaging sample contract qualification tests.'
requires('dev.caskeleton.sample.portfolio.application.event.WorkLogReservedContractContributionTest')
rejectSkipped = true
jvmArgs '-Duser.timezone=UTC'
}
}
bootJar {
mainClass = 'dev.caskeleton.sample.portfolio.SamplePortfolioApplication'
}
tasks.register('stageDockerJar', Sync) {
dependsOn tasks.named('bootJar')
from(tasks.named('bootJar').flatMap { it.archiveFile })
into(layout.buildDirectory.dir('docker'))
rename { 'application.jar' }
}
// Run from the repo's src/ root so src/.env is picked up (same as app-bootstrap).
bootRun {
workingDir = rootProject.projectDir
}