diff options
Diffstat (limited to 'src/bmclient/main.cpp')
-rw-r--r-- | src/bmclient/main.cpp | 113 |
1 files changed, 87 insertions, 26 deletions
diff --git a/src/bmclient/main.cpp b/src/bmclient/main.cpp index 0823d20..8c36a86 100644 --- a/src/bmclient/main.cpp +++ b/src/bmclient/main.cpp @@ -119,6 +119,9 @@ private: BMRequest * createASFStatsGetValuesRequest( const QStringList &args, QString *error, const QString &command = "asfstats get values") const; + BMRequest * createASFStatsGetValues2Request( + const QStringList &args, QString *error, + const QString &command = "asfstats get values2") const; mutable BMRequest::OutputFormat explicitOutputFormat; mutable bool useExplicitOutputFormat; BMRequest::OutputFormat outputFormat() const; @@ -798,15 +801,6 @@ BMRequest * Executor::createRequest(const QStringList &args, QString *error) con return createASFStatsGetValuesRequest(args, error); - // } else if ( - // (args.size() >= 3) && (args.at(0) == "asfstats") && (args.at(1) == "get") - // && (args.at(2) == "plot")) { - // // --- 'asfstats get plot' command --- - - // BMRequest *request = createASFStatsGetValuesRequest(args, error, "asfstats get plot"); - // setOutputFormat(BMRequest::Image); - // return request; - } else if ( (args.size() >= 3) && (args.at(0) == "asfstats") && (args.at(1) == "get") && (args.at(2) == "detailspage")) { @@ -817,6 +811,33 @@ BMRequest * Executor::createRequest(const QStringList &args, QString *error) con setOutputFormat(BMRequest::HTML); return request; + } else if ( + (args.size() >= 3) && (args.at(0) == "asfstats") && (args.at(1) == "get") + && (args.at(2) == "values2")) { + // --- 'asfstats get values2' command --- + + return createASFStatsGetValues2Request(args, error); + + } else if ( + (args.size() >= 3) && (args.at(0) == "asfstats") && (args.at(1) == "get") + && (args.at(2) == "detailspage2")) { + // --- 'asfstats get detailspage2' command --- + + BMRequest *request = + createASFStatsGetValues2Request(args, error, "asfstats get detailspage2"); + setOutputFormat(BMRequest::HTML); + return request; + + } else if ( + (args.size() >= 3) && (args.at(0) == "asfstats") && (args.at(1) == "get") + && (args.at(2) == "plot2")) { + // --- 'asfstats get plot2' command --- + + BMRequest *request = + createASFStatsGetValues2Request(args, error, "asfstats get plot2"); + setOutputFormat(BMRequest::Image); + return request; + } else if ((args.size() >= 2) && (args.at(0) == "get") && (args.at(1) == "detailspage")) { // --- 'get detailspage' command --- @@ -915,21 +936,10 @@ BMRequest * Executor::createGetHistoryRequest(const QStringList &args, QString * currTimestamp = -1; } - // Extract BM context ID (which overrides other values if specified) ... - int explicitBMContextId = -1; - if (BMMisc::getOption(args, "-bmcontextid", &values, 1, 0, error)) { - bool ok; - explicitBMContextId = values.at(0).toInt(&ok); - if ((!ok) || (explicitBMContextId < 0)) { - *error = "failed to extract stability tolerance as non-negative integer"; - return 0; - } - } - return new BMRequest_GetHistory( args.at(2), args.at(3), args.at(4), args.at(5), args.at(6), args.at(7), args.at(8), args.at(9), timeRange.first, timeRange.second, diffTolerance, - stabTolerance, maxSize, args.at(16), currTimestamp, explicitBMContextId); + stabTolerance, maxSize, args.at(16), currTimestamp); } BMRequest * Executor::createGetHistory2Request(const QStringList &args, QString *error) const @@ -1425,6 +1435,45 @@ BMRequest * Executor::createASFStatsGetValuesRequest( branchFilter, fromTimestamp, toTimestamp, diffTol, stabTol, sfTol, lfTol, maxLDTol); } +BMRequest * Executor::createASFStatsGetValues2Request( + const QStringList &args, QString *error, const QString &command) const +{ + Q_UNUSED(command); + + QStringList values; + + // Extract BM context ID ... + int bmcontextId = -1; + if (BMMisc::getOption(args, "-bmcontextid", &values, 1, 0, error)) { + bool ok; + bmcontextId = values.at(0).toInt(&ok); + if ((!ok) || (bmcontextId < 0)) { + *error = "failed to extract BM context ID as a non-negative integer"; + return 0; + } + } else { + if (error->isEmpty()) + *error = "-bmcontextid option not found"; + return 0; + } + + // Get cache key ... + QString cacheKey; + if (BMMisc::getOption(args, "-cachekey", &values, 1, 0, error)) { + cacheKey = values.at(0).trimmed(); + bool ok; + cacheKey.toInt(&ok); + if (!ok) { + *error = "failed to extract cache key as an integer"; + return 0; + } + } else if (!error->isEmpty()) { + return 0; + } + + return new BMRequest_ASFStatsGetValues2(bmcontextId, cacheKey); +} + // ### 2 B DOCUMENTED! static void splitQuotedArgs(const QString &arg_s, QStringList *args) { @@ -1730,7 +1779,7 @@ class DirectExecutor : public Executor << "get history <test case> <test function> <data tag> <metric> " - "<platform> <host> <git repo> <git branch> \\\n" + " <platform> <host> <git repo> <git branch> \\\n" " -timerange <from> <to> \\\n" " <difference tolerance> <stability tolerance> <max size> \\\n" " <style sheet> <current Unix timestamp>\n" @@ -1795,7 +1844,7 @@ class DirectExecutor : public Executor << "index get plot <SAME AS 'index get values' except that the optional \\\n" - " -httpHeader and -cachekey options are recognized>\n" + " -httpheader and -cachekey options are recognized>\n" << "index get detailspage <SAME AS 'index get plot'> except that the mandatory \\\n" @@ -1822,7 +1871,7 @@ class DirectExecutor : public Executor << "get histories plot <SAME AS 'get histories' except that the optional \\\n" - " -httpHeader and -cachekey options are recognized>\n" + " -httpheader and -cachekey options are recognized>\n" << "get histories detailspage <SAME AS 'get histories'> except that the mandatory \\\n" @@ -1838,7 +1887,7 @@ class DirectExecutor : public Executor << "get ixhistories plot <SAME AS 'get ixhistories' except that the optional \\\n" - " -httpHeader and -cachekey options are recognized>\n" + " -httpheader and -cachekey options are recognized>\n" << "get ixhistories detailspage <SAME AS 'get ixhistories'> except that the mandatory \\\n" @@ -1854,9 +1903,21 @@ class DirectExecutor : public Executor << "asfstats get detailspage <SAME AS 'asfstats get values'> except that the \\\n" - " optional -httpHeader and -cachekey options, and the mandatory \\\n" + " optional -httpheader and -cachekey options, and the mandatory \\\n" " -stylesheet option are recognized\n" + << + "asfstats get values2 -bmcontextid <...>\n" + + << + "asfstats get plot2 <SAME AS 'asfstats get detailspage2' except that the optional \\\n" + " -httpheader and -cachekey options are recognized>\n" + + << + "asfstats get detailspage2 <SAME AS 'asfstats get values2'> except that the \\\n" + " mandatory -medianwinsize, -fromtime, -totime, and -stylesheet options are \\\n" + " recognized\n" + ; qDebug() << "\nNote: the -server option may be replaced by a BMSERVER=<host>:<port> " |