Tunnels: Simplify TunnelId and HopConfig to save space

and reduce object churn and duplication
Fixup tests, javadocs, logging as required
This commit is contained in:
zzz
2020-11-07 13:40:48 +00:00
parent e18708bdbe
commit 5bafdd05a9
14 changed files with 134 additions and 114 deletions

View File

@@ -16,9 +16,21 @@ package net.i2p.data;
*/
public class TunnelIdTest extends StructureTest {
public DataStructure createDataStructure() throws DataFormatException {
TunnelId id = new TunnelId();
TunnelIdStructure id = new TunnelIdStructure();
id.setTunnelId(42);
return id;
}
public DataStructure createStructureToRead() { return new TunnelId(); }
public DataStructure createStructureToRead() { return new TunnelIdStructure(); }
/**
* so we can test it as a structure
* @since 0.9.48 TunnelId no longer extends DataStructureImpl
*/
private class TunnelIdStructure extends TunnelId implements DataStructure {
public Hash calculateHash() { return null; }
public void fromByteArray(byte[] in) {}
public byte[] toByteArray() { return null; }
public void fromBase64(String in) {}
public String toBase64() { return null; }
}
}