From e7081491ca49ec27d41eb252b30306167e396e77 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Sat, 23 Jan 2016 17:58:16 +0000
Subject: [PATCH] Fix unit tests I broke

---
 .../src/net/i2p/router/tunnel/HopProcessor.java  | 16 +++++++++++++++-
 .../router/tunnel/InboundEndpointProcessor.java  |  6 ++++--
 .../tunnel/BuildMessageTestStandalone.java       |  2 +-
 3 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/router/java/src/net/i2p/router/tunnel/HopProcessor.java b/router/java/src/net/i2p/router/tunnel/HopProcessor.java
index f45ec234b4..9ba6218fd9 100644
--- a/router/java/src/net/i2p/router/tunnel/HopProcessor.java
+++ b/router/java/src/net/i2p/router/tunnel/HopProcessor.java
@@ -30,14 +30,28 @@ class HopProcessor {
      */
     //static final boolean USE_DOUBLE_IV_ENCRYPTION = true;
     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) {
         _context = ctx;
         _log = ctx.logManager().getLog(HopProcessor.class);
         _config = config;
         _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
diff --git a/router/java/src/net/i2p/router/tunnel/InboundEndpointProcessor.java b/router/java/src/net/i2p/router/tunnel/InboundEndpointProcessor.java
index 88aa6da71a..4a3c5eccbe 100644
--- a/router/java/src/net/i2p/router/tunnel/InboundEndpointProcessor.java
+++ b/router/java/src/net/i2p/router/tunnel/InboundEndpointProcessor.java
@@ -21,8 +21,10 @@ class InboundEndpointProcessor {
     
     //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());
     }
 
diff --git a/router/java/test/junit/net/i2p/router/tunnel/BuildMessageTestStandalone.java b/router/java/test/junit/net/i2p/router/tunnel/BuildMessageTestStandalone.java
index 1ca7caea82..3479462215 100644
--- a/router/java/test/junit/net/i2p/router/tunnel/BuildMessageTestStandalone.java
+++ b/router/java/test/junit/net/i2p/router/tunnel/BuildMessageTestStandalone.java
@@ -75,7 +75,7 @@ public class BuildMessageTestStandalone extends TestCase {
         for (int i = 0; i < cfg.getLength(); i++) {
             // this not only decrypts the current hop's record, but encrypts the other records
             // 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
             assertTrue("foo @ " + i, req != null);
             long ourId = req.readReceiveTunnelId();
-- 
GitLab