1
0
Fork 0

test fixes

This commit is contained in:
Jan Steemann 2016-03-21 18:25:48 +01:00
parent 31d9c1873a
commit 3da00d24ea
3 changed files with 18 additions and 15 deletions

View File

@ -19,6 +19,9 @@ Overview
5. Query-parameters "policy" and "rev" withdrawn in replace()/update() 5. Query-parameters "policy" and "rev" withdrawn in replace()/update()
6. /_api/edge withdrawn 6. /_api/edge withdrawn
use /_api/document instead
Attributes `_from` and `_to` for edges must be passed inside the
document body and not as URL parameters `from` and `to`
7. <collection>.BY_EXAMPLE_HASH , <collection>.BY_EXAMPLE_SKIPLIST, 7. <collection>.BY_EXAMPLE_HASH , <collection>.BY_EXAMPLE_SKIPLIST,
<collection>.BY_CONDITION_SKIPLIST deleted. <collection>.BY_CONDITION_SKIPLIST deleted.

View File

@ -110,8 +110,8 @@ describe ArangoDB do
id2 = doc.parsed_response['_id'] id2 = doc.parsed_response['_id']
# create edge # create edge
cmd = "/_api/edge?collection=#{@ce}&from=#{id1}&to=#{id2}" cmd = "/_api/document?collection=#{@ce}"
body = "{}" body = "{\"_from\":\"#{id1}\",\"_to\":\"#{id2}\"}"
doc = ArangoDB.log_post("#{prefix}-create-edge", cmd, :body => body) doc = ArangoDB.log_post("#{prefix}-create-edge", cmd, :body => body)
doc.code.should eq(201) doc.code.should eq(201)
@ -123,7 +123,7 @@ describe ArangoDB do
id3 = doc.parsed_response['_id'] id3 = doc.parsed_response['_id']
# check edge # check edge
cmd = "/_api/edge/#{id3}" cmd = "/_api/document/#{id3}"
doc = ArangoDB.log_get("#{prefix}-read-edge", cmd) doc = ArangoDB.log_get("#{prefix}-read-edge", cmd)
doc.code.should eq(200) doc.code.should eq(200)
@ -133,8 +133,8 @@ describe ArangoDB do
doc.headers['content-type'].should eq("application/json; charset=utf-8") doc.headers['content-type'].should eq("application/json; charset=utf-8")
# create another edge # create another edge
cmd = "/_api/edge?collection=#{@ce}&from=#{id1}&to=#{id2}" cmd = "/_api/document?collection=#{@ce}"
body = "{ \"e\" : 1 }" body = "{ \"e\" : 1, \"_from\" : \"#{id1}\", \"_to\": \"#{id2}\" }"
doc = ArangoDB.log_post("#{prefix}-create-edge", cmd, :body => body) doc = ArangoDB.log_post("#{prefix}-create-edge", cmd, :body => body)
doc.code.should eq(201) doc.code.should eq(201)
@ -144,7 +144,7 @@ describe ArangoDB do
id4 = doc.parsed_response['_id'] id4 = doc.parsed_response['_id']
# check edge # check edge
cmd = "/_api/edge/#{id4}" cmd = "/_api/document/#{id4}"
doc = ArangoDB.log_get("#{prefix}-read-edge", cmd) doc = ArangoDB.log_get("#{prefix}-read-edge", cmd)
doc.code.should eq(200) doc.code.should eq(200)
@ -161,8 +161,8 @@ describe ArangoDB do
doc.headers['content-type'].should eq("application/json; charset=utf-8") doc.headers['content-type'].should eq("application/json; charset=utf-8")
# create third edge # create third edge
cmd = "/_api/edge?collection=#{@ce}&from=#{id2}&to=#{id1}" cmd = "/_api/document?collection=#{@ce}"
body = "{ \"e\" : 2 }" body = "{ \"e\" : 2, \"_from\" : \"#{id2}\", \"_to\" : \"#{id1}\" }"
doc = ArangoDB.log_post("#{prefix}-create-edge", cmd, :body => body) doc = ArangoDB.log_post("#{prefix}-create-edge", cmd, :body => body)
doc.code.should eq(201) doc.code.should eq(201)
@ -174,7 +174,7 @@ describe ArangoDB do
id5 = doc.parsed_response['_id'] id5 = doc.parsed_response['_id']
# check edge # check edge
cmd = "/_api/edge/#{id5}" cmd = "/_api/document/#{id5}"
doc = ArangoDB.log_get("#{prefix}-read-edge", cmd) doc = ArangoDB.log_get("#{prefix}-read-edge", cmd)
doc.code.should eq(200) doc.code.should eq(200)

View File

@ -99,12 +99,12 @@ HttpHandler::status_t RestBatchHandler::execute() {
size_t const partLength = helper.foundLength; size_t const partLength = helper.foundLength;
char const* headerStart = partStart; char const* headerStart = partStart;
char* bodyStart = nullptr; char const* bodyStart = nullptr;
size_t headerLength = 0; size_t headerLength = 0;
size_t bodyLength = 0; size_t bodyLength = 0;
// assume Windows linebreak \r\n\r\n as delimiter // assume Windows linebreak \r\n\r\n as delimiter
char* p = strstr((char*)headerStart, "\r\n\r\n"); char const* p = strstr(headerStart, "\r\n\r\n");
if (p != nullptr && p + 4 <= partEnd) { if (p != nullptr && p + 4 <= partEnd) {
headerLength = p - partStart; headerLength = p - partStart;
@ -112,7 +112,7 @@ HttpHandler::status_t RestBatchHandler::execute() {
bodyLength = partEnd - bodyStart; bodyLength = partEnd - bodyStart;
} else { } else {
// test Unix linebreak // test Unix linebreak
p = strstr((char*)headerStart, "\n\n"); p = strstr(headerStart, "\n\n");
if (p != nullptr && p + 2 <= partEnd) { if (p != nullptr && p + 2 <= partEnd) {
headerLength = p - partStart; headerLength = p - partStart;
@ -149,14 +149,14 @@ HttpHandler::status_t RestBatchHandler::execute() {
request->setBody(bodyStart, bodyLength); request->setBody(bodyStart, bodyLength);
} }
if (authorization.size()) { if (!authorization.empty()) {
// inject Authorization header of multipart message into part message // inject Authorization header of multipart message into part message
request->setHeader("authorization", 13, authorization.c_str()); request->setHeader("authorization", 13, authorization.c_str());
} }
HttpHandler* handler = _server->createHandler(request); HttpHandler* handler = _server->createHandler(request);
if (!handler) { if (handler == nullptr) {
delete request; delete request;
generateError(HttpResponse::BAD, TRI_ERROR_INTERNAL, generateError(HttpResponse::BAD, TRI_ERROR_INTERNAL,
@ -186,7 +186,7 @@ HttpHandler::status_t RestBatchHandler::execute() {
return status_t(HttpHandler::HANDLER_FAILED); return status_t(HttpHandler::HANDLER_FAILED);
} }
const HttpResponse::HttpResponseCode code = partResponse->responseCode(); HttpResponse::HttpResponseCode const code = partResponse->responseCode();
// count everything above 400 as error // count everything above 400 as error
if (code >= 400) { if (code >= 400) {