/// <summary>
        /// Create a new rock_jmeter object.
        /// </summary>
        /// <param name="id">Initial value of the id property.</param>
        /// <param name="recordTimeStamp">Initial value of the RecordTimeStamp property.</param>
        /// <param name="appName">Initial value of the AppName property.</param>
        public static rock_jmeter Createrock_jmeter(global::System.Int32 id, global::System.DateTimeOffset recordTimeStamp, global::System.String appName)
        {
            rock_jmeter rock_jmeter = new rock_jmeter();

            rock_jmeter.id = id;
            rock_jmeter.RecordTimeStamp = recordTimeStamp;
            rock_jmeter.AppName         = appName;
            return(rock_jmeter);
        }
Example #2
0
        private string SaveJMeterOutputDataToDb(string jMeterInputFileUrl)
        {
            // Save JMeter output data to db
            using (rockEntities entities = new rockEntities())
            {

                JMeterOutputFileParser parser = new JMeterOutputFileParser(_jmeterOutputFile);

                // Get all the httpSample data from the JMeter output file, save them to database
              int numInSameSeq = 0;
                foreach (var httpSample in parser.GetHttpSamples())
                {
                    // Jemter has a bug that sometimes will store empty responseData

                    numInSameSeq++;
                    var newRecord = new rock_jmeter();
                    if (httpSample.AssertionResult != null)
                    {
                        newRecord.AssertionResult_Error = httpSample.AssertionResult.Error;
                        newRecord.AssertionResult_Failure = httpSample.AssertionResult.Failure;
                        newRecord.AssertionResult_Name = httpSample.AssertionResult.Name;
                    }
                    FileInfo fi = new FileInfo(jMeterInputFileUrl);
                    newRecord.numInSameSeq = numInSameSeq;
                    newRecord.JmxFileName = fi.Name;
                    newRecord.exeUser = _userName;
                    newRecord.CGIName = httpSample.CGIName;
                    newRecord.Cookies = httpSample.Cookies;
                    newRecord.Method = httpSample.Method;
                    newRecord.QueryString = httpSample.QueryString;
                    newRecord.RequestHeader = httpSample.RequestHeader;
                    newRecord.ResponseData = httpSample.ResponseData;
                    newRecord.ResponseHeader = httpSample.ResponseHeader;
                    newRecord.ResponseTime = int.Parse(httpSample.ResponseTime);
                    int returnCode = -1;
                    int.TryParse(httpSample.ReturnCode, out returnCode);
                    newRecord.ReturnCode = returnCode;
                    newRecord.Url = httpSample.Url;
                    newRecord.RecordTimeStamp = new DateTimeOffset(DateTime.Now);
                    newRecord.ThreadName = httpSample.ThreadName;
                    newRecord.ParentCGIName = httpSample.ParentCGIName;
                    newRecord.AppName = this._appName;
                    newRecord.SeqNum = _batchSeqNum;
                    StringBuilder sbForIp = new StringBuilder();
                    IPAddress[] localIPs = Dns.GetHostAddresses(Dns.GetHostName());

                    foreach (IPAddress addr in localIPs)
                    {
                        sbForIp.Append(addr);
                        sbForIp.AppendLine();
                    }
                    newRecord.TestMachineIP = sbForIp.ToString();

                        entities.AddTorock_jmeter(newRecord);

                }
                // start saving

                    entities.SaveChanges();

                // save done
            }
            return _batchSeqNum;
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the rock_jmeter EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTorock_jmeter(rock_jmeter rock_jmeter)
 {
     base.AddObject("rock_jmeter", rock_jmeter);
 }
 /// <summary>
 /// Create a new rock_jmeter object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="recordTimeStamp">Initial value of the RecordTimeStamp property.</param>
 /// <param name="appName">Initial value of the AppName property.</param>
 public static rock_jmeter Createrock_jmeter(global::System.Int32 id, global::System.DateTimeOffset recordTimeStamp, global::System.String appName)
 {
     rock_jmeter rock_jmeter = new rock_jmeter();
     rock_jmeter.id = id;
     rock_jmeter.RecordTimeStamp = recordTimeStamp;
     rock_jmeter.AppName = appName;
     return rock_jmeter;
 }
Example #5
0
        private string SaveJMeterOutputDataToDb(string jMeterInputFileUrl)
        {
            // Save JMeter output data to db
            using (rockEntities entities = new rockEntities())
            {
                JMeterOutputFileParser parser = new JMeterOutputFileParser(_jmeterOutputFile);

                // Get all the httpSample data from the JMeter output file, save them to database
                int numInSameSeq = 0;
                foreach (var httpSample in parser.GetHttpSamples())
                {
                    // Jemter has a bug that sometimes will store empty responseData


                    numInSameSeq++;
                    var newRecord = new rock_jmeter();
                    if (httpSample.AssertionResult != null)
                    {
                        newRecord.AssertionResult_Error   = httpSample.AssertionResult.Error;
                        newRecord.AssertionResult_Failure = httpSample.AssertionResult.Failure;
                        newRecord.AssertionResult_Name    = httpSample.AssertionResult.Name;
                    }
                    FileInfo fi = new FileInfo(jMeterInputFileUrl);
                    newRecord.numInSameSeq   = numInSameSeq;
                    newRecord.JmxFileName    = fi.Name;
                    newRecord.exeUser        = _userName;
                    newRecord.CGIName        = httpSample.CGIName;
                    newRecord.Cookies        = httpSample.Cookies;
                    newRecord.Method         = httpSample.Method;
                    newRecord.QueryString    = httpSample.QueryString;
                    newRecord.RequestHeader  = httpSample.RequestHeader;
                    newRecord.ResponseData   = httpSample.ResponseData;
                    newRecord.ResponseHeader = httpSample.ResponseHeader;
                    newRecord.ResponseTime   = int.Parse(httpSample.ResponseTime);
                    int returnCode = -1;
                    int.TryParse(httpSample.ReturnCode, out returnCode);
                    newRecord.ReturnCode      = returnCode;
                    newRecord.Url             = httpSample.Url;
                    newRecord.RecordTimeStamp = new DateTimeOffset(DateTime.Now);
                    newRecord.ThreadName      = httpSample.ThreadName;
                    newRecord.ParentCGIName   = httpSample.ParentCGIName;
                    newRecord.AppName         = this._appName;
                    newRecord.SeqNum          = _batchSeqNum;
                    StringBuilder sbForIp  = new StringBuilder();
                    IPAddress[]   localIPs = Dns.GetHostAddresses(Dns.GetHostName());

                    foreach (IPAddress addr in localIPs)
                    {
                        sbForIp.Append(addr);
                        sbForIp.AppendLine();
                    }
                    newRecord.TestMachineIP = sbForIp.ToString();


                    entities.AddTorock_jmeter(newRecord);
                }
                // start saving

                entities.SaveChanges();

                // save done
            }
            return(_batchSeqNum);
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the rock_jmeter EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTorock_jmeter(rock_jmeter rock_jmeter)
 {
     base.AddObject("rock_jmeter", rock_jmeter);
 }