Ejemplo n.º 1
0
        /// <exception cref="System.Exception"/>
        public static void Main(string[] argv)
        {
            TraceAdmin admin = new TraceAdmin();

            admin.SetConf(new Configuration());
            System.Environment.Exit(admin.Run(argv));
        }
Ejemplo n.º 2
0
        public virtual void TestCreateAndDestroySpanReceiver()
        {
            Configuration conf = new Configuration();

            conf = new Configuration();
            conf.Set(DFSConfigKeys.DfsServerHtracePrefix + SpanReceiverHost.SpanReceiversConfSuffix
                     , string.Empty);
            MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).NumDataNodes(3).Build();

            cluster.WaitActive();
            TemporarySocketDirectory tempDir = new TemporarySocketDirectory();
            string tracePath = new FilePath(tempDir.GetDir(), "tracefile").GetAbsolutePath();

            try
            {
                TraceAdmin trace = new TraceAdmin();
                trace.SetConf(conf);
                NUnit.Framework.Assert.AreEqual("ret:0, [no span receivers found]" + Newline, RunTraceCommand
                                                    (trace, "-list", "-host", GetHostPortForNN(cluster)));
                NUnit.Framework.Assert.AreEqual("ret:0, Added trace span receiver 1 with " + "configuration local-file-span-receiver.path = "
                                                + tracePath + Newline, RunTraceCommand(trace, "-add", "-host", GetHostPortForNN
                                                                                           (cluster), "-class", "org.apache.htrace.impl.LocalFileSpanReceiver", "-Clocal-file-span-receiver.path="
                                                                                       + tracePath));
                string list = RunTraceCommand(trace, "-list", "-host", GetHostPortForNN(cluster));
                NUnit.Framework.Assert.IsTrue(list.StartsWith("ret:0"));
                NUnit.Framework.Assert.IsTrue(list.Contains("1   org.apache.htrace.impl.LocalFileSpanReceiver"
                                                            ));
                NUnit.Framework.Assert.AreEqual("ret:0, Removed trace span receiver 1" + Newline,
                                                RunTraceCommand(trace, "-remove", "1", "-host", GetHostPortForNN(cluster)));
                NUnit.Framework.Assert.AreEqual("ret:0, [no span receivers found]" + Newline, RunTraceCommand
                                                    (trace, "-list", "-host", GetHostPortForNN(cluster)));
                NUnit.Framework.Assert.AreEqual("ret:0, Added trace span receiver 2 with " + "configuration local-file-span-receiver.path = "
                                                + tracePath + Newline, RunTraceCommand(trace, "-add", "-host", GetHostPortForNN
                                                                                           (cluster), "-class", "LocalFileSpanReceiver", "-Clocal-file-span-receiver.path="
                                                                                       + tracePath));
                NUnit.Framework.Assert.AreEqual("ret:0, Removed trace span receiver 2" + Newline,
                                                RunTraceCommand(trace, "-remove", "2", "-host", GetHostPortForNN(cluster)));
            }
            finally
            {
                cluster.Shutdown();
                tempDir.Close();
            }
        }