refactor: 리펙토링 진행중 의존성 gradle은 얇게 유지, 각 모듈에서 처리하고 있는 부분에 대해서 리펙토링
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
plugins {
|
||||
id 'ca.java-library'
|
||||
id 'ca.auxiliary-source-set'
|
||||
}
|
||||
|
||||
// Skeleton-wide operational contracts only. No business/domain concepts.
|
||||
@@ -8,23 +7,6 @@ plugins {
|
||||
dependencies {
|
||||
}
|
||||
|
||||
auxiliarySourceSets {
|
||||
sourceSet('edgeRateLimitContractTest') {
|
||||
compilesAgainst 'main'
|
||||
inherits 'implementation', 'compileOnly', 'runtimeOnly'
|
||||
}
|
||||
}
|
||||
|
||||
strictTestLanes {
|
||||
lane('edgeRateLimitContractTest') {
|
||||
// Its own source set is the selection; nothing else in this leaf can join the lane.
|
||||
sourceSet = 'edgeRateLimitContractTest'
|
||||
description = 'Runs the provider-neutral edge rate-limit shared contract.'
|
||||
group = 'redis verification'
|
||||
jvmArgs '-Duser.timezone=UTC'
|
||||
}
|
||||
}
|
||||
|
||||
def messagingSharedSchemaQualification = extensions.getByName('strictQualification').register(
|
||||
'messagingSharedSchemaQualificationTest',
|
||||
sourceSets.test,
|
||||
|
||||
+15
-2
@@ -5,7 +5,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The five adapters this skeleton ships behind an explicit switch, and the names that address them.
|
||||
* The runtime capabilities this skeleton ships behind an explicit switch, and the names that
|
||||
* address them.
|
||||
*
|
||||
* <p>One place knows the names. Spread across conditions as string literals, a rename becomes a
|
||||
* silent activation change: the condition stops matching, the adapter stops assembling, and nothing
|
||||
@@ -27,7 +28,15 @@ public enum MasterSwitch {
|
||||
NOTIFICATION_PLATFORM(
|
||||
"ca-skeleton.notification.platform.enabled", "APP_NOTIFICATION_PLATFORM_ENABLED"),
|
||||
/** The GraphQL transport boundary. */
|
||||
GRAPHQL("backend.graphql.enabled", "APP_GRAPHQL_ENABLED");
|
||||
GRAPHQL("backend.graphql.enabled", "APP_GRAPHQL_ENABLED"),
|
||||
/** The shared Redis runtime substrate. */
|
||||
REDIS("app.redis.enabled", "APP_REDIS_ENABLED"),
|
||||
/** The explicit Fileserver R2 publication capability. */
|
||||
FILESERVER("app.fileserver.enabled", "APP_FILESERVER_ENABLED"),
|
||||
/** The HTTP upload/download Fileserver platform. */
|
||||
FILESERVER_PLATFORM("app.fileserver-platform.enabled", "APP_FILESERVER_PLATFORM_ENABLED"),
|
||||
/** The outbound HTTP client platform. */
|
||||
HTTPCLIENT("app.httpclient.enabled", "APP_HTTPCLIENT_ENABLED");
|
||||
|
||||
private static final Map<MasterSwitch, List<String>> SUPERSEDED = supersededProperties();
|
||||
|
||||
@@ -57,6 +66,10 @@ public enum MasterSwitch {
|
||||
// backend.graphql.deployment-mode.
|
||||
superseded.put(NOTIFICATION_PLATFORM, List.of());
|
||||
superseded.put(GRAPHQL, List.of());
|
||||
superseded.put(REDIS, List.of());
|
||||
superseded.put(FILESERVER, List.of());
|
||||
superseded.put(FILESERVER_PLATFORM, List.of());
|
||||
superseded.put(HTTPCLIENT, List.of());
|
||||
return Map.copyOf(superseded);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ public enum OperationalError implements ApiErrorCode {
|
||||
DB_UNAVAILABLE(Category.TRANSIENT_DEPENDENCY, 503, true), // 08*
|
||||
DB_SERIALIZATION_FAILURE(Category.CONFLICT, 409, true), // 40001
|
||||
DB_DEADLOCK(Category.CONFLICT, 409, true), // 40P01
|
||||
DB_LOCK_TIMEOUT(Category.CONFLICT, 409, false), // 55P03
|
||||
DB_NULL_VIOLATION(Category.DATA_INTEGRITY, 409, false), // 23502
|
||||
DB_FK_VIOLATION(Category.DATA_INTEGRITY, 409, false), // 23503
|
||||
DB_UNIQUE_VIOLATION(Category.CONFLICT, 409, false), // 23505
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public record RateLimitDecision(
|
||||
}
|
||||
|
||||
public enum DecisionSource {
|
||||
GLOBAL_REDIS
|
||||
GLOBAL_SHARED_STORE
|
||||
}
|
||||
|
||||
public enum DecisionCertainty {
|
||||
|
||||
+5
-3
@@ -29,9 +29,11 @@ import java.util.Optional;
|
||||
* <p>Three module families ask this question — the composition root, the Fileserver and HTTP client
|
||||
* platform configurations, and the object-storage adapter. {@code shared-contract} is the one leaf
|
||||
* all of them may depend on. It is also Java-stdlib-only, so this type cannot accept Spring's
|
||||
* {@code Environment}; callers pass {@code List.of(environment.getActiveProfiles())} instead. That
|
||||
* is not a workaround: it keeps the vocabulary testable without a container and usable from the
|
||||
* {@code EnvironmentPostProcessor} phase, where no application context exists yet.
|
||||
* {@code Environment}. Spring-aware composition code captures active profiles through
|
||||
* app-bootstrap's {@code RuntimeProfileSnapshot} bridge and passes the resulting plain collection
|
||||
* here. That keeps the vocabulary testable without a container and usable from the {@code
|
||||
* EnvironmentPostProcessor} phase, where no application context exists yet, while preventing ad-hoc
|
||||
* profile reads from reappearing throughout bootstrap code.
|
||||
*
|
||||
* <p>The vendored {@code messaging:*} platform deliberately does not use this type. It depends on
|
||||
* no {@code shared-contract} type by design, and its own profile vocabulary is its own contract.
|
||||
|
||||
+13
-8
@@ -67,15 +67,20 @@ class MasterSwitchParserTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("each switch carries its canonical env name")
|
||||
@DisplayName("every switch has one unique operator-facing APP_* environment name")
|
||||
void environmentNamesAreCanonical() {
|
||||
assertThat(MasterSwitch.PERSISTENCE_JPA.environmentVariable())
|
||||
.isEqualTo("APP_PERSISTENCE_JPA_ENABLED");
|
||||
assertThat(MasterSwitch.PERSISTENCE_MONGO.environmentVariable())
|
||||
.isEqualTo("APP_PERSISTENCE_MONGO_ENABLED");
|
||||
assertThat(MasterSwitch.MESSAGING.environmentVariable()).isEqualTo("APP_MESSAGING_ENABLED");
|
||||
assertThat(MasterSwitch.NOTIFICATION_PLATFORM.environmentVariable())
|
||||
.isEqualTo("APP_NOTIFICATION_PLATFORM_ENABLED");
|
||||
var names =
|
||||
java.util.Arrays.stream(MasterSwitch.values())
|
||||
.map(MasterSwitch::environmentVariable)
|
||||
.toList();
|
||||
|
||||
assertThat(names)
|
||||
.allSatisfy(
|
||||
name -> {
|
||||
assertThat(name).startsWith("APP_").endsWith("_ENABLED");
|
||||
assertThat(name).doesNotContain(".");
|
||||
})
|
||||
.doesNotHaveDuplicates();
|
||||
assertThat(MasterSwitch.GRAPHQL.environmentVariable()).isEqualTo("APP_GRAPHQL_ENABLED");
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -124,7 +124,7 @@ class RateLimitContractTest {
|
||||
resetAt,
|
||||
"login",
|
||||
"v3",
|
||||
RateLimitDecision.DecisionSource.GLOBAL_REDIS,
|
||||
RateLimitDecision.DecisionSource.GLOBAL_SHARED_STORE,
|
||||
RateLimitDecision.DecisionCertainty.CERTAIN);
|
||||
|
||||
assertThat(new RateLimitOutcome.Evaluated(decision).decision()).isEqualTo(decision);
|
||||
@@ -154,7 +154,7 @@ class RateLimitContractTest {
|
||||
resetAt,
|
||||
"login",
|
||||
"v3",
|
||||
RateLimitDecision.DecisionSource.GLOBAL_REDIS,
|
||||
RateLimitDecision.DecisionSource.GLOBAL_SHARED_STORE,
|
||||
RateLimitDecision.DecisionCertainty.CERTAIN))
|
||||
.isInstanceOf(IllegalArgumentException.class)
|
||||
.hasMessageContaining("remaining");
|
||||
@@ -168,7 +168,7 @@ class RateLimitContractTest {
|
||||
resetAt,
|
||||
"login",
|
||||
"v3",
|
||||
RateLimitDecision.DecisionSource.GLOBAL_REDIS,
|
||||
RateLimitDecision.DecisionSource.GLOBAL_SHARED_STORE,
|
||||
RateLimitDecision.DecisionCertainty.CERTAIN))
|
||||
.isInstanceOf(IllegalArgumentException.class)
|
||||
.hasMessageContaining("retryAfter");
|
||||
|
||||
Reference in New Issue
Block a user