Move streaming demo out of tests

This commit is contained in:
str4d
2015-07-25 11:42:53 +00:00
parent 44bd14bd4d
commit d662514f74
10 changed files with 16 additions and 33 deletions

View File

@ -39,7 +39,7 @@
</target>
<target name="builddeptest">
<ant dir="../../../core/java" target="jar" />
<ant dir="../../../apps/ministreaming/java/" target="jarTest" />
<ant dir="../../../apps/ministreaming/java/" target="jar" />
</target>
<target name="junit.compileTest" depends="builddeptest, compile">
@ -61,7 +61,6 @@
<classpath>
<pathelement location="../../../core/java/build/i2p.jar" />
<pathelement location="../../ministreaming/java/build/mstreaming.jar" />
<pathelement location="../../ministreaming/java/build/mstreamingTest.jar" />
<pathelement location="${junit.home}/junit4.jar" />
<pathelement location="${hamcrest.home}/hamcrest.jar" />
<pathelement location="${hamcrest.home}/hamcrest-all.jar" />
@ -120,7 +119,6 @@
<pathelement location="../../../core/java/build/i2ptest.jar" />
<pathelement location="../../../core/java/build/i2p.jar" />
<pathelement location="../../ministreaming/java/build/mstreaming.jar" />
<pathelement location="../../ministreaming/java/build/mstreamingTest.jar" />
<pathelement location="../../build/jbigi.jar" />
<pathelement location="${with.clover}" />
<pathelement location="${with.cobertura}" />

View File

@ -1,36 +0,0 @@
package net.i2p.client.streaming.impl;
import net.i2p.client.streaming.I2PSocketManagerFactory;
import net.i2p.client.streaming.StreamSinkSend;
import net.i2p.client.streaming.impl.I2PSocketManagerFull;
/**
*
*/
public class StreamSinkTestClient {
public static void main(String args[]) {
System.setProperty(I2PSocketManagerFactory.PROP_MANAGER, I2PSocketManagerFull.class.getName());
//System.setProperty(I2PClient.PROP_TCP_HOST, "dev.i2p.net");
//System.setProperty(I2PClient.PROP_TCP_PORT, "4501");
System.setProperty("tunnels.depthInbound", "0");
if (args.length <= 0) {
send("/home/jrandom/libjbigi.so");
} else {
for (int i = 0; i < args.length; i++)
send(args[i]);
}
}
private static void send(final String filename) {
Thread t = new Thread(new Runnable() {
public void run() {
StreamSinkSend.main(new String[] { filename, "0", "streamSinkTestLiveServer.key" });
}
}, "client " + filename);
t.start();
try { t.join(); } catch (Exception e) {}
System.err.println("Done sending");
try { Thread.sleep(120*1000); } catch (Exception e) {}
//System.exit(0);
}
}

View File

@ -1,22 +0,0 @@
package net.i2p.client.streaming.impl;
import net.i2p.client.streaming.I2PSocketManagerFactory;
import net.i2p.client.streaming.StreamSinkServer;
import net.i2p.client.streaming.impl.I2PSocketManagerFull;
/**
*
*/
public class StreamSinkTestServer {
public static void main(String args[]) {
System.setProperty(I2PSocketManagerFactory.PROP_MANAGER, I2PSocketManagerFull.class.getName());
//System.setProperty(I2PClient.PROP_TCP_HOST, "dev.i2p.net");
//System.setProperty(I2PClient.PROP_TCP_PORT, "4101");
System.setProperty("tunnels.depthInbound", "0");
new Thread(new Runnable() {
public void run() {
StreamSinkServer.main(new String[] { "streamSinkTestLiveDir", "streamSinkTestLiveServer.key" });
}
}, "server").start();
}
}

View File

@ -1,102 +0,0 @@
package net.i2p.client.streaming.impl;
import net.i2p.client.streaming.I2PSocketManagerFactory;
import net.i2p.client.streaming.StreamSinkClient;
import net.i2p.client.streaming.StreamSinkSend;
import net.i2p.client.streaming.StreamSinkServer;
import net.i2p.client.streaming.impl.I2PSocketManagerFull;
/**
* Usage: StreamSinkTest [(old|new) [#hops [#kb]]]
*/
public class StreamSinkTestStandalone {
/* private static String HOST1 = "dev.i2p.net";
private static String HOST2 = "dev.i2p.net";
private static String PORT1 = "4101";
private static String PORT2 = "4501";
/*
private static String HOST1 = "localhost";
private static String HOST2 = "localhost";
private static String PORT1 = "7654";
private static String PORT2 = "7654";
*/
private static String HOST1 = "localhost";
private static String HOST2 = "localhost";
private static String PORT1 = "10001";
private static String PORT2 = "11001";
/* */
public static void main(String args[]) {
boolean old = false;
int hops = 0;
int kb = 32*1024;
if (args.length > 0) {
if ("old".equals(args[0]))
old = true;
}
if (args.length > 1) {
try {
hops = Integer.parseInt(args[1]);
} catch (NumberFormatException nfe) {
hops = 0;
}
}
if (args.length > 2) {
try {
kb = Integer.parseInt(args[2]);
} catch (NumberFormatException nfe) {
kb = 32*1024;
}
}
if (!old)
System.setProperty(I2PSocketManagerFactory.PROP_MANAGER, I2PSocketManagerFull.class.getName());
System.setProperty("tunnels.depthInbound", ""+hops);
new Thread(new Runnable() {
public void run() {
StreamSinkServer.main(new String[] { HOST1, PORT1, "streamSinkTestDir", "streamSinkTestServer.key" });
}
}, "server").start();
try { Thread.sleep(60*1000); } catch (Exception e) {}
//run(256, 1);
//run(256, 1000);
//run(4*1024, 10);
run(kb, 1);
//run(1*1024, 1);
//run("/home/jrandom/streamSinkTestDir/clientSink36766.dat", 1);
//run(512*1024, 1);
try { Thread.sleep(10*1000); } catch (InterruptedException e) {}
System.out.println("Shutting down");
System.exit(0);
}
private static void run(final int kb, final int msBetweenWrites) {
Thread t = new Thread(new Runnable() {
public void run() {
StreamSinkClient.main(new String[] { HOST2, PORT2, kb+"", msBetweenWrites+"", "streamSinkTestServer.key" });
}
});
t.start();
System.out.println("client and server started: size = " + kb + "KB, delay = " + msBetweenWrites);
try {
t.join();
} catch (InterruptedException ie) {}
}
private static void run(final String filename, final int msBetweenWrites) {
Thread t = new Thread(new Runnable() {
public void run() {
StreamSinkSend.main(new String[] { filename, msBetweenWrites+"", "streamSinkTestServer.key" });
}
});
t.start();
System.out.println("client and server started: file " + filename + ", delay = " + msBetweenWrites);
try {
t.join();
} catch (InterruptedException ie) {}
}
}