org.apache.maven.plugins
diff --git a/services/judge-runtime/src/test/java/com/ulticode/modules/queue/pipeline/source/ConfiguredJudgingCaseSourceTest.java b/services/judge-runtime/src/test/java/com/ulticode/modules/queue/pipeline/source/ConfiguredJudgingCaseSourceTest.java
index 294b80f3ef..c5426227c1 100644
--- a/services/judge-runtime/src/test/java/com/ulticode/modules/queue/pipeline/source/ConfiguredJudgingCaseSourceTest.java
+++ b/services/judge-runtime/src/test/java/com/ulticode/modules/queue/pipeline/source/ConfiguredJudgingCaseSourceTest.java
@@ -1,13 +1,67 @@
package com.ulticode.modules.queue.pipeline.source;
-import org.junit.jupiter.api.Disabled;
+import com.ulticode.modules.queue.port.JudgingCase;
+import com.ulticode.modules.queue.port.adapter.ProblemExampleJudgingCaseSource;
+import com.ulticode.modules.queue.port.adapter.TestCaseJudgingCaseSource;
+import com.ulticode.modules.submission.port.JudgeConfigPort;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
-@Disabled("P7 migration: port signature changes; re-enable after P7-RELOCATE-INFRA-001")
-@DisplayName("Configured judging case source (disabled)")
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.mockito.Mockito.verifyNoInteractions;
+import static org.mockito.Mockito.when;
+
+@ExtendWith(MockitoExtension.class)
+@DisplayName("Configured judging case source")
class ConfiguredJudgingCaseSourceTest {
+ @Mock private TestCaseJudgingCaseSource canonicalSource;
+ @Mock private ProblemExampleJudgingCaseSource legacySource;
+ @Mock private JudgeConfigPort configuration;
+ @InjectMocks private ConfiguredJudgingCaseSource source;
+
@Test
- @DisplayName("placeholder")
- void placeholder() {}
+ void selectsCanonicalCasesWhenEnabled() {
+ var cases = List.of(new JudgingCase("hidden", "hidden", "42", List.of(), true, false));
+ when(configuration.isUseTestCases()).thenReturn(true);
+ when(canonicalSource.loadCases(42L)).thenReturn(cases);
+
+ assertThat(source.loadCases(42L)).isSameAs(cases);
+ verifyNoInteractions(legacySource);
+ }
+
+ @Test
+ void selectsLegacyCasesWhenDisabled() {
+ var cases = List.of(new JudgingCase("example", "example", "42", List.of(), false, true));
+ when(configuration.isUseTestCases()).thenReturn(false);
+ when(legacySource.loadCases(42L)).thenReturn(cases);
+
+ assertThat(source.loadCases(42L)).isSameAs(cases);
+ verifyNoInteractions(canonicalSource);
+ }
+
+ @Test
+ void doesNotFallBackWhenCanonicalCasesAreEmpty() {
+ when(configuration.isUseTestCases()).thenReturn(true);
+ when(canonicalSource.loadCases(42L)).thenReturn(List.of());
+
+ assertThat(source.loadCases(42L)).isEmpty();
+ verifyNoInteractions(legacySource);
+ }
+
+ @Test
+ void propagatesCanonicalFailureWithoutFallingBack() {
+ var failure = new IllegalStateException("canonical source unavailable");
+ when(configuration.isUseTestCases()).thenReturn(true);
+ when(canonicalSource.loadCases(42L)).thenThrow(failure);
+
+ assertThatThrownBy(() -> source.loadCases(42L)).isSameAs(failure);
+ verifyNoInteractions(legacySource);
+ }
}
diff --git a/services/judge-runtime/src/test/java/com/ulticode/modules/submission/contract/DFormEnvelopeContractTest.java b/services/judge-runtime/src/test/java/com/ulticode/modules/submission/contract/DFormEnvelopeContractTest.java
index d6c42372fb..2498bfc2e6 100644
--- a/services/judge-runtime/src/test/java/com/ulticode/modules/submission/contract/DFormEnvelopeContractTest.java
+++ b/services/judge-runtime/src/test/java/com/ulticode/modules/submission/contract/DFormEnvelopeContractTest.java
@@ -26,16 +26,13 @@
*
* Authoritative source: {@code docker/sandbox/harness/contract/CONTRACT.md}.
* The schemas and golden files live next to that spec; they are also
- * mirrored into {@code src/test/resources/contract/} so the JVM test lane
- * can read them off the classpath without needing the harness source tree.
+ * copied into the test classpath by Maven from that canonical directory.
*
*
Scope (additive — no runtime change):
*
* - Decoding: a real-shaped envelope (golden) decodes via
- * {@link CodeExecutionHelperImpl#parseDEnvelope} into the expected
- * per-case {@link RunResultDTO.RunCaseResult} values.
- * - Encoding: {@link CodeExecutionHelperImpl#buildDBatchInputsJson}
- * and {@link CodeExecutionHelperImpl#buildDInputsJson} emit JSON
+ * {@code DFormEnvelopeCodec} into the expected per-case response values.
+ * - Encoding: the codec's batch and single-case methods emit JSON
* that contains every field the input schema requires.
* - Vocabulary: every {@code status} value in the contract is
* decodable by {@link SubmissionStatusCodec#fromWire(String)}.
@@ -45,7 +42,6 @@
* judge path. It runs in the regular unit-test lane.
*/
@DisplayName("D-form envelope contract parity (backend ↔ harness)")
-@org.junit.jupiter.api.Disabled("Test fixtures not relocated; re-enable after resource migration")
class DFormEnvelopeContractTest {
private static final ObjectMapper MAPPER = new ObjectMapper();
@@ -238,7 +234,7 @@ private JsonNode parseOrFail(String json) {
}
/**
- * Synthesise a {@link RunSubmissionDTO.RunTestCase} list shaped after
+ * Synthesise a {@link JudgeRunRequest.TestCase} list shaped after
* the golden input.json. Uses {@code UuidGenerator.newId() == "test-uuid"}
* via the test-only generator wired into {@code helper}.
*/
@@ -266,4 +262,4 @@ private List buildTestCasesFromGoldenInput() throws Ex
}
return out;
}
-}
\ No newline at end of file
+}
diff --git a/services/submission/src/main/resources/application.yml b/services/submission/src/main/resources/application.yml
index 8432d91bf8..a9ee7864a6 100644
--- a/services/submission/src/main/resources/application.yml
+++ b/services/submission/src/main/resources/application.yml
@@ -86,6 +86,7 @@ management:
headers:
Authorization: ${MANAGEMENT_OTLP_AUTHORIZATION:}
timeout: 5s
+ otlp:
metrics:
export:
enabled: ${MANAGEMENT_OTLP_METRICS_ENABLED:false}