mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-08 08:52:12 +00:00
Running Spring Boot main-class configurations had no Update action, and incremental Java builds did not publish edited resources to the running JVM. They now share the Update action, toolbar and build runner with Tomcat: resources go through the module's Maven or Gradle build and are published to the resolved runtime classpath, including Gradle's separate jdt.ls output directory. Class updates use scoped HotSwap when available and explain the restart requirement otherwise. Both configuration types get "On 'Update' action" and "On frame deactivation" policies. A missing policy keeps the chooser and does no deactivation update. Focus tracking debounces external changes and prevents overlapping updates. Verified on macOS with Maven, Gradle, Tomcat 10.1 and HotSwap. Windows and Linux focus detection were not run. On Linux a native GTK dialog can count as deactivation when no webview window is focused. Fixes #580
43 lines
2.2 KiB
TypeScript
43 lines
2.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import type { RunConfig } from "@/platform/ipc";
|
|
import { applicationType, springBootType } from "./jvmTypes";
|
|
import { tomcatType } from "./tomcat";
|
|
import { isUpdatable, updateAllowed } from "./updatePolicies";
|
|
|
|
const config = (kind: string, params = {}, target?: RunConfig["target"]) => ({ kind, params, target }) as RunConfig;
|
|
|
|
describe("application update policies", () => {
|
|
it.each([tomcatType, springBootType])("shares safe defaults and policy fields in $id", (type) => {
|
|
expect(type.defaults).toMatchObject({ onUpdate: "ask", onDeactivation: "none" });
|
|
const update = type.fields?.find((f) => f.key === "onUpdate");
|
|
const deactivate = type.fields?.find((f) => f.key === "onDeactivation");
|
|
expect(update?.options?.map((o) => o.value)).toEqual(
|
|
type.id === "tomcat"
|
|
? ["ask", "resources", "classes", "redeploy", "restart"]
|
|
: ["ask", "resources", "classes", "restart"],
|
|
);
|
|
expect(deactivate?.options?.map((o) => o.value)).toEqual(["none", "resources", "classes"]);
|
|
});
|
|
|
|
it("keeps plain Java applications and build-tool goals outside the feature", () => {
|
|
expect(applicationType.fields?.some((f) => f.key === "onUpdate")).toBe(false);
|
|
for (const kind of ["application", "maven", "gradle", "java-file"]) expect(isUpdatable(config(kind))).toBe(false);
|
|
});
|
|
|
|
it.each(["tomcat", "spring-boot"])("enables local %s sessions", (kind) => {
|
|
expect(isUpdatable(config(kind))).toBe(true);
|
|
expect(updateAllowed(config(kind), "resources")).toBe(true);
|
|
expect(updateAllowed(config(kind), "classes")).toBe(true);
|
|
expect(updateAllowed(config(kind), "restart")).toBe(true);
|
|
expect(updateAllowed(config(kind), "invalid")).toBe(false);
|
|
expect(isUpdatable(config(kind, {}, "remote"))).toBe(false);
|
|
});
|
|
|
|
it("preserves WAR restrictions and limits redeploy to Tomcat", () => {
|
|
expect(updateAllowed(config("tomcat", { deployment: "war" }), "resources")).toBe(false);
|
|
expect(updateAllowed(config("tomcat", { deployment: "war" }), "classes")).toBe(false);
|
|
expect(updateAllowed(config("tomcat", { deployment: "war" }), "redeploy")).toBe(true);
|
|
expect(updateAllowed(config("spring-boot"), "redeploy")).toBe(false);
|
|
});
|
|
});
|