fix!: 재리뷰가 찾은 결함과 색인에서 빠졌던 발견 5건을 고친다

문제: 성숙도 리뷰 수정을 다시 읽은 재리뷰(Critical 0, 회귀 0)가
Important 27건·Minor 41건을 찾았다. 수정이 새로 만든 결함이 많았다.
@SystemInvoked가 권한 규칙의 탈출구가 됐고, 데모 계정 거부가 정확히
prod일 때만 걸렸고, outbox 순서 번호가 업그레이드 때 뒤로 갔고,
GraphQL union 아래 복잡도가 0이었고, 서블릿 오류 응답이 success:true로
나갔고, 호출자 deadline이 breaker를 열었다. 원래 리뷰 색인이 06 영역
발견 5건(06-10~14)을 빠뜨려 그동안 처리되지 않았다.

방법: 영역별 7묶음이 test-driven-development 절차로 실패 테스트를
먼저 쓰고 고쳤다. 결정은 재리뷰 README 4절에 적었다: 순서 번호는 V21이
기록한 전역 floor부터, 데모 계정은 local·test·demo 허용 목록,
@SystemInvoked bean은 기동 실패, complete 단계 실패는
IDEMPOTENCY_COMPLETION_UNKNOWN(결과 불명), 캐시 조건부 쓰기는 별도
SCRIPT lane, strict lane 정책은 build cache 입력, 끝나지 않는 재시도
행은 원인 코드·지표·PARKED 절차. 레지스트리가 선언만 하고 아무 코드도
내보내지 않던 redis.capability.* 지표 6개는 빼고 runbook을 실제
지표(redis.lane.*) 기준으로 고쳤다.

위험·한계: V21을 V22 없이 직접 고쳤다(어느 배포에도 아직 없음). 이
브랜치의 V21을 적용한 개발 DB는 다시 만들어야 한다. 서블릿 오류
디스패치를 보안 체인이 허용한다. 발행·저장소 포트 시그니처가 바뀌어
파생 서비스 코드가 깨진다. prod에서 fixture-로 시작하는 설정값은
기동을 막는다. httpclient failure-injection lane의 main 단계 중복
실행은 이전 결정대로 남겼다. 실제 CI runner 실행은 확인하지 못했다.

검증: ci, mainCheck, :integrationCheck, -p optional-platforms ci
integrationCheck performanceCheck, :performanceCheck, :releaseCheck
(-PgitRevision), verify-compose-profile-contracts(18 lane) 통과.
첫 실행의 실패 2건(FindSecBugs 1, sample 동시 생성 테스트의 v4 event
id)은 고친 뒤 ci·integrationCheck·mainCheck를 다시 돌려 통과했다.

