Example #1
0
        //Fetches a single baseline based of deets
        public static IEnumerator FetchBaseline(ResultsIOData inputData, Action <ResultsIOData> outdata)
        {
            ResultsIOData data  = new ResultsIOData();//ResultsIOData to send back to resultsIO for local processing
            TableStrings  ts    = new TableStrings(inputData.suite, inputData.testType, true);
            string        table = TableStringToStrings(ts);

            data.suite    = inputData.suite;
            data.testType = inputData.testType;

            string platform = inputData.resultsRow[0].resultsColumn[inputData.fieldNames.FindIndex(x => x == "Platform")];
            string api      = inputData.resultsRow[0].resultsColumn[inputData.fieldNames.FindIndex(x => x == "API")];
            string group    = inputData.resultsRow[0].resultsColumn[inputData.fieldNames.FindIndex(x => x == "GroupName")];
            string test     = inputData.resultsRow[0].resultsColumn[inputData.fieldNames.FindIndex(x => x == "TestName")];
            //This line controls how baselines are selected, right now only Platform and API are unique
            string  query    = String.Format("SELECT * FROM {0} WHERE platform='{1}' AND api='{2}' AND groupname='{3}' AND testname='{4}'", table, platform, api, group, test);
            RawData _rawData = new RawData();

            IEnumerator i = SQLRequest(query, (value => { _rawData = value; }));

            while (i.MoveNext())
            {
                yield return(null);
            }

            data.fieldNames.AddRange(_rawData.fields);            //Grab the fields from the RawData
            for (int x = 0; x < _rawData.data.Count; x++)
            {
                ResultsIORow row = new ResultsIORow();        //create a new row
                row.resultsColumn.AddRange(_rawData.data[x]); //store the current row of values
                data.resultsRow.Add(row);                     //add it to the data to send back to resultsIO
            }
            outdata(data);
        }
Example #2
0
        public static IEnumerator FetchSpecificEntry(ResultsIOData inputData, Action <ResultsIOData> outdata)
        {
            //make request based off common
            string baseline = inputData.baseline == true ? "Baseline" : "Results";
            string table    = inputData.suite + "_" + inputData.testType + "_" + baseline;

            string values = ConvertToCondition(inputData.resultsRow[0].resultsColumn, inputData.fieldNames);

            string  query    = String.Format("SELECT * FROM {0} WHERE {1}", table, values);
            RawData _rawData = new RawData();

            IEnumerator i = SQLRequest(query, (value => { _rawData = value; }));

            while (i.MoveNext())
            {
                yield return(null);
            }

            inputData.fieldNames.Clear();
            inputData.resultsRow.Clear();
            inputData.fieldNames.AddRange(_rawData.fields);            //Grab the fields from the RawData
            for (int x = 0; x < _rawData.data.Count; x++)
            {
                ResultsIORow row = new ResultsIORow();        //create a new row
                row.resultsColumn.AddRange(_rawData.data[x]); //store the current row of values
                inputData.resultsRow.Add(row);                //add it to the data to send back to resultsIO
            }
            outdata(inputData);
        }
Example #3
0
        //fetch the server side baselines by providing the suites, pltform and API, later will have to change this to allow more strict baseline matching <TODO
        public IEnumerator FetchBaselines(string[] suiteNames, string platform, string api, Action <ResultsIOData[]> outdata)
        {
            List <ResultsIOData> data   = new List <ResultsIOData> ();        //ResultsIOData to send back to resultsIO for local processing
            List <string>        tables = new List <string>();

            //Get the table names to pull baselines from
            foreach (string suite in suiteNames)
            {
                RawData rawData = new RawData();                                                                                      //RawData to be filled by the wwwRequest
                StartCoroutine(SQLRequest(String.Format("SHOW TABLES LIKE '{0}%Baseline'", suite), (value => { rawData = value; }))); //Get all tables with the suite and ending with baseline
                while (rawData.data.Count == 0)
                {
                    yield return(null);
                }
                for (int t = 0; t < rawData.data.Count; t++)
                {
                    tables.Add(rawData.data[t][0]);                    //add the table name to the list of tables to pull
                }
            }
            int n = 0;

            foreach (string table in tables)
            {
                string suite    = table.Substring(0, table.IndexOf("_"));                                               //grab the suite from the table name
                string testType = table.Substring(table.IndexOf("_") + 1, table.LastIndexOf("_") - (suite.Length + 1)); //grab the test type from the table name
                data.Add(new ResultsIOData());
                data [n].suite    = suite;
                data [n].testType = testType;
                //This line controls how baselines are selected, right now only Platform and API are unique
                string  query    = String.Format("SELECT * FROM {0} WHERE platform='{1}' AND api='{2}'", table, platform, api);
                RawData _rawData = new RawData();
                StartCoroutine(SQLRequest(query, (value => { _rawData = value; })));
                while (_rawData.data.Count == 0)
                {
                    yield return(null);
                }
                data[n].fieldNames.AddRange(_rawData.fields);//Grab the fields from the RawData
                for (int i = 0; i < _rawData.data.Count; i++)
                {
                    ResultsIORow row = new ResultsIORow();        //create a new row
                    row.resultsColumn.AddRange(_rawData.data[i]); //store the current row of values
                    data[n].resultsRow.Add(row);                  //add it to the data to send back to resultsIO
                }
                if (data [n].fieldNames.Count == 0)
                {
                    data.RemoveAt(n);
                }
                n++;
            }
            outdata(data.ToArray());
        }
