Exemplo n.º 1
0
        public virtual void TestPresence()
        {
            JvmPauseMonitor pauseMonitor = new JvmPauseMonitor(new Configuration());
            JvmMetrics      jvmMetrics   = new JvmMetrics("test", "test");

            jvmMetrics.SetPauseMonitor(pauseMonitor);
            MetricsRecordBuilder rb = MetricsAsserts.GetMetrics(jvmMetrics);
            MetricsCollector     mc = rb.Parent();

            Org.Mockito.Mockito.Verify(mc).AddRecord(JvmMetricsInfo.JvmMetrics);
            Org.Mockito.Mockito.Verify(rb).Tag(MsInfo.ProcessName, "test");
            Org.Mockito.Mockito.Verify(rb).Tag(MsInfo.SessionId, "test");
            foreach (JvmMetricsInfo info in JvmMetricsInfo.Values())
            {
                if (info.ToString().StartsWith("Mem"))
                {
                    Org.Mockito.Mockito.Verify(rb).AddGauge(Eq(info), AnyFloat());
                }
                else
                {
                    if (info.ToString().StartsWith("Gc"))
                    {
                        Org.Mockito.Mockito.Verify(rb).AddCounter(Eq(info), AnyLong());
                    }
                    else
                    {
                        if (info.ToString().StartsWith("Threads"))
                        {
                            Org.Mockito.Mockito.Verify(rb).AddGauge(Eq(info), AnyInt());
                        }
                        else
                        {
                            if (info.ToString().StartsWith("Log"))
                            {
                                Org.Mockito.Mockito.Verify(rb).AddCounter(Eq(info), AnyLong());
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
 public virtual void SetPauseMonitor(JvmPauseMonitor pauseMonitor)
 {
     this.pauseMonitor = pauseMonitor;
 }