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>
This commit is contained in:
2026-09-30 09:32:24 +00:00
co-authored by Claude Opus 5.5
parent 75c3da2bd1
commit 95c5b7d97b
8 changed files with 99 additions and 9 deletions
+11 -2
View File
@@ -20,8 +20,17 @@ Braucht JDK 17+, Maven und `xvfb-run`. Filius öffnet beim Laden sein
Hauptfenster (`Information.reset` → `JMainFrame`), deshalb läuft es an einem
virtuellen Bildschirm statt „headless".
* Gelesen wird über Filius' eigene, private Lademethode
`SzenarioVerwaltung.netzwerkLaden` (per Reflection) — Javas Weg, kein Nachbau.
* Gelesen wird so, wie Filius eine Datei öffnet: `SzenarioVerwaltung.laden`
entpackt das Archiv, kopiert die eigenen Anwendungen
(`projekt/anwendungen`) dorthin, wo Filius' Klassenlader sucht, und lädt
dann die Konfiguration — Javas Weg, kein Nachbau (seit 30.09.2026, M8).
`--network` lädt nur die Konfiguration über die private Methode
`netzwerkLaden` (per Reflection), wie vorher. Der Unterschied am Korpus:
In `anwendung_komplett.fls` und `multicast_server.fls` sind dann die
eigenen Anwendungen `Accumulator` und `Broadcast` installiert. Filius'
Klassenlader ist ein Singleton: Eine einmal geladene eigene Klasse bleibt
für die übrigen Dateien desselben Laufs geladen. Am Korpus stört das
nicht, denn keine Datei nutzt eine Klasse, die sie nicht mitbringt.
* Stand: `gitlab.com/filius1/filius` @ `6640354` (2.14.0), wird beim ersten
Lauf nach `.upstream/` geholt und gebaut.
* **Gewürfeltes:** Was nicht in der Datei steht, würfelt Filius zum Teil
+20 -2
View File
@@ -2,7 +2,12 @@
// Uses FILIUS's own private loader (SzenarioVerwaltung.netzwerkLaden) by
// reflection, so the result is Java's view, not a re-implementation of it.
//
// Usage: java -Djava.awt.headless=true -cp filius.jar:lib/*:classes FlsOracle <corpus dir> <output json>
// By default it loads as FILIUS opens a file (SzenarioVerwaltung.laden): the
// archive unpacked, the project's own applications (projekt/anwendungen)
// copied where FILIUS's class loader finds them, then the configuration.
// --network loads the configuration alone (netzwerkLaden), as before M8.
//
// Usage: java -cp filius.jar:lib/*:classes FlsOracle <corpus dir> <output json> [--sha256] [--network]
import filius.gui.netzwerksicht.GUIDocuItem;
import filius.gui.netzwerksicht.GUIKabelItem;
@@ -63,7 +68,13 @@ import java.util.zip.ZipInputStream;
public class FlsOracle {
/** Load the configuration alone (netzwerkLaden) instead of the whole archive (laden). */
static boolean networkOnly;
static List<String> options;
public static void main(String[] args) throws Exception {
options = Arrays.asList(args).subList(2, args.length);
networkOnly = options.contains("--network");
Path root = Path.of(args[0]);
List<Path> files;
try (Stream<Path> walk = Files.walk(root)) {
@@ -74,7 +85,7 @@ public class FlsOracle {
String name = root.relativize(file).toString();
try {
Map<String, Object> view = read(file);
if (args.length > 2 && args[2].equals("--sha256")) view.put("sha256", sha256(Files.readAllBytes(file)));
if (options.contains("--sha256")) view.put("sha256", sha256(Files.readAllBytes(file)));
result.put(name, view);
} catch (Throwable error) {
Throwable cause = error instanceof java.lang.reflect.InvocationTargetException && error.getCause() != null
@@ -123,6 +134,13 @@ public class FlsOracle {
}
static Map<String, Object> load(Path file) throws Exception {
if (!networkOnly) {
List<GUIKnotenItem> nodes = new ArrayList<>();
List<GUIKabelItem> cables = new ArrayList<>();
List<GUIDocuItem> docs = new ArrayList<>();
boolean success = SzenarioVerwaltung.getInstance().laden(file.toString(), nodes, cables, docs);
return describe(success, nodes, cables, docs);
}
Path xml = Files.createTempFile("konfiguration", ".xml");
try {
extractConfiguration(file, xml);