Fix unit tests I broke

This commit is contained in:
zzz
2016-01-23 17:58:16 +00:00
parent 594abdee55
commit e7081491ca
3 changed files with 20 additions and 4 deletions

View File

@ -30,14 +30,28 @@ class HopProcessor {
*/ */
//static final boolean USE_DOUBLE_IV_ENCRYPTION = true; //static final boolean USE_DOUBLE_IV_ENCRYPTION = true;
static final int IV_LENGTH = 16; static final int IV_LENGTH = 16;
/**
* @deprecated used only by unit tests
*/
HopProcessor(I2PAppContext ctx, HopConfig config) {
this(ctx, config, createValidator());
}
public HopProcessor(I2PAppContext ctx, HopConfig config, IVValidator validator) { public HopProcessor(I2PAppContext ctx, HopConfig config, IVValidator validator) {
_context = ctx; _context = ctx;
_log = ctx.logManager().getLog(HopProcessor.class); _log = ctx.logManager().getLog(HopProcessor.class);
_config = config; _config = config;
_validator = validator; _validator = validator;
} }
/**
* @deprecated used only by unit test constructor
*/
private static IVValidator createValidator() {
// yeah, we'll use an O(1) validator later (e.g. bloom filter)
return new HashSetIVValidator();
}
/** /**
* Process the data for the current hop, overwriting the original data with * Process the data for the current hop, overwriting the original data with

View File

@ -21,8 +21,10 @@ class InboundEndpointProcessor {
//static final boolean USE_ENCRYPTION = HopProcessor.USE_ENCRYPTION; //static final boolean USE_ENCRYPTION = HopProcessor.USE_ENCRYPTION;
/** @deprecated unused */ /**
public InboundEndpointProcessor(RouterContext ctx, TunnelCreatorConfig cfg) { * @deprecated used only by unit tests
*/
InboundEndpointProcessor(RouterContext ctx, TunnelCreatorConfig cfg) {
this(ctx, cfg, DummyValidator.getInstance()); this(ctx, cfg, DummyValidator.getInstance());
} }

View File

@ -75,7 +75,7 @@ public class BuildMessageTestStandalone extends TestCase {
for (int i = 0; i < cfg.getLength(); i++) { for (int i = 0; i < cfg.getLength(); i++) {
// this not only decrypts the current hop's record, but encrypts the other records // this not only decrypts the current hop's record, but encrypts the other records
// with the reply key // with the reply key
BuildRequestRecord req = proc.decrypt(ctx, msg, _peers[i], _privKeys[i]); BuildRequestRecord req = proc.decrypt(msg, _peers[i], _privKeys[i]);
// If false, no records matched the _peers[i], or the decryption failed // If false, no records matched the _peers[i], or the decryption failed
assertTrue("foo @ " + i, req != null); assertTrue("foo @ " + i, req != null);
long ourId = req.readReceiveTunnelId(); long ourId = req.readReceiveTunnelId();