Discover Repeat collections and compatible Components in both hosts

This commit is contained in:
2026-11-13 14:47:21 +01:00
parent 0300062fb6
commit 0d14ac14e0
28 changed files with 969 additions and 44 deletions
@@ -0,0 +1,11 @@
package fixture.components;
public class WrongRepeatCard extends javafx.scene.layout.VBox {
static {
System.setProperty("fixture.repeat.initialized", "yes");
}
public javafx.beans.property.ObjectProperty<Object> modelProperty() {
throw new AssertionError("Discovery invoked Component");
}
}
@@ -0,0 +1 @@
<?neitzel-model fixture.model.Person?><fx:root xmlns:fx="http://javafx.com/fxml/1" type="javafx.scene.layout.VBox"/>
@@ -178,6 +178,49 @@ public final class PreviewChecks {
"fixture.replacement.initialized",
"fixture.badgecard.initialized"))
check(System.getProperty(key) == null, "Discovery initialized " + key);
try (var in = loader.getResourceAsStream("fixture/components/Full.fxml")) {
String full = new String(in.readAllBytes(), java.nio.charset.StandardCharsets.UTF_8);
var repeat = BindingDiscovery.inspect(full, "visits", "view", loader);
check(
repeat.collections().stream()
.anyMatch(c -> c.name().equals("visits") && c.status().equals("COMPATIBLE")),
"Repeat collection absent");
check(
repeat.components().stream()
.anyMatch(
c ->
c.name().equals("fixture.components.AddressForm")
&& c.status().equals("COMPATIBLE")),
"Repeat Component absent");
check(
repeat.components().stream()
.anyMatch(
c ->
c.name().equals("fixture.components.WrongRepeatCard")
&& c.status().equals("INCOMPATIBLE")),
"Wrong Repeat Model accepted");
check(
repeat.panes().stream()
.anyMatch(c -> c.name().equals("visits") && c.status().equals("COMPATIBLE")),
"Repeat pane absent");
check(repeat.problems().isEmpty(), "Valid Repeat rejected: " + repeat.problems());
var bad =
BindingDiscovery.inspect(
full.replace(
"component=\"fixture.components.AddressForm\"",
"component=\"fixture.components.WrongRepeatCard\""),
"visits",
"view",
loader);
check(
bad.problems().stream()
.anyMatch(
p -> p.severity().equals("ERROR") && p.message().contains("incompatible")),
"Repeat mismatch not diagnosed");
check(
System.getProperty("fixture.repeat.initialized") == null,
"Component discovery initialized class");
}
System.out.println("PASS bindings " + checks);
return;
}
@@ -0,0 +1,11 @@
package fixture.components;
public class WrongRepeatCard extends javafx.scene.layout.VBox {
static {
System.setProperty("fixture.repeat.initialized", "yes");
}
public javafx.beans.property.ObjectProperty<Object> modelProperty() {
throw new AssertionError("Discovery invoked Component");
}
}
@@ -0,0 +1 @@
<?neitzel-model fixture.model.Person?><fx:root xmlns:fx="http://javafx.com/fxml/1" type="javafx.scene.layout.VBox"/>
@@ -178,6 +178,49 @@ public final class PreviewChecks {
"fixture.replacement.initialized",
"fixture.badgecard.initialized"))
check(System.getProperty(key) == null, "Discovery initialized " + key);
try (var in = loader.getResourceAsStream("fixture/components/Full.fxml")) {
String full = new String(in.readAllBytes(), java.nio.charset.StandardCharsets.UTF_8);
var repeat = BindingDiscovery.inspect(full, "visits", "view", loader);
check(
repeat.collections().stream()
.anyMatch(c -> c.name().equals("visits") && c.status().equals("COMPATIBLE")),
"Repeat collection absent");
check(
repeat.components().stream()
.anyMatch(
c ->
c.name().equals("fixture.components.AddressForm")
&& c.status().equals("COMPATIBLE")),
"Repeat Component absent");
check(
repeat.components().stream()
.anyMatch(
c ->
c.name().equals("fixture.components.WrongRepeatCard")
&& c.status().equals("INCOMPATIBLE")),
"Wrong Repeat Model accepted");
check(
repeat.panes().stream()
.anyMatch(c -> c.name().equals("visits") && c.status().equals("COMPATIBLE")),
"Repeat pane absent");
check(repeat.problems().isEmpty(), "Valid Repeat rejected: " + repeat.problems());
var bad =
BindingDiscovery.inspect(
full.replace(
"component=\"fixture.components.AddressForm\"",
"component=\"fixture.components.WrongRepeatCard\""),
"visits",
"view",
loader);
check(
bad.problems().stream()
.anyMatch(
p -> p.severity().equals("ERROR") && p.message().contains("incompatible")),
"Repeat mismatch not diagnosed");
check(
System.getProperty("fixture.repeat.initialized") == null,
"Component discovery initialized class");
}
System.out.println("PASS bindings " + checks);
return;
}