diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4afe1a31..54f39495 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,14 +54,37 @@ jobs: name: backend-tests runs-on: windows-latest timeout-minutes: 60 + defaults: + run: + shell: pwsh + env: + COREPACK_ENABLE_DOWNLOAD_PROMPT: '0' + NODE_OPTIONS: --max-old-space-size=6144 steps: - uses: actions/checkout@v7 with: persist-credentials: false + - name: Checkout plugin development CLI for cross-repository acceptance + uses: actions/checkout@v7 + with: + repository: crysound/OpenTest-Plugins + ref: c8e62659fac4543eb8cd22d8211a25b1bf59761e + path: .ci/OpenTest-Plugins + persist-credentials: false + - uses: actions/setup-node@v7 + with: + node-version: 22 + package-manager-cache: false + - name: Prepare frontend acceptance dependencies + run: | + corepack enable + corepack prepare pnpm@10.6.5 --activate + pnpm install --frozen-lockfile + pnpm build:sdk - uses: actions/setup-java@v6 with: distribution: zulu java-version: '21' cache: maven - name: Build and test backend - run: mvn -B --no-transfer-progress --fail-at-end -f apps/backend/pom.xml verify + run: mvn -B --no-transfer-progress --fail-at-end -f apps/backend/pom.xml "-Dopentest.plugins.repository=${{ github.workspace }}/.ci/OpenTest-Plugins" verify diff --git a/apps/backend/crydaq-common/src/test/java/com/opentest/common/utils/LibraryLoaderTest.java b/apps/backend/crydaq-common/src/test/java/com/opentest/common/utils/LibraryLoaderTest.java index aadad799..2ba5f5d0 100644 --- a/apps/backend/crydaq-common/src/test/java/com/opentest/common/utils/LibraryLoaderTest.java +++ b/apps/backend/crydaq-common/src/test/java/com/opentest/common/utils/LibraryLoaderTest.java @@ -4,6 +4,7 @@ import org.junit.jupiter.api.io.TempDir; import org.springframework.test.util.ReflectionTestUtils; +import java.io.File; import java.nio.file.Files; import java.nio.file.Path; @@ -58,7 +59,8 @@ void darwinLoadsPosixPathsWithoutTheWindowsSubstringMatch() throws Exception { try { System.setProperty("os.name", "Darwin"); loader.loadDlls(); - nativeLoading.verify(() -> NativeLoader.loader(library.toString()), times(1)); + String expectedPath = nativeDirectory + File.separator + "nested/library.dylib"; + nativeLoading.verify(() -> NativeLoader.loader(expectedPath), times(1)); nativeLoading.verifyNoMoreInteractions(); } finally { if (previous == null) System.clearProperty("os.name"); else System.setProperty("os.name", previous); diff --git a/apps/backend/crydaq-platform-support/src/main/java/com/opentest/platform/file/concurrent/ConcurrentFileManager.java b/apps/backend/crydaq-platform-support/src/main/java/com/opentest/platform/file/concurrent/ConcurrentFileManager.java index 84de3dda..873b4e38 100644 --- a/apps/backend/crydaq-platform-support/src/main/java/com/opentest/platform/file/concurrent/ConcurrentFileManager.java +++ b/apps/backend/crydaq-platform-support/src/main/java/com/opentest/platform/file/concurrent/ConcurrentFileManager.java @@ -67,6 +67,7 @@ public class ConcurrentFileManager implements AutoCloseable { new ConcurrentHashMap<>(); private final ConcurrentMap fileConsumers = new ConcurrentHashMap<>(); + private final Object writeAdmissionMonitor = new Object(); private final Object fileConsumerMonitor = new Object(); private final Map writerFactories = new ConcurrentHashMap<>(); @@ -672,10 +673,14 @@ private ThreadPoolExecutor createFileExecutor() { while (acceptingWrites.get() && !executor.isShutdown()) { try { if (executor.getQueue().offer(task, 100L, TimeUnit.MILLISECONDS)) { - // Close may win while offer is waiting. A task already consumed or discarded - // owns its existing completion; otherwise reject and let the caller release it. - if ((!acceptingWrites.get() || executor.isShutdown()) && executor.remove(task)) { - throw new RejectedExecutionException("fileManager is shutting down"); + synchronized (writeAdmissionMonitor) { + if (!acceptingWrites.get() || executor.isShutdown()) { + if (executor.remove(task)) { + throw new RejectedExecutionException( + "fileManager is shutting down"); + } + return; + } } return; } @@ -929,12 +934,14 @@ private void completeFileConsumers(Throwable failure) { } private boolean beginManagerClose() { - synchronized (fileConsumerMonitor) { - if (!closed.compareAndSet(false, true)) { - return false; + synchronized (writeAdmissionMonitor) { + synchronized (fileConsumerMonitor) { + if (!closed.compareAndSet(false, true)) { + return false; + } + acceptingWrites.set(false); + return true; } - acceptingWrites.set(false); - return true; } } diff --git a/apps/backend/crydaq-platform-support/src/test/java/com/opentest/platform/file/concurrent/ConcurrentFileManagerBlockingExportTest.java b/apps/backend/crydaq-platform-support/src/test/java/com/opentest/platform/file/concurrent/ConcurrentFileManagerBlockingExportTest.java index d6b032c2..5429d8b8 100644 --- a/apps/backend/crydaq-platform-support/src/test/java/com/opentest/platform/file/concurrent/ConcurrentFileManagerBlockingExportTest.java +++ b/apps/backend/crydaq-platform-support/src/test/java/com/opentest/platform/file/concurrent/ConcurrentFileManagerBlockingExportTest.java @@ -5,14 +5,20 @@ import com.opentest.platform.file.writer.FileWriter; import org.junit.jupiter.api.Test; +import java.lang.reflect.Field; +import java.util.List; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.BlockingQueue; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutionException; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.RejectedExecutionException; +import java.util.concurrent.RejectedExecutionHandler; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; +import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; @@ -57,6 +63,79 @@ void cancelRejectsBlockedAdmissionAndReleasesEveryQueuedBorrow() throws Exceptio closeWithBlockedProducer(true); } + @Test + void workerClaimedAdmissionIsNotRejectedOrDiscarded() throws Exception { + ConcurrentFileManager manager = new ConcurrentFileManager( + new ConcurrentFileManagerConfig(1, 1, 3600L, 3600L)); + BlockingWriter writer = new BlockingWriter(); + manager.setBlockOnQueueFull(true); + manager.registerWriterFactory(TYPE, (fileName, append) -> writer); + manager.init(); + try { + ThreadPoolExecutor admissionOwner = managerExecutor(manager); + RejectedExecutionHandler handler = admissionOwner.getRejectedExecutionHandler(); + OfferThenShutdownExecutor worker = OfferThenShutdownExecutor.create(); + AtomicInteger completions = new AtomicInteger(); + TestData offered = new TestData(); + offered.addWriteCompletionCallback(error -> completions.incrementAndGet()); + FileWriteTask task = new FileWriteTask(writer, offered, + new FileWriteObserver() { + @Override public void onEnqueued(Data data) { } + @Override public void onCompleted(Data data, Throwable failure) { } + }, failure -> { }); + + handler.rejectedExecution(task, worker); + assertEquals(1, worker.getQueue().size()); + assertEquals(task, worker.getQueue().poll()); + writer.release.countDown(); + task.run(); + assertEquals(1, completions.get()); + } finally { + writer.release.countDown(); + manager.closeNow(); + } + } + + @SuppressWarnings("unchecked") + private static ThreadPoolExecutor managerExecutor(ConcurrentFileManager manager) + throws Exception { + Field field = ConcurrentFileManager.class.getDeclaredField("fileExecutors"); + field.setAccessible(true); + return ((List) field.get(manager)).getFirst(); + } + + private static final class OfferThenShutdownExecutor extends ThreadPoolExecutor { + private final AtomicBoolean shutdownObserved = new AtomicBoolean(); + + private OfferThenShutdownExecutor(BlockingQueue queue) { + super(0, 1, 0L, TimeUnit.MILLISECONDS, queue); + } + + static OfferThenShutdownExecutor create() { + AtomicReference owner = new AtomicReference<>(); + BlockingQueue queue = new ArrayBlockingQueue<>(1) { + @Override + public boolean offer(Runnable task, long timeout, TimeUnit unit) + throws InterruptedException { + boolean offered = super.offer(task, timeout, unit); + owner.get().shutdownObserved.set(true); + return offered; + } + }; + OfferThenShutdownExecutor executor = new OfferThenShutdownExecutor(queue); + owner.set(executor); + return executor; + } + + @Override public boolean isShutdown() { + return shutdownObserved.get(); + } + + @Override public boolean remove(Runnable task) { + return false; + } + } + private void closeWithBlockedProducer(boolean cancel) throws Exception { try (Fixture fixture = new Fixture()) { AtomicInteger completions = new AtomicInteger(); diff --git a/apps/backend/crydaq-platform-support/src/test/java/com/opentest/platform/protocol/CommonProtoCompatibilityTest.java b/apps/backend/crydaq-platform-support/src/test/java/com/opentest/platform/protocol/CommonProtoCompatibilityTest.java index 3aa80a8c..98e43473 100644 --- a/apps/backend/crydaq-platform-support/src/test/java/com/opentest/platform/protocol/CommonProtoCompatibilityTest.java +++ b/apps/backend/crydaq-platform-support/src/test/java/com/opentest/platform/protocol/CommonProtoCompatibilityTest.java @@ -34,6 +34,7 @@ void generatedContractKeepsLegacyPackageNamesAndFieldNumbers() { "DynamicResultChannel", "ResultChannelsAdded", "RecordingStorageStatus", + "MathChannelErrorMsg", "Response", "Request" ), descriptor.getMessageTypes().stream() @@ -80,7 +81,8 @@ void generatedContractKeepsLegacyPackageNamesAndFieldNumbers() { "resultChannelsAdded", 4, "recordingStorageStatus", 5, "mmapReadyMsg", 6, - "executionMessage", 7 + "executionMessage", 7, + "mathChannelErrorMsg", 8 )); assertFieldNumbers(CommonProto.Request.getDescriptor(), Map.of( "dashboardId", 1, diff --git a/apps/backend/opentest-plugin-runtime/src/test/java/com/opentest/runtime/loader/TestEditingPluginJar.java b/apps/backend/opentest-plugin-runtime/src/test/java/com/opentest/runtime/loader/TestEditingPluginJar.java index 2da09111..c041730a 100644 --- a/apps/backend/opentest-plugin-runtime/src/test/java/com/opentest/runtime/loader/TestEditingPluginJar.java +++ b/apps/backend/opentest-plugin-runtime/src/test/java/com/opentest/runtime/loader/TestEditingPluginJar.java @@ -1,12 +1,15 @@ package com.opentest.runtime.loader; import com.opentest.plugin.api.OpenTestBackendPlugin; +import com.opentest.dashboard.api.measurement.DashboardProvider; import com.opentest.runtime.JsonFiles; import javax.tools.ToolProvider; import java.io.File; import java.nio.charset.StandardCharsets; -import java.nio.file.*; -import java.util.jar.*; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.jar.JarEntry; +import java.util.jar.JarOutputStream; /** Compiles an independent author against public SDK locations only; no host/test classpath. */ public final class TestEditingPluginJar { @@ -66,7 +69,7 @@ public void register(BackendPluginRegistry registry) { config -> { throw new AssertionError("Discovery declared inputs"); }, (config, facts) -> { throw new AssertionError("Discovery bound inputs"); })); registry.measureEditing("measure", Config.class, new GraphicEditing(query -> { throw new AssertionError("Discovery projected graphic"); })); - registry.measureEditing("measure", Config.class, new LimitXAxis((config, result, selection) -> { throw new AssertionError("Discovery projected Limit X"); })); + registry.measureEditing("measure", Config.class, new LimitXAxis(query -> { throw new AssertionError("Discovery projected Limit X"); })); registry.measureEditing("measure", Config.class, new ReferenceUnits(new CurrentResultReferenceUnits() { public Change compare(Map previous, Map current) { throw new AssertionError("Discovery compared units"); } public Set affectedInputs(String algorithm, String result, Map parameters, @@ -83,7 +86,7 @@ public CompletionStage start(BackendPluginContext context) { """.replace("__MODE__", mode).replace("__ID__", pluginId); Files.writeString(source, author, StandardCharsets.UTF_8); String sdk = Path.of(OpenTestBackendPlugin.class.getProtectionDomain().getCodeSource().getLocation().toURI()).toString() - + File.pathSeparator + Path.of(com.opentest.dashboard.api.measurement.DashboardProvider.class + + File.pathSeparator + Path.of(DashboardProvider.class .getProtectionDomain().getCodeSource().getLocation().toURI()); int exit = ToolProvider.getSystemJavaCompiler().run(null, null, null, "--release", "21", "-encoding", "UTF-8", "-proc:none", "-classpath", sdk, "-d", classes.toString(), source.toString()); diff --git a/apps/backend/opentest-plugin-runtime/src/test/java/com/opentest/runtime/state/DashboardProviderRuntimeTest.java b/apps/backend/opentest-plugin-runtime/src/test/java/com/opentest/runtime/state/DashboardProviderRuntimeTest.java index 4de7571c..eb93f399 100644 --- a/apps/backend/opentest-plugin-runtime/src/test/java/com/opentest/runtime/state/DashboardProviderRuntimeTest.java +++ b/apps/backend/opentest-plugin-runtime/src/test/java/com/opentest/runtime/state/DashboardProviderRuntimeTest.java @@ -84,15 +84,16 @@ void declaredClassesCannotHideDifferentActualGenericTypes(String mode) throws Ex var bundle = bundle("org.test.invalid", PROVIDER, "level", "1", mode); queue(bundle); try (PluginRuntime runtime = runtime(bundle)) { - assertEquals("RECOVERY", runtime.candidate().path("status").asText()); - assertEquals("PLUGINS_NOT_READY", assertThrows(PluginFailure.class, runtime::dashboardProviders).code()); + assertEquals("APP_READY", runtime.candidate().path("status").asText()); + assertIsolated(runtime, bundle); + assertEquals("DASHBOARD_PROVIDER_NOT_ACTIVE", assertThrows(PluginFailure.class, () -> runtime.dashboardProvider(PROVIDER)).code()); var snapshot = runtime.snapshot(false).toString(); assertTrue(snapshot.contains("Measurement provider type arguments do not match its registration"), snapshot); } } @ParameterizedTest @ValueSource(strings = {"provider"}) - void duplicateProviderIdentityRejectsTheWholeCandidate(String collision) throws Exception { + void duplicateProviderIdentityIsolatesTheConflictingPlugin(String collision) throws Exception { var a = bundle("org.test.a", PROVIDER, "level", "1", "valid"); var b = bundle("org.test.b", collision.equals("provider") ? PROVIDER : "org.example.other:gain", collision.equals("mapping-different-scene") ? "other" : "level", "1", "valid"); @@ -101,9 +102,13 @@ void duplicateProviderIdentityRejectsTheWholeCandidate(String collision) throws initial.requestInstall(b.descriptor(), "install-b", generation(initial)); } try (PluginRuntime runtime = runtime(a, b)) { - assertEquals("RECOVERY", runtime.candidate().path("status").asText()); + assertEquals("BACKEND_CORE_READY", runtime.candidate().path("status").asText()); + assertIsolated(runtime, b); assertTrue(runtime.snapshot(false).toString().contains("重复")); - assertThrows(PluginFailure.class, runtime::dashboardProviders); + runtime.report(report(runtime, a)); + assertTrue(runtime.ready()); + assertEquals("org.test.a", runtime.dashboardProviders().path("providers").get(0).path("pluginId").asText()); + assertEquals(1, runtime.dashboardProviders().path("providers").size()); } } @@ -135,7 +140,8 @@ void duplicateProviderIdentityRejectsTheWholeCandidate(String collision) throws var mismatch = bundle("org.test.version", PROVIDER, "level", "2", "valid"); queue(mismatch); try (PluginRuntime runtime = runtime(mismatch)) { - assertEquals("RECOVERY", runtime.candidate().path("status").asText()); + assertEquals("APP_READY", runtime.candidate().path("status").asText()); + assertIsolated(runtime, mismatch); assertTrue(runtime.snapshot(false).toString().contains("版本")); } var valid = bundle("org.test.valid", "org.example.valid:gain", "level", "1", "valid"); @@ -187,16 +193,17 @@ void duplicateProviderIdentityRejectsTheWholeCandidate(String collision) throws } @ParameterizedTest @ValueSource(strings={"ownership-duplicate", "ownership-missing", "ownership-empty"}) - void invalidResultAlgorithmRegistrationRejectsTheCandidate(String mode) throws Exception { + void invalidResultAlgorithmRegistrationIsolatesThePlugin(String mode) throws Exception { var bundle = bundle("org.test.invalid-owner", PROVIDER, "level", "1", mode); queue(bundle); try (var runtime = runtime(bundle)) { - assertEquals("RECOVERY", runtime.candidate().path("status").asText()); + assertEquals("APP_READY", runtime.candidate().path("status").asText()); + assertIsolated(runtime, bundle); assertTrue(runtime.dashboardProviderForAnalysis("sample-analysis").isEmpty()); } } - @Test void duplicateResultAlgorithmAcrossProvidersRejectsTheCandidate() throws Exception { + @Test void duplicateResultAlgorithmAcrossProvidersIsolatesThePlugin() throws Exception { var first = bundle("org.test.first-owner", PROVIDER, "level", "1", "ownership"); var second = bundle("org.test.second-owner", "org.example.other:gain", "level", "1", "ownership"); try (var initial = runtime(first, second)) { @@ -204,8 +211,15 @@ void invalidResultAlgorithmRegistrationRejectsTheCandidate(String mode) throws E initial.requestInstall(second.descriptor(), "install-second", generation(initial)); } try (var runtime = runtime(first, second)) { - assertEquals("RECOVERY", runtime.candidate().path("status").asText()); + assertEquals("BACKEND_CORE_READY", runtime.candidate().path("status").asText()); + assertIsolated(runtime, second); assertTrue(runtime.snapshot(false).toString().contains("sample-analysis")); + runtime.report(report(runtime, first)); + assertTrue(runtime.ready()); + assertSame(runtime.dashboardProvider(PROVIDER).registration(), + runtime.dashboardProviderForAnalysis("sample-analysis").orElseThrow().registration()); + assertEquals("DASHBOARD_PROVIDER_NOT_ACTIVE", assertThrows(PluginFailure.class, + () -> runtime.dashboardProvider("org.example.other:gain")).code()); } } @@ -225,11 +239,12 @@ void invalidResultAlgorithmRegistrationRejectsTheCandidate(String mode) throws E } @ParameterizedTest @ValueSource(strings={"catalog-duplicate", "catalog-missing", "catalog-multi-duplicate", "catalog-empty"}) - void catalogRegistrationRejectsDuplicateAndUnregisteredMeasurements(String mode) throws Exception { + void catalogRegistrationIsolatesDuplicateAndUnregisteredMeasurements(String mode) throws Exception { var bundle = bundle("org.test.catalog", PROVIDER, "level", "1", mode); queue(bundle); try (var runtime = runtime(bundle)) { - assertEquals("RECOVERY", runtime.candidate().path("status").asText()); + assertEquals("APP_READY", runtime.candidate().path("status").asText()); + assertIsolated(runtime, bundle); assertTrue(runtime.measureResultCatalogs().isEmpty()); } } @@ -284,4 +299,13 @@ private static ObjectNode report(PluginRuntime runtime, TestPluginJar.Bundle bun .put("contributionId", "measure").put("componentId", "contributions/measure/demo"))); return report; } + private static void assertIsolated(PluginRuntime runtime, TestPluginJar.Bundle bundle) { + String id = bundle.descriptor().path("pluginId").asText(); + var snapshot = runtime.snapshot(false); + assertEquals("BACKEND_ACTIVATION_FAILED", snapshot.path("pluginFailures").path(id).path("code").asText(), snapshot.toString()); + for (var plugin : runtime.candidate().path("plugins")) { + assertFalse(id.equals(plugin.path("pluginId").asText()), "Failed plugin must not be offered to the frontend"); + } + } + } diff --git a/apps/backend/opentest-plugin-runtime/src/test/java/com/opentest/runtime/state/InstalledContentDevelopmentProcessTest.java b/apps/backend/opentest-plugin-runtime/src/test/java/com/opentest/runtime/state/InstalledContentDevelopmentProcessTest.java index d30dc71b..072be2fb 100644 --- a/apps/backend/opentest-plugin-runtime/src/test/java/com/opentest/runtime/state/InstalledContentDevelopmentProcessTest.java +++ b/apps/backend/opentest-plugin-runtime/src/test/java/com/opentest/runtime/state/InstalledContentDevelopmentProcessTest.java @@ -35,6 +35,8 @@ class InstalledContentDevelopmentProcessTest { @TempDir Path temp; @Test void formalInstallCanBeOverlaidForDevelopmentAndRestoredByNormalReinstall() throws Exception { + // macOS exposes its temporary directory through /var, a symlink to /private/var. + temp = temp.toRealPath(); Path pluginRoot = temp.resolve("runtime/plugins"); var packages = new PluginPackageManager(pluginRoot); var formalBackend = TestPluginJar.create(temp.resolve("formal-source"), "org.test.installed-development", "valid"); @@ -87,7 +89,10 @@ class InstalledContentDevelopmentProcessTest { () -> new StrictInstalledContentResolver(packages).resolve(formalInstallation)); assertEquals("PACKAGE_FILE_SET_MISMATCH", strictFailure.code()); try (var strict = PluginRuntime.open(pluginRoot, new StrictInstalledContentResolver(packages))) { - assertEquals("RECOVERY", strict.candidate().path("status").asText()); + assertEquals("APP_READY", strict.candidate().path("status").asText()); + assertTrue(strict.candidate().path("plugins").isEmpty()); + assertEquals("BACKEND_ACTIVATION_FAILED", strict.candidate().path("failedPlugins").get(0) + .path("lastError").path("code").asText()); strict.requestUninstall(JsonFiles.object() .put("pluginId", installation.path("pluginId").asText()) .put("version", installation.path("version").asText()) @@ -325,13 +330,9 @@ private static Path findPluginsRepository() { () -> "无效的 opentest.plugins.repository:" + repository); return repository; } - Path current = findHostRepository(); - while (current != null && !"opentest".equals(current.getFileName().toString())) current = current.getParent(); - Path repository = current == null ? null : current.resolveSibling("opentest-plugins"); - assertNotNull(repository, - "跨仓验收需要 -Dopentest.plugins.repository= 或宿主同级插件仓库"); + Path repository = findHostRepository().resolveSibling("OpenTest-Plugins"); assertTrue(Files.isRegularFile(repository.resolve("tools/dev.mjs")), - () -> "跨仓验收未找到插件开发 CLI:" + repository); + () -> "跨仓验收需要同级 OpenTest-Plugins,或 -Dopentest.plugins.repository=<插件仓库>:" + repository); return repository; } diff --git a/apps/backend/opentest-plugin-runtime/src/test/java/com/opentest/runtime/state/MeasurementEditingRegistrationTest.java b/apps/backend/opentest-plugin-runtime/src/test/java/com/opentest/runtime/state/MeasurementEditingRegistrationTest.java index 68c45574..a56f0836 100644 --- a/apps/backend/opentest-plugin-runtime/src/test/java/com/opentest/runtime/state/MeasurementEditingRegistrationTest.java +++ b/apps/backend/opentest-plugin-runtime/src/test/java/com/opentest/runtime/state/MeasurementEditingRegistrationTest.java @@ -7,12 +7,20 @@ import org.junit.jupiter.api.io.TempDir; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; -import com.opentest.runtime.*; +import com.opentest.runtime.JsonFiles; +import com.opentest.runtime.PluginFailure; +import com.opentest.runtime.PluginRuntime; import com.opentest.runtime.loader.TestEditingPluginJar; import com.opentest.runtime.loader.TestPluginJar; import java.nio.file.Path; -import java.util.*; -import static org.junit.jupiter.api.Assertions.*; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; @Timeout(40) class MeasurementEditingRegistrationTest { @@ -54,8 +62,10 @@ class MeasurementEditingRegistrationTest { void rejectsInvalidAttachmentThroughActualPluginStartup(String mode) throws Exception { var bundle = bundle("org.test.editing", mode); queue(bundle); try (var runtime = runtime(bundle)) { - assertEquals("RECOVERY", runtime.candidate().path("status").asText()); - assertFalse(runtime.ready()); + assertEquals("APP_READY", runtime.candidate().path("status").asText()); + assertTrue(runtime.ready()); + assertEquals("failed", runtime.snapshot(false).path("plugins").get(0).path("status").asText()); + assertEquals("BACKEND_ACTIVATION_FAILED", runtime.snapshot(false).path("plugins").get(0).path("lastError").path("code").asText()); assertThrows(PluginFailure.class, () -> runtime.editing("org.test.editing:measure")); } }