|
@@ -28,6 +28,7 @@ import java.io.File;
|
|
import java.io.PrintStream;
|
|
import java.io.PrintStream;
|
|
|
|
|
|
public class TestTraceAdmin {
|
|
public class TestTraceAdmin {
|
|
|
|
+ private static final String NEWLINE = System.getProperty("line.separator");
|
|
|
|
|
|
private String runTraceCommand(TraceAdmin trace, String... cmd)
|
|
private String runTraceCommand(TraceAdmin trace, String... cmd)
|
|
throws Exception {
|
|
throws Exception {
|
|
@@ -66,10 +67,10 @@ public class TestTraceAdmin {
|
|
try {
|
|
try {
|
|
TraceAdmin trace = new TraceAdmin();
|
|
TraceAdmin trace = new TraceAdmin();
|
|
trace.setConf(conf);
|
|
trace.setConf(conf);
|
|
- Assert.assertEquals("ret:0, [no span receivers found]\n",
|
|
|
|
|
|
+ Assert.assertEquals("ret:0, [no span receivers found]" + NEWLINE,
|
|
runTraceCommand(trace, "-list", "-host", getHostPortForNN(cluster)));
|
|
runTraceCommand(trace, "-list", "-host", getHostPortForNN(cluster)));
|
|
Assert.assertEquals("ret:0, Added trace span receiver 1 with " +
|
|
Assert.assertEquals("ret:0, Added trace span receiver 1 with " +
|
|
- "configuration local-file-span-receiver.path = " + tracePath + "\n",
|
|
|
|
|
|
+ "configuration local-file-span-receiver.path = " + tracePath + NEWLINE,
|
|
runTraceCommand(trace, "-add", "-host", getHostPortForNN(cluster),
|
|
runTraceCommand(trace, "-add", "-host", getHostPortForNN(cluster),
|
|
"-class", "org.htrace.impl.LocalFileSpanReceiver",
|
|
"-class", "org.htrace.impl.LocalFileSpanReceiver",
|
|
"-Clocal-file-span-receiver.path=" + tracePath));
|
|
"-Clocal-file-span-receiver.path=" + tracePath));
|
|
@@ -77,17 +78,17 @@ public class TestTraceAdmin {
|
|
runTraceCommand(trace, "-list", "-host", getHostPortForNN(cluster));
|
|
runTraceCommand(trace, "-list", "-host", getHostPortForNN(cluster));
|
|
Assert.assertTrue(list.startsWith("ret:0"));
|
|
Assert.assertTrue(list.startsWith("ret:0"));
|
|
Assert.assertTrue(list.contains("1 org.htrace.impl.LocalFileSpanReceiver"));
|
|
Assert.assertTrue(list.contains("1 org.htrace.impl.LocalFileSpanReceiver"));
|
|
- Assert.assertEquals("ret:0, Removed trace span receiver 1\n",
|
|
|
|
|
|
+ Assert.assertEquals("ret:0, Removed trace span receiver 1" + NEWLINE,
|
|
runTraceCommand(trace, "-remove", "1", "-host",
|
|
runTraceCommand(trace, "-remove", "1", "-host",
|
|
getHostPortForNN(cluster)));
|
|
getHostPortForNN(cluster)));
|
|
- Assert.assertEquals("ret:0, [no span receivers found]\n",
|
|
|
|
|
|
+ Assert.assertEquals("ret:0, [no span receivers found]" + NEWLINE,
|
|
runTraceCommand(trace, "-list", "-host", getHostPortForNN(cluster)));
|
|
runTraceCommand(trace, "-list", "-host", getHostPortForNN(cluster)));
|
|
Assert.assertEquals("ret:0, Added trace span receiver 2 with " +
|
|
Assert.assertEquals("ret:0, Added trace span receiver 2 with " +
|
|
- "configuration local-file-span-receiver.path = " + tracePath + "\n",
|
|
|
|
|
|
+ "configuration local-file-span-receiver.path = " + tracePath + NEWLINE,
|
|
runTraceCommand(trace, "-add", "-host", getHostPortForNN(cluster),
|
|
runTraceCommand(trace, "-add", "-host", getHostPortForNN(cluster),
|
|
"-class", "LocalFileSpanReceiver",
|
|
"-class", "LocalFileSpanReceiver",
|
|
"-Clocal-file-span-receiver.path=" + tracePath));
|
|
"-Clocal-file-span-receiver.path=" + tracePath));
|
|
- Assert.assertEquals("ret:0, Removed trace span receiver 2\n",
|
|
|
|
|
|
+ Assert.assertEquals("ret:0, Removed trace span receiver 2" + NEWLINE,
|
|
runTraceCommand(trace, "-remove", "2", "-host",
|
|
runTraceCommand(trace, "-remove", "2", "-host",
|
|
getHostPortForNN(cluster)));
|
|
getHostPortForNN(cluster)));
|
|
} finally {
|
|
} finally {
|