Esempio n. 1
0
        public virtual void TestNameNode()
        {
            int numDatanodes = 2;

            cluster = new MiniDFSCluster.Builder(config).NumDataNodes(numDatanodes).Build();
            cluster.WaitActive();
            WriteFile(cluster.GetFileSystem(), new Path("/test1"), 2);
            JMXGet jmx         = new JMXGet();
            string serviceName = "NameNode";

            jmx.SetService(serviceName);
            jmx.Init();
            // default lists namenode mbeans only
            NUnit.Framework.Assert.IsTrue("error printAllValues", CheckPrintAllValues(jmx));
            //get some data from different source
            NUnit.Framework.Assert.AreEqual(numDatanodes, System.Convert.ToInt32(jmx.GetValue
                                                                                     ("NumLiveDataNodes")));
            MetricsAsserts.AssertGauge("CorruptBlocks", long.Parse(jmx.GetValue("CorruptBlocks"
                                                                                )), MetricsAsserts.GetMetrics("FSNamesystem"));
            NUnit.Framework.Assert.AreEqual(numDatanodes, System.Convert.ToInt32(jmx.GetValue
                                                                                     ("NumOpenConnections")));
            cluster.Shutdown();
            MBeanServerConnection    mbsc  = ManagementFactory.GetPlatformMBeanServer();
            ObjectName               query = new ObjectName("Hadoop:service=" + serviceName + ",*");
            ICollection <ObjectName> names = mbsc.QueryNames(query, null);

            NUnit.Framework.Assert.IsTrue("No beans should be registered for " + serviceName,
                                          names.IsEmpty());
        }
Esempio n. 2
0
        public virtual void TestDataNode()
        {
            int numDatanodes = 2;

            cluster = new MiniDFSCluster.Builder(config).NumDataNodes(numDatanodes).Build();
            cluster.WaitActive();
            WriteFile(cluster.GetFileSystem(), new Path("/test"), 2);
            JMXGet jmx         = new JMXGet();
            string serviceName = "DataNode";

            jmx.SetService(serviceName);
            jmx.Init();
            NUnit.Framework.Assert.AreEqual(fileSize, System.Convert.ToInt32(jmx.GetValue("BytesWritten"
                                                                                          )));
            cluster.Shutdown();
            MBeanServerConnection    mbsc  = ManagementFactory.GetPlatformMBeanServer();
            ObjectName               query = new ObjectName("Hadoop:service=" + serviceName + ",*");
            ICollection <ObjectName> names = mbsc.QueryNames(query, null);

            NUnit.Framework.Assert.IsTrue("No beans should be registered for " + serviceName,
                                          names.IsEmpty());
        }
Esempio n. 3
0
 /// <exception cref="System.Exception"/>
 protected internal void VerifyRamDiskJMXMetric(string metricName, long expectedValue
                                                )
 {
     NUnit.Framework.Assert.AreEqual(expectedValue, System.Convert.ToInt32(jmx.GetValue
                                                                               (metricName)));
 }