From 545b87cb76eed4f8ac7a59ed1ed5e5e5ecaafa74 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Wed, 6 Apr 2016 17:39:24 +0200 Subject: [PATCH] test fixes --- UnitTests/HttpInterface/api-documents-spec.rb | 8 +++----- arangod/RestHandler/RestDocumentHandler.cpp | 4 ++-- arangod/V8Server/v8-query.cpp | 8 ++++---- arangod/VocBase/collection.cpp | 6 ++---- 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/UnitTests/HttpInterface/api-documents-spec.rb b/UnitTests/HttpInterface/api-documents-spec.rb index fba8d0092c..ea437eee6c 100644 --- a/UnitTests/HttpInterface/api-documents-spec.rb +++ b/UnitTests/HttpInterface/api-documents-spec.rb @@ -29,12 +29,10 @@ describe ArangoDB do body = "[ [] ]"; doc = ArangoDB.log_post("#{prefix}-create-list1", cmd, :body => body) - doc.code.should eq(400) + doc.code.should eq(202) doc.headers['content-type'].should eq("application/json; charset=utf-8") - - doc.parsed_response['error'].should eq(true) - doc.parsed_response['code'].should eq(400) - doc.parsed_response['errorNum'].should eq(1227) + doc.parsed_response[0]["error"].should eq(true) + doc.parsed_response[0]["errorNum"].should eq(1227) end it "creates a document with an invalid type" do diff --git a/arangod/RestHandler/RestDocumentHandler.cpp b/arangod/RestHandler/RestDocumentHandler.cpp index f0a64788ba..8b110c03fd 100644 --- a/arangod/RestHandler/RestDocumentHandler.cpp +++ b/arangod/RestHandler/RestDocumentHandler.cpp @@ -121,8 +121,8 @@ bool RestDocumentHandler::createDocument() { SingleCollectionTransaction trx(transactionContext, collectionName, TRI_TRANSACTION_WRITE); VPackSlice body = parsedBody->slice(); - bool isMultiple = body.isArray(); - if (!body.isArray()) { + bool const isMultiple = body.isArray(); + if (!isMultiple) { trx.addHint(TRI_TRANSACTION_HINT_SINGLE_OPERATION, false); } diff --git a/arangod/V8Server/v8-query.cpp b/arangod/V8Server/v8-query.cpp index af38a187d1..d95d169815 100644 --- a/arangod/V8Server/v8-query.cpp +++ b/arangod/V8Server/v8-query.cpp @@ -368,7 +368,7 @@ static void JS_ChecksumCollection( TRI_document_collection_t* document = trx.documentCollection(); std::string const revisionId = std::to_string(document->_info.revision()); uint64_t hash = 0; - + trx.invokeOnAllElements(col->_name, [&hash, &withData, &withRevisions](TRI_doc_mptr_t const* mptr) { VPackSlice const slice(mptr->vpack()); @@ -398,10 +398,10 @@ static void JS_ChecksumCollection( } localHash ^= it.key.hash(seed) ^ 0xba5befd00d; - localHash ^= it.value.normalizedHash(seed) ^ 0xf00ba44ba5; + localHash += it.value.normalizedHash(seed) ^ 0xd4129f526421; } } - + hash ^= localHash; return true; }); @@ -413,7 +413,7 @@ static void JS_ChecksumCollection( v8::Handle result = v8::Object::New(isolate); result->Set(TRI_V8_ASCII_STRING("checksum"), TRI_V8_STD_STRING(hashString)); result->Set(TRI_V8_ASCII_STRING("revision"), TRI_V8_STD_STRING(revisionId)); - + TRI_V8_RETURN(result); TRI_V8_TRY_CATCH_END } diff --git a/arangod/VocBase/collection.cpp b/arangod/VocBase/collection.cpp index 792ebab253..7f31ae96c8 100644 --- a/arangod/VocBase/collection.cpp +++ b/arangod/VocBase/collection.cpp @@ -480,8 +480,6 @@ static bool CheckCollection(TRI_collection_t* collection, bool ignoreErrors) { // ............................................................................. if (extension == "db") { - TRI_col_header_marker_t* cm; - // found a compaction file. now rename it back if (filetype == "compaction") { std::string relName = "datafile-" + qualifier + "." + extension; @@ -530,11 +528,11 @@ static bool CheckCollection(TRI_collection_t* collection, bool ignoreErrors) { all.emplace_back(datafile); // check the document header - char* ptr = datafile->_data; + char const* ptr = datafile->_data; // skip the datafile header ptr += DatafileHelper::AlignedSize(sizeof(TRI_df_header_marker_t)); - cm = (TRI_col_header_marker_t*)ptr; + TRI_col_header_marker_t const* cm = reinterpret_cast(ptr); if (cm->base.getType() != TRI_DF_MARKER_COL_HEADER) { LOG(ERR) << "collection header mismatch in file '" << filename