コード例 #1
0
ファイル: AllTests.cs プロジェクト: 2008hatake/zeroc-ice
 getServerConnectionMetrics(IceMX.MetricsAdminPrx metrics, long expected)
 {
     try
     {
         IceMX.ConnectionMetrics s;
         long timestamp;
         s = (IceMX.ConnectionMetrics)metrics.getMetricsView("View", out timestamp)["Connection"][0];
         int nRetry = 30;
         while(s.sentBytes != expected && nRetry-- > 0)
         {
             // On some platforms, it's necessary to wait a little before obtaining the server metrics
             // to get an accurate sentBytes metric. The sentBytes metric is updated before the response
             // to the operation is sent and getMetricsView can be dispatched before the metric is really
             // updated.
             System.Threading.Thread.Sleep(100);
             s = (IceMX.ConnectionMetrics)metrics.getMetricsView("View", out timestamp)["Connection"][0];
         }
         return s;
     }
     catch(IceMX.UnknownMetricsView)
     {
         Debug.Assert(false);
         return null;
     }
 }
コード例 #2
0
ファイル: AllTests.cs プロジェクト: 2008hatake/zeroc-ice
 waitForCurrent(IceMX.MetricsAdminPrx metrics, string viewName, string map, int value)
 {
     while(true)
     {
         long timestamp;
         Dictionary<string, IceMX.Metrics[]> view = metrics.getMetricsView(viewName, out timestamp);
         test(view.ContainsKey(map));
         bool ok = true;
         foreach(IceMX.Metrics m in view[map])
         {
             if(m.current != value)
             {
                 ok = false;
                 break;
             }
         }
         if(ok)
         {
             break;
         }
         System.Threading.Thread.Sleep(50);
     }
 }
コード例 #3
0
ファイル: AllTests.cs プロジェクト: zhangwei5095/ice
    static void testAttribute(IceMX.MetricsAdminPrx metrics,
                  Ice.PropertiesAdminPrx props,
                  UpdateCallbackI update,
                  string map,
                  string attr,
                  string value,
                  System.Action func)
    {
        Dictionary<string, string> dict = new Dictionary<string, string>();
        dict.Add("IceMX.Metrics.View.Map." + map + ".GroupBy", attr);
        if(props.ice_getIdentity().category.Equals("client"))
        {
            props.setProperties(getClientProps(props, dict, map));
            update.waitForUpdate();
        }
        else
        {
            props.setProperties(getServerProps(props, dict, map));
            props.setProperties(new Dictionary<string, string>());
        }

        func();
        long timestamp;
        Dictionary<string, IceMX.Metrics[]> view = metrics.getMetricsView("View", out timestamp);
        if(!view.ContainsKey(map) || view[map].Length == 0)
        {
            if(value.Length > 0)
            {
                WriteLine("no map `" + map + "' for group by = `" + attr + "'");
                test(false);
            }
        }
        else if(!view[map][0].id.Equals(value))
        {
            WriteLine("invalid attribute value: " + attr + " = " + value + " got " + view[map][0].id);
            test(false);
        }

        dict.Clear();
        if(props.ice_getIdentity().category.Equals("client"))
        {
            props.setProperties(getClientProps(props, dict, map));
            update.waitForUpdate();
        }
        else
        {
            props.setProperties(getServerProps(props, dict, map));
            props.setProperties(new Dictionary<string, string>());
        }
    }