forked from I2P_Developers/i2p.i2p
Core JUnit tests: type arguments, unused imports
This commit is contained in:
@@ -24,7 +24,7 @@ import net.i2p.data.Destination;
|
||||
*
|
||||
*/
|
||||
public class I2PSessionTest extends TestCase implements I2PSessionListener{
|
||||
private Set _s;
|
||||
private Set<String> _s;
|
||||
|
||||
|
||||
public void setUp(){
|
||||
@@ -56,7 +56,7 @@ public class I2PSessionTest extends TestCase implements I2PSessionListener{
|
||||
|
||||
session.setSessionListener(this);
|
||||
|
||||
_s = new HashSet();
|
||||
_s = new HashSet<String>();
|
||||
_s.add("a");
|
||||
_s.add("b");
|
||||
_s.add("c");
|
||||
|
@@ -5,7 +5,6 @@ import junit.framework.TestCase;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
|
@@ -156,7 +156,7 @@ public class ElGamalTest extends TestCase{
|
||||
String msg = "Hello world";
|
||||
|
||||
byte encrypted[] = _context.elGamalAESEngine().encryptAESBlock(msg.getBytes(), sessionKey, iv, null, null, 64);
|
||||
Set foundTags = new HashSet();
|
||||
Set<SessionTag> foundTags = new HashSet<SessionTag>();
|
||||
SessionKey foundKey = new SessionKey();
|
||||
byte decrypted[] = null;
|
||||
try{
|
||||
@@ -338,7 +338,7 @@ public class ElGamalTest extends TestCase{
|
||||
PrivateKey privKey = (PrivateKey)kp[1];
|
||||
SessionKey sessionKey = ctx.keyGenerator().generateSessionKey();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
Set tags = new HashSet(5);
|
||||
Set<SessionTag> tags = new HashSet<SessionTag>(5);
|
||||
if (i == 0) {
|
||||
for (int j = 0; j < 5; j++)
|
||||
tags.add(new SessionTag(true));
|
||||
|
@@ -10,7 +10,6 @@ package net.i2p.crypto;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.data.Hash;
|
||||
/**
|
||||
* @author Comwiz
|
||||
|
@@ -81,11 +81,11 @@ public class SessionEncryptionTest extends TestCase{
|
||||
SessionTag tag3 = new SessionTag(true);
|
||||
SessionTag tag4 = new SessionTag(true);
|
||||
|
||||
HashSet firstTags = new HashSet();
|
||||
HashSet<SessionTag> firstTags = new HashSet<SessionTag>();
|
||||
firstTags.add(tag1);
|
||||
firstTags.add(tag2);
|
||||
|
||||
HashSet secondTags = new HashSet();
|
||||
HashSet<SessionTag> secondTags = new HashSet<SessionTag>();
|
||||
secondTags.add(tag3);
|
||||
secondTags.add(tag4);
|
||||
|
||||
@@ -180,11 +180,11 @@ public class SessionEncryptionTest extends TestCase{
|
||||
SessionTag tag3 = new SessionTag(true);
|
||||
SessionTag tag4 = new SessionTag(true);
|
||||
|
||||
HashSet firstTags = new HashSet();
|
||||
HashSet<SessionTag> firstTags = new HashSet<SessionTag>();
|
||||
firstTags.add(tag1);
|
||||
firstTags.add(tag2);
|
||||
|
||||
HashSet secondTags = new HashSet();
|
||||
HashSet<SessionTag> secondTags = new HashSet<SessionTag>();
|
||||
secondTags.add(tag3);
|
||||
secondTags.add(tag4);
|
||||
|
||||
@@ -271,7 +271,7 @@ public class SessionEncryptionTest extends TestCase{
|
||||
SessionKey curKey = _context.sessionKeyManager().createSession(pubKey);
|
||||
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
Set tags = null;
|
||||
Set<SessionTag> tags = null;
|
||||
SessionKey nextKey = null;
|
||||
curKey = _context.sessionKeyManager().getCurrentKey(pubKey);
|
||||
SessionTag curTag = _context.sessionKeyManager().consumeNextAvailableTag(pubKey, curKey);
|
||||
@@ -302,8 +302,8 @@ public class SessionEncryptionTest extends TestCase{
|
||||
}
|
||||
}
|
||||
|
||||
private Set generateNewTags(int numTags) {
|
||||
Set tags = new HashSet(numTags);
|
||||
private Set<SessionTag> generateNewTags(int numTags) {
|
||||
Set<SessionTag> tags = new HashSet<SessionTag>(numTags);
|
||||
for (int i = 0; i < numTags; i++)
|
||||
tags.add(new SessionTag(true));
|
||||
return tags;
|
||||
|
@@ -8,9 +8,6 @@ package net.i2p.data;
|
||||
*
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
/**
|
||||
* Test harness for loading / storing Payload objects
|
||||
*
|
||||
|
@@ -9,7 +9,6 @@ package net.i2p.data;
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.util.Date;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
|
@@ -23,9 +23,9 @@ public class RouterInfoTest extends StructureTest {
|
||||
private final static Log _log = new Log(RouterInfoTest.class);
|
||||
public DataStructure createDataStructure() throws DataFormatException {
|
||||
RouterInfo info = new RouterInfo();
|
||||
HashSet addresses = new HashSet();
|
||||
HashSet<RouterAddress> addresses = new HashSet<RouterAddress>();
|
||||
DataStructure structure = (new RouterAddressTest()).createDataStructure();
|
||||
addresses.add(structure);
|
||||
addresses.add((RouterAddress) structure);
|
||||
info.setAddresses(addresses);
|
||||
|
||||
PublicKey pubKey = null;
|
||||
@@ -57,9 +57,9 @@ public class RouterInfoTest extends StructureTest {
|
||||
options.setProperty("netConnectionSpeed", "OC12");
|
||||
info.setOptions(options);
|
||||
|
||||
HashSet peers = new HashSet();
|
||||
HashSet<Hash> peers = new HashSet<Hash>();
|
||||
structure = (new HashTest()).createDataStructure();
|
||||
peers.add(structure);
|
||||
peers.add((Hash) structure);
|
||||
info.setPeers(peers);
|
||||
info.setPublished(System.currentTimeMillis());
|
||||
|
||||
|
@@ -8,9 +8,6 @@ package net.i2p.data;
|
||||
*
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
|
@@ -8,9 +8,6 @@ package net.i2p.data.i2cp;
|
||||
*
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
import net.i2p.data.StructureTest;
|
||||
import net.i2p.data.DataStructure;
|
||||
import net.i2p.data.DataFormatException;
|
||||
|
@@ -8,9 +8,6 @@ package net.i2p.data.i2cp;
|
||||
*
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
import net.i2p.data.StructureTest;
|
||||
import net.i2p.data.DataStructure;
|
||||
import net.i2p.data.DataFormatException;
|
||||
|
@@ -8,9 +8,6 @@ package net.i2p.data.i2cp;
|
||||
*
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
import net.i2p.data.StructureTest;
|
||||
import net.i2p.data.DataStructure;
|
||||
import net.i2p.data.DataFormatException;
|
||||
|
@@ -21,9 +21,9 @@ public class SimpleStatDumper {
|
||||
}
|
||||
|
||||
private static void dumpFrequencies(I2PAppContext ctx, StringBuilder buf) {
|
||||
Set frequencies = new TreeSet(ctx.statManager().getFrequencyNames());
|
||||
for (Iterator iter = frequencies.iterator(); iter.hasNext();) {
|
||||
String name = (String) iter.next();
|
||||
Set<String> frequencies = new TreeSet<String>(ctx.statManager().getFrequencyNames());
|
||||
for (Iterator<String> iter = frequencies.iterator(); iter.hasNext();) {
|
||||
String name = iter.next();
|
||||
FrequencyStat freq = ctx.statManager().getFrequency(name);
|
||||
buf.append('\n');
|
||||
buf.append(freq.getGroupName()).append('.').append(freq.getName()).append(": ")
|
||||
@@ -41,9 +41,9 @@ public class SimpleStatDumper {
|
||||
}
|
||||
|
||||
private static void dumpRates(I2PAppContext ctx, StringBuilder buf) {
|
||||
Set rates = new TreeSet(ctx.statManager().getRateNames());
|
||||
for (Iterator iter = rates.iterator(); iter.hasNext();) {
|
||||
String name = (String) iter.next();
|
||||
Set<String> rates = new TreeSet<String>(ctx.statManager().getRateNames());
|
||||
for (Iterator<String> iter = rates.iterator(); iter.hasNext();) {
|
||||
String name = iter.next();
|
||||
RateStat rate = ctx.statManager().getRate(name);
|
||||
buf.append('\n');
|
||||
buf.append(rate.getGroupName()).append('.').append(rate.getName()).append(": ")
|
||||
|
@@ -29,7 +29,7 @@ public class StatLogSplitter {
|
||||
}
|
||||
|
||||
private static void splitLog(String filename) {
|
||||
Map outputFiles = new HashMap(4);
|
||||
Map<String, FileWriter> outputFiles = new HashMap<String, FileWriter>(4);
|
||||
try {
|
||||
BufferedReader in = new BufferedReader(new FileReader(filename));
|
||||
String line;
|
||||
@@ -68,8 +68,8 @@ public class StatLogSplitter {
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
for (Iterator iter = outputFiles.values().iterator(); iter.hasNext(); ) {
|
||||
FileWriter out = (FileWriter)iter.next();
|
||||
for (Iterator<FileWriter> iter = outputFiles.values().iterator(); iter.hasNext(); ) {
|
||||
FileWriter out = iter.next();
|
||||
try { out.close(); } catch (IOException ioe) {}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user