2012-04-24 23:34:42 +00:00
|
|
|
package org.servalproject.servald;
|
|
|
|
|
|
|
|
import java.lang.reflect.*;
|
|
|
|
import java.util.Arrays;
|
2012-04-30 08:15:24 +00:00
|
|
|
import java.util.List;
|
|
|
|
import java.util.LinkedList;
|
2012-04-24 23:34:42 +00:00
|
|
|
import org.servalproject.servald.ServalD;
|
|
|
|
|
|
|
|
class ServalDTests
|
|
|
|
{
|
|
|
|
public static void main(String[] args)
|
|
|
|
{
|
|
|
|
try {
|
2013-01-23 04:10:19 +00:00
|
|
|
Method m = ServalDTests.class.getMethod(args[0], String[].class);
|
2012-04-24 23:34:42 +00:00
|
|
|
m.invoke(null, (Object) Arrays.copyOfRange(args, 1, args.length));
|
|
|
|
}
|
|
|
|
catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
System.exit(1);
|
|
|
|
}
|
|
|
|
System.exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void repeat(String[] args)
|
|
|
|
{
|
|
|
|
int repeat = Integer.decode(args[0]);
|
2012-04-30 08:15:24 +00:00
|
|
|
ServalD servald = new ServalD();
|
2012-04-24 23:34:42 +00:00
|
|
|
for (int i = 0; i != repeat; ++i) {
|
2012-04-30 08:15:24 +00:00
|
|
|
servald.command(Arrays.copyOfRange(args, 1, args.length));
|
|
|
|
System.out.print(servald.status);
|
2012-11-07 06:42:04 +00:00
|
|
|
for (byte[] a: servald.outv) {
|
2012-04-24 23:34:42 +00:00
|
|
|
System.out.print(":");
|
2012-11-07 06:42:04 +00:00
|
|
|
System.out.print(new String(a));
|
2012-04-24 23:34:42 +00:00
|
|
|
}
|
|
|
|
System.out.println("");
|
|
|
|
}
|
2013-02-15 08:53:34 +00:00
|
|
|
System.exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void nullArg(String[] args)
|
|
|
|
{
|
|
|
|
ServalD servald = new ServalD();
|
|
|
|
for (int i = 0; i != args.length; ++i)
|
|
|
|
if ("(null)".equals(args[i]))
|
|
|
|
args[i] = null;
|
|
|
|
servald.command(Arrays.copyOfRange(args, 0, args.length));
|
|
|
|
System.out.print(servald.status);
|
|
|
|
for (byte[] a: servald.outv) {
|
|
|
|
System.out.print(":");
|
|
|
|
System.out.print(new String(a));
|
|
|
|
}
|
|
|
|
System.out.println("");
|
|
|
|
System.exit(0);
|
2012-04-24 23:34:42 +00:00
|
|
|
}
|
2013-02-15 08:53:34 +00:00
|
|
|
|
2012-04-24 23:34:42 +00:00
|
|
|
}
|