2005-09-12 comwiz

* Migrated the router tests to junit
This commit is contained in:
comwiz
2005-09-13 09:06:07 +00:00
committed by zzz
parent 9865af4174
commit 4293a18726
20 changed files with 647 additions and 589 deletions

View File

@@ -13,7 +13,6 @@ import net.i2p.data.DataStructure;
import net.i2p.data.Hash;
import net.i2p.data.SessionKey;
import net.i2p.data.StructureTest;
import net.i2p.data.TestData;
import net.i2p.data.TunnelId;
import net.i2p.data.i2np.DeliveryInstructions;
import net.i2p.util.Log;
@@ -23,34 +22,30 @@ import net.i2p.util.Log;
*
* @author jrandom
*/
class DeliveryInstructionsTest extends StructureTest {
private final static Log _log = new Log(DeliveryInstructionsTest.class);
static {
TestData.registerTest(new DeliveryInstructionsTest(), "DeliveryInstructions");
}
public class DeliveryInstructionsTest extends StructureTest {
public DataStructure createDataStructure() throws DataFormatException {
DeliveryInstructions instructions = new DeliveryInstructions();
instructions.setDelayRequested(true);
instructions.setDelaySeconds(42);
instructions.setDeliveryMode(DeliveryInstructions.DELIVERY_MODE_TUNNEL);
instructions.setEncrypted(true);
SessionKey key = new SessionKey();
byte keyData[] = new byte[SessionKey.KEYSIZE_BYTES];
for (int i = 0; i < keyData.length; i++)
keyData[i] = (byte)i;
key.setData(keyData);
instructions.setEncryptionKey(key);
Hash hash = new Hash();
byte hashData[] = new byte[32];
for (int i = 0; i < hashData.length; i++)
hashData[i] = (byte)(i%32);
hash.setData(hashData);
instructions.setRouter(hash);
TunnelId id = new TunnelId();
id.setTunnelId(666);
instructions.setTunnelId(id);
_log.debug("Instructions created: " + instructions + "\nBase 64: " + instructions.toBase64());
return instructions;
instructions.setDelayRequested(true);
instructions.setDelaySeconds(42);
instructions.setDeliveryMode(DeliveryInstructions.DELIVERY_MODE_TUNNEL);
instructions.setEncrypted(true);
SessionKey key = new SessionKey();
byte keyData[] = new byte[SessionKey.KEYSIZE_BYTES];
for (int i = 0; i < keyData.length; i++)
keyData[i] = (byte)i;
key.setData(keyData);
instructions.setEncryptionKey(key);
Hash hash = new Hash();
byte hashData[] = new byte[32];
for (int i = 0; i < hashData.length; i++)
hashData[i] = (byte)(i%32);
hash.setData(hashData);
instructions.setRouter(hash);
TunnelId id = new TunnelId();
id.setTunnelId(666);
instructions.setTunnelId(id);
return instructions;
}
public DataStructure createStructureToRead() { return new DeliveryInstructions(); }
}