Refs: docs/reviews/2026-11-03-rereview/README.md 3·4·6·7절
BREAKING CHANGE: outbox 발행 포트와 저장소 포트 시그니처, 순서 번호
첫 값(V21 floor 다음), 샘플 데모 계정 프로필 허용 목록, 새 오류 코드
IDEMPOTENCY_COMPLETION_UNKNOWN, prod의 fixture- 값 거부, 기동 rule은
static·의존 없음이어야 한다.
This commit is contained in:
DongHyeonka
2026-11-03 23:29:35 +09:00
parent 7ef8d0b4cb
commit bbe944bd3c
406 changed files with 13493 additions and 1656 deletions
+7 -2
View File
@@ -48,8 +48,13 @@
비밀번호가 문서에 적혀 있는 공개 데모 계정입니다. 비밀이 아니며, 실제 서비스는 이 방식을 쓰지 않고
`adapter:inbound:web`의 JWT 체인으로 인증합니다.
그래서 `prod` 프로필로 띄우면 기동을 거부합니다(`SampleDemoAccountsProductionGuard`, 종료 코드 71).
샘플을 복제해 운영에 올릴 때 이 계정이 남아 있으면 누구나 관리자로 들어올 수 있기 때문입니다. 운영으로
그래서 데모 프로필(`local`·`test`·`demo`)이 명시적으로 켜져 있고 그 밖의 프로필이 하나도 없을 때만
기동합니다. 프로필 없음, `prod`, `production`, `staging` 등은 기동을 거부합니다
(`SampleDemoAccountsProductionGuard`, 종료 코드 71). 샘플을 복제해 운영에 올릴 때 이 계정이 남아 있으면
누구나 관리자로 들어올 수 있기 때문입니다. 거부 목록(`prod`)이 아니라 허용 목록인 이유는 프로필 이름이
하나만 달라도 계정이 열리지 않게 하려는 것입니다. `./gradlew :sample-portfolio:bootRun`은
`SPRING_PROFILES_ACTIVE`가 비어 있으면 `local`을 넘기고, jar·이미지로 띄울 때는
`SPRING_PROFILES_ACTIVE=local`(또는 `test`·`demo`)을 직접 줍니다. 운영으로
가져가려면 `SampleDemoSecurityConfig`·`SampleDemoAccounts`를 지우고 `SamplePortfolioApplication`에서
`WebSecurityAutoConfiguration` 제외를 풉니다. 이 규칙은 데모 설정 옆에 선언되어 있어 함께 지워집니다.
+7 -2
View File
@@ -196,7 +196,6 @@ strictTestLanes {
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.
}
}
@@ -228,7 +227,8 @@ strictTestLanes {
lane('messagingSampleContractQualificationTest') {
sourceSet = 'test'
description = 'Runs exact Messaging sample contract qualification tests.'
requires('dev.caskeleton.sample.portfolio.application.worklog.WorkLogReservedContractContributionTest')
requires('dev.caskeleton.sample.portfolio.application.worklog.WorkLogReservedContractContributionTest',
'dev.caskeleton.sample.portfolio.application.event.SamplePayloadSchemaReleaseTest')
rejectSkipped = true
}
}
@@ -245,6 +245,11 @@ tasks.register('stageDockerJar', Sync) {
}
// Run from the repo's src/ root so src/.env is picked up (same as app-bootstrap).
// bootRun is the local developer command, so it says `local` explicitly unless SPRING_PROFILES_ACTIVE
// names a profile: the demo accounts refuse to start without a demo profile, and application.yml no
// longer defaults one (RR-07-02). The jar and the image get no such default.
bootRun {
workingDir = rootProject.projectDir
systemProperty 'spring.profiles.active',
providers.environmentVariable('SPRING_PROFILES_ACTIVE').filter { !it.isBlank() }.orElse('local').get()
}
@@ -0,0 +1,71 @@
package dev.caskeleton.sample.portfolio.adapter.outbound.persistence.repository;
import dev.caskeleton.sample.portfolio.adapter.outbound.persistence.config.JpaConfig;
import dev.caskeleton.sample.portfolio.domain.poster.PosterRepository;
import dev.caskeleton.sample.portfolio.domain.poster.testkit.PosterRepositoryContract;
import dev.caskeleton.sample.portfolio.testinfra.PostgreSqlTestContainer;
import java.util.function.Supplier;
import org.junit.jupiter.api.BeforeEach;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.data.jpa.test.autoconfigure.DataJpaTest;
import org.springframework.boot.jdbc.test.autoconfigure.AutoConfigureTestDatabase;
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.TestPropertySource;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.postgresql.PostgreSQLContainer;
/**
* The shipped {@link PosterRepositoryAdapter} against real PostgreSQL, held to the same {@link
* PosterRepositoryContract} as the in-memory fake. The test-managed transaction is switched off so
* every contract call commits on its own: the title rule is the unique index's, and it answers at
* the statement the adapter flushes.
*/
@DataJpaTest
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
@Testcontainers(disabledWithoutDocker = true)
@Transactional(propagation = Propagation.NOT_SUPPORTED)
@Import({
JpaConfig.class,
PosterRepositoryAdapter.class,
PosterRepositoryAdapterIntegrationTest.TestAuditConfig.class
})
@TestPropertySource(
properties = {
"spring.flyway.enabled=true",
"spring.flyway.locations=classpath:db/migration/postgresql,classpath:db/sample-migration",
"spring.jpa.hibernate.ddl-auto=validate"
})
class PosterRepositoryAdapterContractTest extends PosterRepositoryContract {
@Container @ServiceConnection
static final PostgreSQLContainer POSTGRES = PostgreSqlTestContainer.create();
@Autowired private PosterRepositoryAdapter adapter;
@Autowired private PosterJpaRepository jpa;
@Autowired private PlatformTransactionManager transactionManager;
@BeforeEach
void empty() {
inTransaction(
() -> {
jpa.deleteAll();
return null;
});
}
@Override
protected PosterRepository repository() {
return adapter;
}
@Override
protected <T> T inTransaction(Supplier<T> work) {
return new TransactionTemplate(transactionManager).execute(status -> work.get());
}
}
@@ -5,13 +5,13 @@ import static org.assertj.core.api.Assertions.catchThrowable;
import dev.caskeleton.adapter.outbound.persistence.audit.AuditContextPort;
import dev.caskeleton.sample.portfolio.adapter.outbound.persistence.config.JpaConfig;
import dev.caskeleton.sample.portfolio.application.poster.PosterTitleAlreadyExistsException;
import dev.caskeleton.sample.portfolio.domain.poster.Poster;
import dev.caskeleton.sample.portfolio.domain.poster.PosterId;
import dev.caskeleton.sample.portfolio.domain.poster.PosterImageReference;
import dev.caskeleton.sample.portfolio.domain.poster.PosterPage;
import dev.caskeleton.sample.portfolio.domain.poster.PosterSortField;
import dev.caskeleton.sample.portfolio.domain.poster.PosterStatus;
import dev.caskeleton.sample.portfolio.domain.poster.PosterTitleAlreadyExistsException;
import dev.caskeleton.sample.portfolio.domain.poster.PublishedPosterImageAttachment;
import dev.caskeleton.sample.portfolio.testinfra.PostgreSqlTestContainer;
import java.time.Clock;
@@ -7,10 +7,12 @@ import dev.caskeleton.adapter.outbound.persistence.transaction.SpringTransaction
import dev.caskeleton.application.messaging.event.testkit.FakeIntegrationEventEncoder;
import dev.caskeleton.application.outbox.testkit.InMemoryOutboxAggregateSequences;
import dev.caskeleton.application.outbox.testkit.InMemoryOutboxStore;
import dev.caskeleton.sample.portfolio.adapter.outbound.identifier.UuidOutboxEventIdFactory;
import dev.caskeleton.sample.portfolio.adapter.outbound.identifier.UuidPosterIdFactory;
import dev.caskeleton.sample.portfolio.adapter.outbound.persistence.config.JpaConfig;
import dev.caskeleton.sample.portfolio.adapter.outbound.persistence.repository.PosterRepositoryAdapter;
import dev.caskeleton.sample.portfolio.application.event.PortfolioEventOutbox;
import dev.caskeleton.sample.portfolio.domain.poster.PosterTitleAlreadyExistsException;
import dev.caskeleton.sample.portfolio.testinfra.PostgreSqlTestContainer;
import java.time.Clock;
import java.util.ArrayList;
@@ -150,7 +152,7 @@ class CreatePosterConcurrencyIntegrationTest {
return encoder.encode(draft);
}
},
() -> UUID.randomUUID().toString(),
new UuidOutboxEventIdFactory(),
Optional::empty,
Clock.systemUTC(),
new InMemoryOutboxAggregateSequences());
@@ -2,12 +2,12 @@ package dev.caskeleton.sample.portfolio.adapter.inbound.web.error;
import dev.caskeleton.adapter.inbound.web.error.ErrorResponseFactory;
import dev.caskeleton.sample.portfolio.application.poster.PosterNotFoundException;
import dev.caskeleton.sample.portfolio.application.poster.PosterTitleAlreadyExistsException;
import dev.caskeleton.sample.portfolio.application.posterimage.PosterImageAlreadyPublishedException;
import dev.caskeleton.sample.portfolio.application.worklog.WorkLogNotFoundException;
import dev.caskeleton.sample.portfolio.application.worklog.WorkLogNotOwnedException;
import dev.caskeleton.sample.portfolio.application.worklog.WorkLogVersionMismatchException;
import dev.caskeleton.sample.portfolio.domain.poster.PosterInvariantException;
import dev.caskeleton.sample.portfolio.domain.poster.PosterTitleAlreadyExistsException;
import dev.caskeleton.sample.portfolio.domain.worklog.WorkLogInvariantException;
import dev.caskeleton.shared.error.OperationalError;
import dev.caskeleton.shared.response.Envelope;
@@ -3,13 +3,13 @@ package dev.caskeleton.sample.portfolio.adapter.outbound.persistence.repository;
import dev.caskeleton.adapter.outbound.persistence.audit.AuditContextPort;
import dev.caskeleton.sample.portfolio.adapter.outbound.persistence.entity.PosterEntity;
import dev.caskeleton.sample.portfolio.adapter.outbound.persistence.mapper.PosterPersistenceMapper;
import dev.caskeleton.sample.portfolio.application.poster.PosterTitleAlreadyExistsException;
import dev.caskeleton.sample.portfolio.domain.poster.Poster;
import dev.caskeleton.sample.portfolio.domain.poster.PosterId;
import dev.caskeleton.sample.portfolio.domain.poster.PosterPage;
import dev.caskeleton.sample.portfolio.domain.poster.PosterRepository;
import dev.caskeleton.sample.portfolio.domain.poster.PosterSortField;
import dev.caskeleton.sample.portfolio.domain.poster.PosterStatus;
import dev.caskeleton.sample.portfolio.domain.poster.PosterTitleAlreadyExistsException;
import java.time.Clock;
import java.time.Instant;
import java.util.List;
@@ -66,8 +66,8 @@ public class PosterRepositoryAdapter implements PosterRepository {
* The unique index {@value #TITLE_UNIQUE_INDEX} (sample migration V8.1) is what keeps poster
* titles unique; the use case's {@code existsByTitle} check only gives the common case an early
* answer and loses races. Flushing here makes a violation surface inside this call, where it is
* turned into the same {@link PosterTitleAlreadyExistsException} the check throws, instead of at
* commit as a generic unique-violation failure.
* turned into the domain's {@link PosterTitleAlreadyExistsException} that the port declares,
* instead of at commit as a generic unique-violation failure.
*/
private PosterEntity saveHoldingTheTitleRule(PosterEntity entity, String title) {
try {
@@ -11,6 +11,7 @@ import dev.caskeleton.sample.portfolio.domain.poster.Poster;
import dev.caskeleton.sample.portfolio.domain.poster.PosterCreated;
import dev.caskeleton.sample.portfolio.domain.poster.PosterIdFactory;
import dev.caskeleton.sample.portfolio.domain.poster.PosterRepository;
import dev.caskeleton.sample.portfolio.domain.poster.PosterTitleAlreadyExistsException;
/**
* Creates a new {@link Poster} (server-assigned id via {@link PosterIdFactory}) and appends a
@@ -1,11 +0,0 @@
package dev.caskeleton.sample.portfolio.application.poster;
/** Raised when creating a poster whose title is already taken. Web handler maps it to 409. */
public class PosterTitleAlreadyExistsException extends RuntimeException {
private static final long serialVersionUID = 1L;
public PosterTitleAlreadyExistsException(String title) {
super("Poster title already in use: " + title);
}
}
@@ -9,6 +9,7 @@ import dev.caskeleton.application.transaction.TransactionPort;
import dev.caskeleton.application.usecase.CommandUseCase;
import dev.caskeleton.sample.portfolio.domain.poster.Poster;
import dev.caskeleton.sample.portfolio.domain.poster.PosterRepository;
import dev.caskeleton.sample.portfolio.domain.poster.PosterTitleAlreadyExistsException;
/**
* Partial update of a poster's title/caption using {@code Patch} 3-state semantics. Mirrors {@code
@@ -1,17 +1,18 @@
package dev.caskeleton.sample.portfolio.application.worklog;
import dev.caskeleton.application.messaging.contract.IntegrationPayload;
import dev.caskeleton.application.messaging.event.IntegrationIdentity;
/** Immutable sample payload for the {@code portfolio.worklog.reserved} v1 contract. */
/**
* Immutable sample payload for the {@code portfolio.worklog.reserved} v1 contract.
*
* <p>The work log id is the event's aggregate id, so it takes the aggregate id grammar and bound
* from {@link IntegrationIdentity} rather than a copy of them (review 2026-11-03 RR-01-08).
*/
public record WorkLogReservedPayload(String workLogId) implements IntegrationPayload {
private static final int MAXIMUM_WORK_LOG_ID_LENGTH = 160;
private static final String WORK_LOG_ID_GRAMMAR = "[A-Za-z0-9][A-Za-z0-9._:-]*";
public WorkLogReservedPayload {
if (workLogId == null
|| workLogId.length() > MAXIMUM_WORK_LOG_ID_LENGTH
|| !workLogId.matches(WORK_LOG_ID_GRAMMAR)) {
if (!IntegrationIdentity.isCanonical(workLogId, IntegrationIdentity.AGGREGATE_ID_MAX_LENGTH)) {
throw new IllegalArgumentException(
"workLogId must be a 1-160 character canonical US-ASCII identifier");
}
@@ -21,7 +21,12 @@ import org.springframework.security.web.SecurityFilterChain;
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
public class SampleManagementSecurityConfig {
/** Actuator security chain ordered at {@code 0} to run BEFORE the main app chain. */
/**
* The actuator chain. Its order ({@code 0}) does not put it in front of the demo chain, which is
* {@code @Order(-100)} and matches {@code /**}: requests to the management port reach the demo
* chain first, which permits every read. The bean exists for its name, which replaces the
* template's restricted chain from {@code composition:service-runtime}.
*/
@Bean
@Order(0)
public SecurityFilterChain actuatorSecurityFilterChain(HttpSecurity http) throws Exception {
@@ -1,28 +1,34 @@
package dev.caskeleton.sample.portfolio.bootstrap.security;
import dev.caskeleton.adapter.outbound.support.runtime.RuntimeProfileSnapshot;
import dev.caskeleton.adapter.outbound.support.startup.StartupPhase;
import dev.caskeleton.adapter.outbound.support.startup.StartupRule;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import org.springframework.core.env.Environment;
/**
* Refuses the {@code prod} profile while the {@link SampleDemoAccounts} authenticate requests.
* Lets the {@link SampleDemoAccounts} authenticate requests only under a profile that names a demo:
* {@code local}, {@code test} or {@code demo}, switched on explicitly and alone.
*
* <p>The demo accounts are published on purpose: each password is the account name and the sample
* README prints both, so a reader can watch {@code @RequiresPermission} allow one caller and refuse
* another. That is harmless in a demo and an open admin account anywhere else. The sample is also
* the code adopters copy first, so the copy that matters is the one that reaches a production
* deployment with this configuration still in it. The README says not to; this rule makes the
* deployment say so too, before any datasource, migration or listener is created.
* the code adopters copy first, so the copy that matters is the one that reaches a deployment with
* this configuration still in it. The README says not to; this rule makes the deployment say so
* too, before any datasource, migration or listener is created.
*
* <p>"Production" is the template's own answer ({@link RuntimeProfileSnapshot#isProduction()}), not
* a profile name compared here, so the sample and every module agree on what it means. The rule is
* declared beside the accounts in {@link SampleDemoSecurityConfig}: replacing the demo chain with a
* real one removes the refusal with it.
* <p>An allow list, not a deny list (review 2026-11-03 RR-07-02, owner decision). Refusing exactly
* {@code prod} left the accounts open under no profile, {@code production}, {@code staging} or any
* other name a deployment happened to use: one differently spelled profile opened an admin account.
* Here a deployment is refused unless every active profile is a demo profile, so no profile at all
* — the sample's image sets none — is refused too.
*/
final class SampleDemoAccountsProductionGuard implements StartupRule {
/** The profiles that say "this is a demo", and nothing else may be active beside them. */
static final Set<String> DEMO_PROFILES = Set.of("local", "test", "demo");
@Override
public StartupPhase phase() {
return StartupPhase.PROFILE_CHECK;
@@ -30,23 +36,31 @@ final class SampleDemoAccountsProductionGuard implements StartupRule {
@Override
public String summary() {
return "the sample's demo accounts must not authenticate under the prod profile";
return "the sample's demo accounts authenticate only under the local, test or demo profile";
}
@Override
public String remedy() {
return "run the sample under local or dev; a production service authenticates through the JWT"
+ " chain — delete SampleDemoSecurityConfig and SampleDemoAccounts and stop excluding"
+ " WebSecurityAutoConfiguration in SamplePortfolioApplication";
return "run the sample with SPRING_PROFILES_ACTIVE=local (or test or demo); a real service"
+ " authenticates through the JWT chain — delete SampleDemoSecurityConfig and"
+ " SampleDemoAccounts and stop excluding WebSecurityAutoConfiguration in"
+ " SamplePortfolioApplication";
}
@Override
public List<String> violations(Environment environment) {
if (!RuntimeProfileSnapshot.from(environment).isProduction()) {
List<String> active = Arrays.asList(environment.getActiveProfiles());
String risk =
"demo-user and demo-admin sign in over HTTP Basic, each password is the account name, and"
+ " the sample README prints both — anyone could act as an admin";
if (active.isEmpty()) {
return List.of("no profile is active, which a deployment cannot be told apart from: " + risk);
}
List<String> outside =
active.stream().filter(profile -> !DEMO_PROFILES.contains(profile)).toList();
if (outside.isEmpty()) {
return List.of();
}
return List.of(
"demo-user and demo-admin sign in over HTTP Basic, each password is the account name, and"
+ " the sample README prints both — anyone could act as an admin");
return List.of("active profile(s) " + outside + " are not a demo profile: " + risk);
}
}
@@ -3,6 +3,7 @@ package dev.caskeleton.sample.portfolio.bootstrap.security;
import dev.caskeleton.adapter.inbound.web.auth.EnvelopeAuthenticationEntryPoint;
import dev.caskeleton.adapter.inbound.web.auth.SecurityErrorClassifier;
import dev.caskeleton.adapter.outbound.support.startup.StartupRule;
import jakarta.servlet.DispatcherType;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -25,7 +26,8 @@ import tools.jackson.databind.ObjectMapper;
* {@code @RequiresPermission} is checked against {@code app.authz} exactly as it is for a JWT
* caller. This chain only answers who the caller is.
*
* <p>The accounts are public, so they refuse the prod profile at startup ({@link
* <p>The accounts are public, so the sample refuses to start unless a demo profile ({@code local},
* {@code test} or {@code demo}) is explicitly active and no other is ({@link
* SampleDemoAccountsProductionGuard}).
*/
@Configuration
@@ -48,10 +50,10 @@ public class SampleDemoSecurityConfig {
}
/**
* Refuses to start under the prod profile while these accounts are the way in.
* Refuses to start outside a demo profile while these accounts are the way in.
*
* <p>Static and argument-free, as every startup rule is: the support module's runner creates it
* before any other singleton, so a production start is refused before a datasource opens or a
* before any other singleton, so a non-demo start is refused before a datasource opens or a
* migration runs. Declared here, beside the accounts, so the refusal leaves with them.
*
* @return the rule
@@ -74,7 +76,13 @@ public class SampleDemoSecurityConfig {
.exceptionHandling(ex -> ex.authenticationEntryPoint(unauthenticated))
.authorizeHttpRequests(
auth ->
auth.requestMatchers(HttpMethod.GET)
// The container's error dispatch for a request that already failed, as the web
// leaf's chain allows it: authorising it again would answer a rejected anonymous
// write with a 401 that blames authentication. Only the dispatch type is opened; a
// request that names /error itself is still a request (re-review RR-02-02).
auth.dispatcherTypeMatchers(DispatcherType.ERROR)
.permitAll()
.requestMatchers(HttpMethod.GET)
.permitAll()
.requestMatchers(HttpMethod.HEAD)
.permitAll()
@@ -2,13 +2,23 @@ package dev.caskeleton.sample.portfolio.domain.poster;
import java.util.Optional;
/** Outbound port for Poster persistence. Implemented in adapter-persistence. */
/**
* Outbound port for Poster persistence. Implemented in adapter-persistence; {@code
* PosterRepositoryContract} (test fixtures) holds the adapter and the in-memory fake to the same
* promises.
*/
public interface PosterRepository {
/**
* Stores the poster. Titles are unique ignoring case, and the store enforces it: a save that
* would duplicate a stored title fails with the application's {@code
* PosterTitleAlreadyExistsException}, even when {@link #existsByTitle} said the title was free.
* Stores the poster. Titles are unique ignoring case, and the store enforces it, even when {@link
* #existsByTitle} said the title was free.
*
* <p>A business-rule conflict is a domain exception the port declares and the adapter raises, so
* every implementation answers it the same way. A technical conflict — a stale {@code @Version},
* as in {@code WorkLogRepository} — stays the framework's exception, which the transaction port
* classifies as {@code DB_OPTIMISTIC_CONFLICT}.
*
* @throws PosterTitleAlreadyExistsException when another poster already has this title
*/
Poster save(Poster poster);
@@ -0,0 +1,20 @@
package dev.caskeleton.sample.portfolio.domain.poster;
/**
* A poster title is already taken, ignoring case — the rule {@link PosterRepository#save} enforces
* and the create use case asks about first. The web adapter answers it 409 {@code
* POSTER_ALREADY_EXISTS}.
*
* <p>A domain type, beside the port that raises it, because the port's contract has to name it in
* code (review 2026-11-03 RR-06-12): it used to be an application exception that the domain port
* could only mention in Javadoc. One type for both paths — the use case's early answer and the
* store's unique index — so the two cannot drift into different answers.
*/
public class PosterTitleAlreadyExistsException extends RuntimeException {
private static final long serialVersionUID = 1L;
public PosterTitleAlreadyExistsException(String title) {
super("Poster title already in use: " + title);
}
}
@@ -8,6 +8,13 @@ import java.util.Optional;
* this port. See README.
*/
public interface WorkLogRepository {
/**
* Stores the work log. Saving one read at an older version than the stored row is a technical
* conflict, not a business rule: the adapter raises the framework's optimistic-locking failure —
* the same one Hibernate raises when the version check fails at flush — and the transaction port
* classifies both as {@code DB_OPTIMISTIC_CONFLICT}. A business-rule conflict is a domain
* exception the port declares instead ({@code PosterRepository#save}).
*/
WorkLog save(WorkLog workLog);
Optional<WorkLog> findById(WorkLogId id);
@@ -26,8 +26,10 @@ spring:
error:
include-stacktrace: ${APP_SERVER_ERROR_INCLUDE_STACKTRACE:never}
include-message: ${APP_SERVER_ERROR_INCLUDE_MESSAGE:never}
profiles:
active: ${SPRING_PROFILES_ACTIVE:local}
# No spring.profiles.active default. The demo accounts open only under an explicitly active
# local, test or demo profile (SampleDemoAccountsProductionGuard), and a default here would turn
# "no profile" — what the image and a copied deployment start with — into `local` (RR-07-02).
# SPRING_PROFILES_ACTIVE still sets it; `./gradlew :sample-portfolio:bootRun` passes `local`.
datasource:
url: ${APP_DATASOURCE_URL:jdbc:postgresql://localhost:5432/ca_skeleton}
username: ${APP_DATASOURCE_USERNAME:ca_skeleton}
@@ -153,8 +155,10 @@ logging:
org.hibernate.SQL: ${APP_LOG_LEVEL_SQL:WARN}
# ---------------------------------------------------------------------------
# Application-owned settings (app.*).
# These are bound by @ConfigurationProperties in the respective modules.
# Application-owned settings (app.*), each read by a module on this sample's classpath.
# SampleRuntimeDefaultsContractTest (app-bootstrap repository-contract lane) fails on a group nothing
# here reads: the messaging, notification and HTTP-client blocks that used to sit below configured
# modules the sample does not have (review 2026-11-03 RR-06-06).
# ---------------------------------------------------------------------------
app:
capabilities:
@@ -197,7 +201,7 @@ app:
published-retention: P7D
# -------------------------------------------------------------------------
# Optional integration adapter toggles (all disabled for lean demo).
# The poster image workflow, off for the lean demo.
# -------------------------------------------------------------------------
poster-image:
api:
@@ -207,32 +211,6 @@ app:
enabled: false
publication:
enabled: false
messaging:
broker: ${APP_MESSAGING_BROKER:}
notification:
slack-webhook:
enabled: ${APP_NOTIFICATION_SLACK_WEBHOOK_ENABLED:false}
google-email:
enabled: ${APP_NOTIFICATION_GOOGLE_EMAIL_ENABLED:false}
outbound:
http:
connect-timeout: ${APP_OUTBOUND_HTTP_CONNECT_TIMEOUT:2s}
read-timeout: ${APP_OUTBOUND_HTTP_READ_TIMEOUT:5s}
global-call-timeout: ${APP_OUTBOUND_HTTP_GLOBAL_CALL_TIMEOUT:10s}
maximum-in-flight-calls: ${APP_OUTBOUND_HTTP_MAXIMUM_IN_FLIGHT_CALLS:128}
retry-enabled: ${APP_OUTBOUND_HTTP_RETRY_ENABLED:false}
retry:
max-attempts: ${APP_OUTBOUND_HTTP_RETRY_MAX_ATTEMPTS:3}
initial-backoff: ${APP_OUTBOUND_HTTP_RETRY_INITIAL_BACKOFF:100ms}
backoff-multiplier: ${APP_OUTBOUND_HTTP_RETRY_BACKOFF_MULTIPLIER:2.0}
circuit-breaker-enabled: ${APP_OUTBOUND_HTTP_CIRCUIT_BREAKER_ENABLED:false}
circuit-breaker:
failure-rate-threshold: ${APP_OUTBOUND_HTTP_CIRCUIT_BREAKER_FAILURE_RATE_THRESHOLD:50}
sliding-window-size: ${APP_OUTBOUND_HTTP_CIRCUIT_BREAKER_SLIDING_WINDOW_SIZE:100}
minimum-number-of-calls: ${APP_OUTBOUND_HTTP_CIRCUIT_BREAKER_MINIMUM_NUMBER_OF_CALLS:100}
wait-duration-in-open-state: ${APP_OUTBOUND_HTTP_CIRCUIT_BREAKER_WAIT_DURATION_IN_OPEN_STATE:60s}
permitted-calls-in-half-open: ${APP_OUTBOUND_HTTP_CIRCUIT_BREAKER_PERMITTED_CALLS_IN_HALF_OPEN:10}
response-size-limit: ${APP_OUTBOUND_HTTP_RESPONSE_SIZE_LIMIT:10MB}
---
spring:
@@ -21,6 +21,7 @@ import java.time.LocalDate;
import java.util.Base64;
import java.util.List;
import java.util.UUID;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@@ -144,6 +145,43 @@ class SampleWorkLogAuthorizationSystemTest {
assertThat(List.of(response.statusCode(), title(id))).containsExactly(403, "stored");
}
/**
* A write the firewall rejects (a {@code ;} in the path) never reaches authentication, so the
* container's error dispatch to {@code /error} carries no caller. The demo chain lets that
* dispatch through, as the web leaf's chain does; otherwise the rejection reached the client as a
* 401 that blamed authentication for a malformed request (re-review RR-02-02).
*/
@Test
@DisplayName("방화벽이 거절한 익명 쓰기 요청은 오류 디스패치에서 401로 바뀌지 않고 원래 400으로 나간다")
void aRejectedAnonymousWriteKeepsItsOwnStatusThroughTheErrorDispatch() throws Exception {
// given
HttpRequest.Builder rejected =
HttpRequest.newBuilder(uri("/api/worklogs;x=1"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(CREATE_BODY));
// when
HttpResponse<String> response = send(rejected, null);
// then
assertThat(response.statusCode()).as(response.body()).isEqualTo(400);
}
@Test
@DisplayName("오류 디스패치만 열린다 — /error에 직접 보낸 익명 쓰기는 여전히 401이다")
void anAnonymousWriteNamingTheErrorPathStillNeedsADemoAccount() throws Exception {
// when
HttpResponse<String> response =
send(
HttpRequest.newBuilder(uri("/error"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(CREATE_BODY)),
null);
// then
assertThat(response.statusCode()).isEqualTo(401);
}
private WorkLogId storedWorkLog() {
return storedWorkLog("sample-owner");
}
@@ -21,7 +21,6 @@ import dev.caskeleton.sample.portfolio.application.poster.GetPosterQuery;
import dev.caskeleton.sample.portfolio.application.poster.GetPosterUseCase;
import dev.caskeleton.sample.portfolio.application.poster.ListPostersUseCase;
import dev.caskeleton.sample.portfolio.application.poster.PosterNotFoundException;
import dev.caskeleton.sample.portfolio.application.poster.PosterTitleAlreadyExistsException;
import dev.caskeleton.sample.portfolio.application.poster.PublishPosterUseCase;
import dev.caskeleton.sample.portfolio.application.poster.UpdatePosterUseCase;
import dev.caskeleton.sample.portfolio.domain.poster.Poster;
@@ -29,6 +28,7 @@ import dev.caskeleton.sample.portfolio.domain.poster.PosterId;
import dev.caskeleton.sample.portfolio.domain.poster.PosterInvariantException;
import dev.caskeleton.sample.portfolio.domain.poster.PosterPage;
import dev.caskeleton.sample.portfolio.domain.poster.PosterStatus;
import dev.caskeleton.sample.portfolio.domain.poster.PosterTitleAlreadyExistsException;
import java.util.List;
import java.util.Locale;
import org.junit.jupiter.api.Nested;
@@ -3,11 +3,11 @@ package dev.caskeleton.sample.portfolio.adapter.inbound.web.error;
import static org.assertj.core.api.Assertions.assertThat;
import dev.caskeleton.sample.portfolio.application.poster.PosterNotFoundException;
import dev.caskeleton.sample.portfolio.application.poster.PosterTitleAlreadyExistsException;
import dev.caskeleton.sample.portfolio.application.posterimage.PosterImageAlreadyPublishedException;
import dev.caskeleton.sample.portfolio.application.worklog.WorkLogNotFoundException;
import dev.caskeleton.sample.portfolio.domain.poster.PosterId;
import dev.caskeleton.sample.portfolio.domain.poster.PosterInvariantException;
import dev.caskeleton.sample.portfolio.domain.poster.PosterTitleAlreadyExistsException;
import dev.caskeleton.sample.portfolio.domain.worklog.WorkLogId;
import dev.caskeleton.sample.portfolio.domain.worklog.WorkLogInvariantException;
import dev.caskeleton.shared.error.Category;
@@ -0,0 +1,18 @@
package dev.caskeleton.sample.portfolio.application.event;
import dev.caskeleton.application.messaging.contract.testkit.ReleasedPayloadSchemaContract;
import java.nio.file.Path;
/** The payload schemas the sample publishes (poster and work-log events). */
class SamplePayloadSchemaReleaseTest extends ReleasedPayloadSchemaContract {
@Override
protected Path schemaRoot() {
return Path.of("src/main/resources/contracts/messaging");
}
@Override
protected Path manifest() {
return Path.of("src/test/resources/contracts/released-payload-schemas.sha256");
}
}
@@ -56,7 +56,7 @@ class WorkLogUseCasesTest {
new PortfolioEventOutbox(
NO_OP_OUTBOX,
new FakeIntegrationEventEncoder(new WorkLogReservedContractContribution()),
() -> "01FAKEEVENTIDTSV4RRFFQ6900",
() -> "0190c9a2-1b3c-7def-8abc-1234567890ac",
NO_CORRELATION,
Clock.systemUTC(),
new InMemoryOutboxAggregateSequences()),
@@ -53,8 +53,9 @@ class SampleDemoAccountsProductionGuardTest {
}
@ParameterizedTest
@ValueSource(strings = {"local", "dev", "test"})
void theDemoAccountsAreAllowedOutsideProduction(String profile) {
@ValueSource(strings = {"local", "test", "demo"})
@DisplayName("local·test·demo 프로필이 명시적으로 켜졌을 때만 데모 계정을 허용한다")
void theDemoAccountsAreAllowedOnlyUnderAnExplicitDemoProfile(String profile) {
// given
MockEnvironment environment = new MockEnvironment();
environment.setActiveProfiles(profile);
@@ -66,13 +67,29 @@ class SampleDemoAccountsProductionGuardTest {
assertThat(violations).isEmpty();
}
@ParameterizedTest
@ValueSource(strings = {"production", "staging", "prd", "dev", "local,prod", "test,staging"})
@DisplayName("허용 목록 밖의 프로필이 하나라도 켜져 있으면 데모 계정을 거부한다")
void theDemoAccountsAreRefusedUnderAnyProfileOutsideTheAllowList(String profiles) {
// given
MockEnvironment environment = new MockEnvironment();
environment.setActiveProfiles(profiles.split(","));
// when
List<String> violations = new SampleDemoAccountsProductionGuard().violations(environment);
// then
assertThat(violations).singleElement().asString().contains("demo-admin");
}
@Test
void theDemoAccountsAreAllowedWithNoProfileAtAll() {
@DisplayName("프로필이 하나도 없으면 운영 배포와 구별할 수 없으므로 데모 계정을 거부한다")
void theDemoAccountsAreRefusedWithNoProfileAtAll() {
// when
List<String> violations =
new SampleDemoAccountsProductionGuard().violations(new MockEnvironment());
// then
assertThat(violations).isEmpty();
assertThat(violations).singleElement().asString().contains("no profile");
}
}
@@ -43,6 +43,7 @@ import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.http.MediaType;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultActions;
@@ -53,9 +54,14 @@ import org.springframework.test.web.servlet.ResultActions;
properties = {
"app.persistence-jpa.enabled=false",
// The PostgreSQL idempotency store needs the relational module this test leaves off.
"app.capabilities.idempotency.provider=disabled"
"app.capabilities.idempotency.provider=disabled",
// Object storage is on while present and has no destination here; the `local` profile used to
// switch it off by default, and this test runs under `test` (RR-07-02).
"app.object-storage.enabled=false"
})
@AutoConfigureMockMvc
// The demo accounts start only under a demo profile (SampleDemoAccountsProductionGuard).
@ActiveProfiles("test")
class SampleDemoSecurityConfigTest {
private static final String ID = "0190bd6e-7c3e-7abc-8def-0123456789ab";
@@ -0,0 +1,19 @@
package dev.caskeleton.sample.portfolio.domain.poster.testkit;
import dev.caskeleton.sample.portfolio.domain.poster.PosterRepository;
import java.util.function.Supplier;
class InMemoryPosterRepositoryContractTest extends PosterRepositoryContract {
private final InMemoryPosterRepository repository = new InMemoryPosterRepository();
@Override
protected PosterRepository repository() {
return repository;
}
@Override
protected <T> T inTransaction(Supplier<T> work) {
return work.get();
}
}
@@ -0,0 +1,10 @@
# SHA-256 (LF-normalized) of every released payload schema version in src/main/resources/contracts/messaging.
# A released version is never edited: a change goes into a new version (application-core README).
# Add a line when a version is released; change a line only for a version no one can have consumed.
7264efd4e2531e6fd00010bb3deca96af2f1d0408d0021d014feaf90190f2eac portfolio.worklog.reserved/v1.schema.json
c71019a727f351aa26afbf6c9246b6cf1a7abcfd2b6bb3ee1185dfce6be504d8 poster.archived/v1.schema.json
8be3a72b7b469d894d06bd30f79f565feb23fbf698674d5caee094de5a2300fb poster.created/v1.schema.json
c5310821c338be5aa916d126008a0a0f4be6c6999775018ce29cbefc44c8a942 poster.deleted/v1.schema.json
179160ec458b710535c7846a47a1abceab1a743a3a5f11633c47c2115e82e2c4 poster.image-attachment-prepared/v1.schema.json
1a256fa47c382a4900ed8f852da9256a01ef1ddb2dc5b0b75047f827ae81644e poster.image-attachment-ready/v2.schema.json
d89954e3074fc015a20d616bf0ec1cb46c088fa417d78e006163f1c2dc61170c poster.published/v1.schema.json
@@ -0,0 +1,114 @@
package dev.caskeleton.sample.portfolio.domain.poster.testkit;
import dev.caskeleton.sample.portfolio.domain.poster.Poster;
import dev.caskeleton.sample.portfolio.domain.poster.PosterId;
import dev.caskeleton.sample.portfolio.domain.poster.PosterPage;
import dev.caskeleton.sample.portfolio.domain.poster.PosterRepository;
import dev.caskeleton.sample.portfolio.domain.poster.PosterSortField;
import dev.caskeleton.sample.portfolio.domain.poster.PosterStatus;
import dev.caskeleton.sample.portfolio.domain.poster.PosterTitleAlreadyExistsException;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
/**
* In-memory {@link PosterRepository} with the semantics of {@code PosterRepositoryAdapter}, held to
* them by {@link PosterRepositoryContract}: snapshots (a caller's later mutation is not saved), a
* new poster at version 0 and an update incrementing it, and the title rule — a save that would
* duplicate another poster's title, ignoring case, raises {@link PosterTitleAlreadyExistsException}
* as the unique index does.
*
* <p>It does not model optimistic-lock conflicts on a stale version.
*/
public final class InMemoryPosterRepository implements PosterRepository {
private final Map<PosterId, Poster> rows = new LinkedHashMap<>();
@Override
public Poster save(Poster poster) {
long version;
if (poster.version() == null) {
version = 0L;
} else {
Poster existing = rows.get(poster.id());
if (existing == null) {
throw new IllegalStateException(
"no persisted poster row to carry audit creation from: " + poster.id());
}
version = existing.version() + 1;
}
String key = titleKey(poster.title());
boolean taken =
rows.values().stream()
.anyMatch(
other -> !other.id().equals(poster.id()) && titleKey(other.title()).equals(key));
if (taken) {
throw new PosterTitleAlreadyExistsException(poster.title());
}
Poster stored = copy(poster, version);
rows.put(stored.id(), stored);
return copy(stored, version);
}
@Override
public Optional<Poster> findById(PosterId id) {
return Optional.ofNullable(rows.get(id)).map(p -> copy(p, p.version()));
}
@Override
public PosterPage findPage(
int page, int size, PosterSortField sortField, boolean ascending, PosterStatus status) {
int safeSize = size <= 0 ? 20 : size;
int safePage = Math.max(0, page);
List<Poster> matching =
rows.values().stream().filter(p -> status == null || p.status() == status).toList();
if (sortField != null) {
Comparator<Poster> order =
sortField == PosterSortField.TITLE
? Comparator.comparing(Poster::title)
: Comparator.comparing(Poster::status);
matching = matching.stream().sorted(ascending ? order : order.reversed()).toList();
}
List<Poster> items =
matching.stream()
.skip((long) safePage * safeSize)
.limit(safeSize)
.map(p -> copy(p, p.version()))
.toList();
return new PosterPage(items, matching.size());
}
@Override
public boolean existsById(PosterId id) {
return rows.containsKey(id);
}
@Override
public boolean existsByTitle(String title) {
String key = titleKey(title);
return rows.values().stream().anyMatch(p -> titleKey(p.title()).equals(key));
}
@Override
public void deleteById(PosterId id) {
rows.remove(id);
}
/** The unique index's key: {@code lower(title)} (sample migration V8.1). */
private static String titleKey(String title) {
return title.toLowerCase(Locale.ROOT);
}
private static Poster copy(Poster poster, long version) {
return Poster.rehydrate(
poster.id(),
poster.title(),
poster.caption(),
poster.imageReference(),
poster.status(),
version);
}
}
@@ -0,0 +1,119 @@
package dev.caskeleton.sample.portfolio.domain.poster.testkit;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;
import dev.caskeleton.sample.portfolio.domain.poster.Poster;
import dev.caskeleton.sample.portfolio.domain.poster.PosterId;
import dev.caskeleton.sample.portfolio.domain.poster.PosterRepository;
import dev.caskeleton.sample.portfolio.domain.poster.PosterTitleAlreadyExistsException;
import java.util.Optional;
import java.util.function.Supplier;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
/**
* What every {@link PosterRepository} promises, run against {@link InMemoryPosterRepository} and
* the PostgreSQL {@code PosterRepositoryAdapter} alike (review 2026-11-03 RR-06-12).
*
* <p>The promise that matters is the title rule: titles are unique ignoring case, and {@link
* PosterRepository#save} enforces it by raising the domain's {@link
* PosterTitleAlreadyExistsException}. It used to be a sentence in the port's Javadoc that pointed
* at an application type, so only the PostgreSQL adapter kept it and a unit test's mock could not.
*
* <p>Every call goes through {@link #inTransaction}, so each one commits before the next reads it.
*/
public abstract class PosterRepositoryContract {
private static final PosterId FIRST = PosterId.of("0190bd6e-7c3e-7abc-8def-0123456789ab");
private static final PosterId SECOND = PosterId.of("0190bd6e-7c3e-7abc-8def-0123456789ac");
/** The repository under test, empty at the start of each test. */
protected abstract PosterRepository repository();
/** Runs {@code work} in one committed transaction of the repository under test. */
protected abstract <T> T inTransaction(Supplier<T> work);
@Test
@DisplayName("저장한 포스터는 id로 다시 읽으면 같은 제목과 버전 0으로 나온다")
void aSavedPosterIsReadBackByIdAtVersionZero() {
// given
save(Poster.create(FIRST, "여름 세일 배너", "7월 한정"));
// when
Optional<Poster> found = inTransaction(() -> repository().findById(FIRST));
// then
assertThat(found)
.get()
.extracting(Poster::title, Poster::version)
.containsExactly("여름 세일 배너", 0L);
}
@Test
@DisplayName("대소문자만 다른 같은 제목의 두 번째 포스터 저장은 domain 제목 충돌 예외로 거절된다")
void aSecondPosterWithTheSameTitleInAnotherCaseIsRejected() {
// given
save(Poster.create(FIRST, "Summer Sale Banner", null));
// when
Throwable failure =
catchThrowable(() -> save(Poster.create(SECOND, "SUMMER SALE banner", null)));
// then
assertThat(failure)
.isInstanceOf(PosterTitleAlreadyExistsException.class)
.hasMessage("Poster title already in use: SUMMER SALE banner");
}
@Test
@DisplayName("다른 포스터의 제목으로 바꾸는 저장도 같은 제목 충돌 예외로 거절된다")
void renamingAPosterToAnotherPostersTitleIsRejected() {
// given
save(Poster.create(FIRST, "Summer Sale Banner", null));
save(Poster.create(SECOND, "Autumn Banner", null));
Poster second = inTransaction(() -> repository().findById(SECOND)).orElseThrow();
second.rename("summer sale banner");
// when
Throwable failure = catchThrowable(() -> save(second));
// then
assertThat(failure).isInstanceOf(PosterTitleAlreadyExistsException.class);
}
@Test
@DisplayName("자기 제목을 대소문자만 바꿔 저장하는 것은 허용된다")
void renamingAPosterToItsOwnTitleInAnotherCaseIsAccepted() {
// given
save(Poster.create(FIRST, "Summer Sale Banner", null));
Poster loaded = inTransaction(() -> repository().findById(FIRST)).orElseThrow();
loaded.rename("SUMMER SALE BANNER");
// when
save(loaded);
// then
assertThat(inTransaction(() -> repository().findById(FIRST)))
.get()
.extracting(Poster::title)
.isEqualTo("SUMMER SALE BANNER");
}
@Test
@DisplayName("existsByTitle은 대소문자를 무시하고 저장된 제목을 찾는다")
void existsByTitleIgnoresCase() {
// given
save(Poster.create(FIRST, "Summer Sale Banner", null));
// when
boolean exists = inTransaction(() -> repository().existsByTitle("SUMMER sale BANNER"));
// then
assertThat(exists).isTrue();
}
private Poster save(Poster poster) {
return inTransaction(() -> repository().save(poster));
}
}
@@ -40,6 +40,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.context.annotation.Import;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
/**
@@ -58,6 +59,9 @@ import org.springframework.test.context.bean.override.mockito.MockitoBean;
* ./gradlew openapiCheckSnapshot -PapproveOpenApiChange} (sets {@code
* -Dopenapi.snapshot.write=true}).
*/
// The sample's local composition (object storage off), which application.yml used to select by
// default before the demo-profile allow list removed the default (RR-07-02).
@ActiveProfiles("local")
@SpringBootTest(
classes = OpenApiDriftContractTest.OpenApiDriftTestApp.class,
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
@@ -21,6 +21,7 @@ import org.springframework.boot.security.oauth2.server.resource.autoconfigure.se
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -30,6 +31,9 @@ import org.springframework.web.bind.annotation.RestController;
* container and checks the header across a success (200) and an error (404) response — the
* status-matrix that a mock MVC test cannot exercise (MockMvc never goes through Tomcat).
*/
// The sample's local composition (object storage off), which application.yml used to select by
// default before the demo-profile allow list removed the default (RR-07-02).
@ActiveProfiles("local")
@SpringBootTest(
classes = DateHeaderContractTest.DateProbeApp.class,
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
@@ -35,6 +35,7 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -56,6 +57,9 @@ import org.springframework.web.bind.annotation.RestController;
* <p>Auto-configuration is narrowed to skip security so the demo endpoint is reachable without a
* JWT — security is owned by a sibling branch and is not the contract under test here.
*/
// The sample's local composition (object storage off), which application.yml used to select by
// default before the demo-profile allow list removed the default (RR-07-02).
@ActiveProfiles("local")
@SpringBootTest(
classes = VirtualThreadMdcE2ETest.TestBootstrap.class,
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
@@ -30,6 +30,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.context.annotation.Import;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import tools.jackson.databind.ObjectMapper;
@@ -40,6 +41,9 @@ import tools.jackson.databind.ObjectMapper;
* schema cannot pass). The release-blocking <em>drift gate</em> against a committed snapshot is
* owned by feature-contract-verification-test-suite (planned).
*/
// The sample's local composition (object storage off), which application.yml used to select by
// default before the demo-profile allow list removed the default (RR-07-02).
@ActiveProfiles("local")
@SpringBootTest(
classes = OpenApiSnapshotTest.OpenApiTestApp.class,
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,