From f4e8c8cf9c1b732031d35a990328dfc9a5623e81 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Tue, 25 Sep 2012 11:52:12 +0200 Subject: [PATCH] added test case --- arangosh/V8Client/arangob.cpp | 124 +++++++++++++++++++++++++--------- 1 file changed, 92 insertions(+), 32 deletions(-) diff --git a/arangosh/V8Client/arangob.cpp b/arangosh/V8Client/arangob.cpp index 60b659abaa..c10b028e25 100644 --- a/arangosh/V8Client/arangob.cpp +++ b/arangosh/V8Client/arangob.cpp @@ -55,6 +55,97 @@ using namespace triagens::rest; using namespace triagens::v8client; using namespace triagens::arango; +// ----------------------------------------------------------------------------- +// --SECTION-- benchmark test cases +// ----------------------------------------------------------------------------- + +// ----------------------------------------------------------------------------- +// --SECTION-- version retrieval test +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup V8Shell +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +struct VersionTest : public BenchmarkOperation { + VersionTest () + : BenchmarkOperation () { + } + + ~VersionTest () { + } + + const string& url () { + static string url = "/_api/version"; + + return url; + } + + const HttpRequest::HttpRequestType type () { + return HttpRequest::HTTP_REQUEST_GET; + } + + const char* payload (size_t* length) { + static const char* payload = ""; + *length = 0; + return payload; + } + + const map& headers () { + static const map headers; + return headers; + } +}; + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + +// ----------------------------------------------------------------------------- +// --SECTION-- document creation test +// ----------------------------------------------------------------------------- + +//////////////////////////////////////////////////////////////////////////////// +/// @addtogroup V8Shell +/// @{ +//////////////////////////////////////////////////////////////////////////////// + +struct SmallDocumentCreationTest : public BenchmarkOperation { + SmallDocumentCreationTest () + : BenchmarkOperation () { + } + + ~SmallDocumentCreationTest () { + } + + const string& url () { + static string url = "/_api/document?collection=ArangoBenchmark&createCollection=true"; + + return url; + } + + const HttpRequest::HttpRequestType type () { + return HttpRequest::HTTP_REQUEST_POST; + } + + const char* payload (size_t* length) { + static const char* payload = "{\"test\":1}"; + *length = 10; + return payload; + } + + const map& headers () { + static const map headers; + return headers; + } +}; + +//////////////////////////////////////////////////////////////////////////////// +/// @} +//////////////////////////////////////////////////////////////////////////////// + + // ----------------------------------------------------------------------------- // --SECTION-- private variables // ----------------------------------------------------------------------------- @@ -92,37 +183,6 @@ static int BatchSize = 0; /// @} //////////////////////////////////////////////////////////////////////////////// - -struct VersionTest : public BenchmarkOperation { - VersionTest () - : BenchmarkOperation () { - } - - ~VersionTest () { - } - - const string& url () { - static string url = "/_api/version"; - - return url; - } - - const HttpRequest::HttpRequestType type () { - return HttpRequest::HTTP_REQUEST_GET; - } - - const char* payload (size_t* length) { - static const char* payload = ""; - *length = 0; - return payload; - } - - const map& headers () { - static const map headers; - return headers; - } -}; - // ----------------------------------------------------------------------------- // --SECTION-- private functions // ----------------------------------------------------------------------------- @@ -201,7 +261,7 @@ int main (int argc, char* argv[]) { BenchmarkCounter operationsCounter(0, (unsigned long) Operations); ConditionVariable startCondition; - VersionTest benchmarkOperation; + SmallDocumentCreationTest benchmarkOperation; vector endpoints; vector threads;