Example #4
0
        //Convert RawData class to ResultsIOData Class
        public static ResultsIOData ConvertRawDataToResultsIOData(string suite, string testType, RawData data, bool baseline)
        {
            ResultsIOData outData = new ResultsIOData();

            outData.suite      = suite;
            outData.testType   = testType;
            outData.baseline   = baseline;
            outData.fieldNames = data.fields;
            for (int i = 0; i < data.data.Count; i++)
            {
                ResultsIORow row = new ResultsIORow();
                row.resultsColumn.AddRange(data.data[i]);
                outData.resultsRow.Add(row);
            }
            return(outData);
        }
Example #5
0
        //fetch the server side baselines by providing the suites, pltform and API, later will have to change this to allow more strict baseline matching <TODO
        public static IEnumerator FetchBaselines(Suite[] suites, string platform, string api, Action <ResultsIOData[]> outdata)
        {
            List <ResultsIOData> data   = new List <ResultsIOData> ();        //ResultsIOData to send back to resultsIO for local processing
            List <string>        tables = new List <string>();

            //Get the table names to pull baselines from
            foreach (Suite suite in suites)
            {
                string[]    tbls = null;
                IEnumerator i    = FetchBaseLineTables(suite.suiteName, (value => { tbls = value; }));
                while (i.MoveNext())
                {
                    yield return(null);
                }
                tables.AddRange(tbls);
            }
            int n = 0;

            foreach (string table in tables)
            {
                string suite    = table.Substring(0, table.IndexOf("_"));                                               //grab the suite from the table name
                string testType = table.Substring(table.IndexOf("_") + 1, table.LastIndexOf("_") - (suite.Length + 1)); //grab the test type from the table name
                data.Add(new ResultsIOData());
                data [n].suite    = suite;
                data [n].testType = testType;
                foreach (Group grp in SuiteManager.GetSuiteByName(suite).groups)
                {
                    ProgressScreen.Instance.SetState(true, ProgressType.CloudLoad, "Fetching Baselines\n" + data[n].suite + " | " + grp.groupName);
                    //This line controls how baselines are selected, right now only Platform and API are unique
                    string  query    = String.Format("SELECT * FROM {0} WHERE platform='{1}' AND api='{2}' AND groupname='{3}'", table, platform, api, grp.groupName);
                    RawData _rawData = new RawData();

                    IEnumerator i = SQLRequest(query, (value => { _rawData = value; }));
                    while (i.MoveNext())
                    {
                        yield return(null);
                    }

                    if (_rawData.fields.Count == 0 || _rawData.fields[0] == "Null")
                    {
                        continue;
                    }
                    else if (data[n].fieldNames.Count == 0)
                    {
                        data[n].fieldNames.AddRange(_rawData.fields);//Grab the fields from the RawData
                    }
                    for (int x = 0; x < _rawData.data.Count; x++)
                    {
                        ResultsIORow row = new ResultsIORow();        //create a new row
                        row.resultsColumn.AddRange(_rawData.data[x]); //store the current row of values
                        data[n].resultsRow.Add(row);                  //add it to the data to send back to resultsIO
                    }
                    if (data[n].fieldNames.Count == 0)
                    {
                        data.RemoveAt(n);
                    }
                }
                n++;
            }
            outdata(data.ToArray());
        }