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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user