Files
mdg-filius/packages/fls/test/ownApplications.ts
T
julian.kiedaischandClaude Opus 5.5 95c5b7d97b test(fls): the Java oracle opens files as FILIUS does (M8)
FlsOracle now loads through SzenarioVerwaltung.laden, FILIUS's full
loading path: the archive unpacked, the project's own applications copied
where FILIUS's class loader finds them, then the configuration.
--network keeps the configuration-only load (netzwerkLaden).

On the corpus this changes two files: anwendung_komplett.fls and
multicast_server.fls then have their own applications (Accumulator,
Broadcast) installed. Java's views of the written and the exported files
are byte-equal to before: Java-FILIUS 2.14 opens our exports, with the
classes they carry, as it opens a file of its own, and sees what it sees
in the original. Until own applications on hosts are written (B2), the
reader, writer and export tests leave them out (test/ownApplications.ts);
a test checks that only those two files are touched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 09:32:24 +00:00

39 lines
1.4 KiB
TypeScript

// A project's own applications (classes under projekt/anwendungen): Java
// installs them when it loads the whole archive (tools/java-oracle, laden);
// this package reads, writes and exports them in a later step (B2). Until
// then the tests compare Java's views without them.
import { FILIUS_APPLICATION_CLASSES } from '../src/index.js';
/** The corpus files with an own application installed on a host. */
export const OWN_APPLICATION_FILES = ['java-examples/anwendung_komplett.fls', 'java-examples/multicast_server.fls'];
type View = { nodes?: { system: Record<string, unknown> }[] };
/** Java's view without the applications FILIUS does not ship. */
export function withoutOwnApplications<T>(view: T): T {
const { nodes } = view as View;
if (nodes === undefined) return view;
return {
...view,
nodes: nodes.map((node) =>
node.system.applications === undefined
? node
: {
...node,
system: {
...node.system,
applications: (node.system.applications as { class: string }[]).filter((application) =>
(FILIUS_APPLICATION_CLASSES as readonly string[]).includes(application.class),
),
},
},
),
};
}
/** Whether Java's view has an own application installed. */
export function hasOwnApplications(view: unknown): boolean {
return JSON.stringify(withoutOwnApplications(view)) !== JSON.stringify(view);
}