Ejemplo n.º 1
0
 public static void GenerateMethodMap()
 {
     Mil = new MethodInclusion();
     string line;
     System.Configuration.AppSettingsReader r = new System.Configuration.AppSettingsReader();
     string path = (string)r.GetValue("MethodInclusionList", typeof(String));
     // Read the file and display it line by line.
     System.IO.StreamReader file = new System.IO.StreamReader(path);
     while ((line = file.ReadLine()) != null)
     {
         Mil.list.Add(line, line);
     }
     file.Close();
     //read a file which contains information on what to apply
     //the file will be a key and values list, method name, followed by sleep time,
     //a boolean to throw method exceptions or not and a bool to hold onto a unmanaged reference
     Type myType = (typeof(RentalServiceClient));
     // Get the public methods.
     sim = new Sim();
     MethodInfo[] myArrayMethodInfo = myType.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);
     // initialise methods
     foreach (MethodInfo methodInfo in myArrayMethodInfo)
     {
         SimulationAction sa = new SimulationAction();
         sa.methodname = methodInfo.Name;
         sa.consumeheap = false;
         sa.sleep = 1;
         sa.throwException = false;
         sa.consumecpu = false;
         if (Mil.list.ContainsKey(methodInfo.Name))
         {
             sim.methodSimulationMap.Add(sa);
         }
     }
 }
Ejemplo n.º 2
0
        public static void GenerateMethodMap()
        {
            Mil = new MethodInclusion();
            string line;

            System.Configuration.AppSettingsReader r = new System.Configuration.AppSettingsReader();
            string path = (string)r.GetValue("MethodInclusionList", typeof(String));

            // Read the file and display it line by line.
            System.IO.StreamReader file = new System.IO.StreamReader(path);
            while ((line = file.ReadLine()) != null)
            {
                Mil.list.Add(line, line);
            }
            file.Close();
            //read a file which contains information on what to apply
            //the file will be a key and values list, method name, followed by sleep time,
            //a boolean to throw method exceptions or not and a bool to hold onto a unmanaged reference
            Type myType = (typeof(RentalServiceClient));

            // Get the public methods.
            sim = new Sim();
            MethodInfo[] myArrayMethodInfo = myType.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);
            // initialise methods
            foreach (MethodInfo methodInfo in myArrayMethodInfo)
            {
                SimulationAction sa = new SimulationAction();
                sa.methodname     = methodInfo.Name;
                sa.consumeheap    = false;
                sa.sleep          = 1;
                sa.throwException = false;
                sa.consumecpu     = false;
                if (Mil.list.ContainsKey(methodInfo.Name))
                {
                    sim.methodSimulationMap.Add(sa);
                }
            }
        }