fix(fls): Gnutella's peer limit is random in Java, not a default
PeerToPeerAnwendung's constructor rolls its peer limit (3, 4 or 5). The
getter defaults measured it once each run — 4, then 5 — and c48d15d
committed 5 as a default. GetterDefaults now constructs every class 64
times and writes a value that varies as {"random": [...]}; the decoder
answers a reference to it as unresolved, and the topology layer reports
a peer limit the file does not set as null.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -240,6 +240,17 @@ describe('XMLDecoder rules', () => {
|
||||
expect(isUnresolved(listItems(holder)[0])).toBe(true);
|
||||
});
|
||||
|
||||
it('does not take a value Java rolls in its constructor as a default', () => {
|
||||
// Gnutella's peer limit is 3, 4 or 5 at random (measured by constructing it 64 times).
|
||||
const [, holder] = decodeJavaBeans(
|
||||
doc(`<object class="filius.software.dateiaustausch.PeerToPeerAnwendung"><void id="Integer0" property="maxTeilnehmerZahl"/></object>
|
||||
<object class="java.util.ArrayList"><void method="add"><object idref="Integer0"/></void></object>`),
|
||||
);
|
||||
|
||||
const [item] = listItems(holder);
|
||||
expect(item).toEqual({ kind: 'unresolved', reason: 'PeerToPeerAnwendung#maxTeilnehmerZahl is random in Java' });
|
||||
});
|
||||
|
||||
it('reports an idref to an id that was never defined', () => {
|
||||
const [value] = decodeJavaBeans(doc('<object idref="Missing0"/>'));
|
||||
|
||||
|
||||
@@ -416,7 +416,8 @@ describe('readTopology rules', () => {
|
||||
|
||||
expect(byClass.get('filius.software.www.WebServer')).toMatchObject({ isActive: false, port: 80, useVirtualHosts: false });
|
||||
expect(byClass.get('filius.software.clientserver.ClientBaustein')).toMatchObject({ targetAddress: null, targetPort: 55_555 });
|
||||
expect(byClass.get('filius.software.dateiaustausch.PeerToPeerAnwendung')).toMatchObject({ maxPeers: 4 });
|
||||
// Java rolls it: no default.
|
||||
expect(byClass.get('filius.software.dateiaustausch.PeerToPeerAnwendung')).toMatchObject({ maxPeers: null });
|
||||
expect(byClass.get('filius.software.firewall.Firewall')?.firewall).toMatchObject({ activated: true, defaultPolicy: 0 });
|
||||
expect(byClass.get('filius.software.dns.DNSServer')).toMatchObject({ isActive: true, port: 5353, recursiveResolutionEnabled: false });
|
||||
expect(Object.keys(byClass.get('filius.software.lokal.Terminal')!).sort()).toEqual(['javaClass', 'key', 'source']);
|
||||
|
||||
Reference in New Issue
Block a user