package edu.washington.cs.oneswarm.test.util;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import org.gudy.azureus2.core3.config.impl.ConfigurationManager;
public class LocalProcessesTestBase extends OneSwarmTestBase {
/** Commands to send before friends are connected */
protected static List<String> preConnectCommands = new LinkedList<String>();
static {
// preConnectCommands.add("booleanSetting OSF2F.Use@DHT@Proxy false");
// preConnectCommands.add("booleanSetting OSF2F.LanFriendFinder false");
// preConnectCommands.add("booleanSetting dht.enabled false");
preConnectCommands.add("floatSetting f2f_forward_search_probability 1.0");
}
protected static void startLocalInstance() {
if (!TestUtils.swtTestRunnerUsed()) {
new Thread("Off-main Oneswarm") {
@Override
public void run() {
try {
TestUtils.startOneSwarmForTest(true);
} catch (IOException e) {
e.printStackTrace();
System.exit(-1);
}
}
}.start();
}
// Start a local client in this JVM
TestUtils.awaitJVMOneSwarmStart();
// Disable lan, dht, cht friend connections.
ConfigurationManager.getInstance().setParameter("OSF2F.Use DHT Proxy", false);
ConfigurationManager.getInstance().setParameter("OSF2F.LanFriendFinder", false);
ConfigurationManager.getInstance().setParameter("dht.enabled", false);
ConfigurationManager.getInstance().setParameter("f2f_forward_search_probability",
new Float(1.0));
ConfigurationManager.getInstance().setDirty();
}
}