mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of github.com:triAGENS/ArangoDB into devel
This commit is contained in:
commit
5ca6bc159d
12
CHANGELOG
12
CHANGELOG
|
@ -1,6 +1,15 @@
|
|||
v1.5.0 (XXXX-XX-XX)
|
||||
-------------------
|
||||
|
||||
* issue #751: Create database through API should return HTTP status code 201
|
||||
|
||||
By default, the server now returns HTTP 201 (created) when creating a new
|
||||
database successfully. To keep compatibility with older ArangoDB versions, the
|
||||
startup parameter `--server.default-api-compatibility` can be set to a value
|
||||
of `10400` to indicate API compatibility with ArangoDB 1.4. The compatibility
|
||||
can also be enforced by setting the `X-Arango-Version` HTTP header in a
|
||||
client request to this API on a per-request basis.
|
||||
|
||||
* issue #748: add vertex filtering to AQL's TRAVERSAL[_TREE]() function
|
||||
|
||||
* allow direct access from the `db` object to collections whose names start
|
||||
|
@ -114,6 +123,9 @@ v1.5.0 (XXXX-XX-XX)
|
|||
result of <collection>.getIndexes() for each index. This is
|
||||
currently only implemented for hash indices and skiplist indices.
|
||||
|
||||
v1.4.8 (xxxx-xx-xx)
|
||||
-------------------
|
||||
|
||||
|
||||
v1.4.7 (2014-01-23)
|
||||
-------------------
|
||||
|
|
|
@ -66,12 +66,34 @@ describe ArangoDB do
|
|||
after do
|
||||
ArangoDB.delete(api + "/#{name}")
|
||||
end
|
||||
|
||||
it "creates a new database, old return code" do
|
||||
body = "{\"name\" : \"#{name}\" }"
|
||||
doc = ArangoDB.log_post("#{prefix}-create", api, :body => body, :headers => { "X-Arango-Version" => "1.4" })
|
||||
|
||||
doc.code.should eq(200)
|
||||
doc.headers['content-type'].should eq("application/json; charset=utf-8")
|
||||
response = doc.parsed_response
|
||||
response["result"].should eq(true)
|
||||
response["error"].should eq(false)
|
||||
end
|
||||
|
||||
it "creates a new database, new return code" do
|
||||
body = "{\"name\" : \"#{name}\" }"
|
||||
doc = ArangoDB.log_post("#{prefix}-create", api, :body => body, :headers => { "X-Arango-Version" => "1.5" })
|
||||
|
||||
doc.code.should eq(201)
|
||||
doc.headers['content-type'].should eq("application/json; charset=utf-8")
|
||||
response = doc.parsed_response
|
||||
response["result"].should eq(true)
|
||||
response["error"].should eq(false)
|
||||
end
|
||||
|
||||
it "creates a new database" do
|
||||
body = "{\"name\" : \"#{name}\" }"
|
||||
doc = ArangoDB.log_post("#{prefix}-create", api, :body => body)
|
||||
|
||||
doc.code.should eq(200)
|
||||
doc.code.should eq(201)
|
||||
doc.headers['content-type'].should eq("application/json; charset=utf-8")
|
||||
response = doc.parsed_response
|
||||
response["result"].should eq(true)
|
||||
|
@ -115,7 +137,7 @@ describe ArangoDB do
|
|||
body = "{\"name\" : \"#{name}\" }"
|
||||
doc = ArangoDB.log_post("#{prefix}-re-create", api, :body => body)
|
||||
|
||||
doc.code.should eq(200)
|
||||
doc.code.should eq(201)
|
||||
doc.headers['content-type'].should eq("application/json; charset=utf-8")
|
||||
|
||||
doc = ArangoDB.log_post("#{prefix}-post", api, :body => body)
|
||||
|
@ -132,7 +154,7 @@ describe ArangoDB do
|
|||
body = "{\"name\" : \"#{name}\" }"
|
||||
doc = ArangoDB.log_post("#{prefix}-drop", api, :body => body)
|
||||
|
||||
doc.code.should eq(200)
|
||||
doc.code.should eq(201)
|
||||
doc.headers['content-type'].should eq("application/json; charset=utf-8")
|
||||
|
||||
doc = ArangoDB.log_delete("#{prefix}-drop", cmd)
|
||||
|
@ -158,7 +180,7 @@ describe ArangoDB do
|
|||
body = "{\"name\" : \"#{name}\" }"
|
||||
doc = ArangoDB.log_post("#{prefix}-create-properties", api, :body => body)
|
||||
|
||||
doc.code.should eq(200)
|
||||
doc.code.should eq(201)
|
||||
doc.headers['content-type'].should eq("application/json; charset=utf-8")
|
||||
response = doc.parsed_response
|
||||
response["result"].should eq(true)
|
||||
|
@ -206,7 +228,7 @@ describe ArangoDB do
|
|||
body = "{\"name\" : \"#{name}\", \"users\": [ { \"username\": \"admin\", \"password\": \"secret\", \"extra\": { \"gender\": \"m\" } }, { \"username\": \"foxx\", \"active\": false } ] }"
|
||||
doc = ArangoDB.log_post("#{prefix}-create-users", api, :body => body)
|
||||
|
||||
doc.code.should eq(200)
|
||||
doc.code.should eq(201)
|
||||
doc.headers['content-type'].should eq("application/json; charset=utf-8")
|
||||
response = doc.parsed_response
|
||||
response["result"].should eq(true)
|
||||
|
@ -268,7 +290,7 @@ describe ArangoDB do
|
|||
body = "{\"name\" : \"#{name}\", \"users\": [ { \"username\": \"\" } ] }"
|
||||
doc = ArangoDB.log_post("#{prefix}-create-users-invalid", api, :body => body)
|
||||
|
||||
doc.code.should eq(200)
|
||||
doc.code.should eq(201)
|
||||
doc.headers['content-type'].should eq("application/json; charset=utf-8")
|
||||
response = doc.parsed_response
|
||||
response["result"].should eq(true)
|
||||
|
@ -305,7 +327,7 @@ describe ArangoDB do
|
|||
body = "{\"name\" : \"#{name}\" }"
|
||||
doc = ArangoDB.log_post("#{prefix}-check-system", api, :body => body)
|
||||
|
||||
doc.code.should eq(200)
|
||||
doc.code.should eq(201)
|
||||
doc.headers['content-type'].should eq("application/json; charset=utf-8")
|
||||
response = doc.parsed_response
|
||||
response["result"].should eq(true)
|
||||
|
|
|
@ -1424,6 +1424,27 @@ describe ArangoDB do
|
|||
doc.parsed_response['result'].count.should eq(4)
|
||||
end
|
||||
|
||||
it "checks list of vertices of a vertex with HAS and HAS_NOT compare" do
|
||||
|
||||
cmd = "/_api/graph/#{graph_name}/vertices"
|
||||
body = "{\"batchSize\" : 100, \"filter\" : { \"properties\" : [ { \"key\" : \"optional1\", \"compare\" : \"HAS\" } ] } }"
|
||||
doc = ArangoDB.log_post("#{prefix}", cmd, :body => body)
|
||||
doc.code.should eq(201)
|
||||
doc.parsed_response['error'].should eq(false)
|
||||
doc.parsed_response['code'].should eq(201)
|
||||
doc.parsed_response['result'].count.should eq(4)
|
||||
|
||||
|
||||
cmd = "/_api/graph/#{graph_name}/vertices"
|
||||
body = "{\"batchSize\" : 100, \"filter\" : { \"properties\" : [ { \"key\" : \"optional1\", \"compare\" : \"HAS_NOT\" } ] } }"
|
||||
doc = ArangoDB.log_post("#{prefix}", cmd, :body => body)
|
||||
doc.code.should eq(201)
|
||||
doc.parsed_response['error'].should eq(false)
|
||||
doc.parsed_response['code'].should eq(201)
|
||||
doc.parsed_response['result'].count.should eq(1)
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
################################################################################
|
||||
|
|
|
@ -240,7 +240,7 @@ function get_api_database (req, res) {
|
|||
///
|
||||
/// @RESTRETURNCODES
|
||||
///
|
||||
/// @RESTRETURNCODE{200}
|
||||
/// @RESTRETURNCODE{201}
|
||||
/// is returned if the database was created successfully.
|
||||
///
|
||||
/// @RESTRETURNCODE{400}
|
||||
|
@ -272,7 +272,7 @@ function get_api_database (req, res) {
|
|||
/// var response = logCurlRequest('POST', url, JSON.stringify(data));
|
||||
///
|
||||
/// db._dropDatabase(name);
|
||||
/// assert(response.code === 200);
|
||||
/// assert(response.code === 201);
|
||||
///
|
||||
/// logJsonResponse(response);
|
||||
/// @END_EXAMPLE_ARANGOSH_RUN
|
||||
|
@ -306,7 +306,7 @@ function get_api_database (req, res) {
|
|||
/// var response = logCurlRequest('POST', url, JSON.stringify(data));
|
||||
///
|
||||
/// db._dropDatabase(name);
|
||||
/// assert(response.code === 200);
|
||||
/// assert(response.code === 201);
|
||||
///
|
||||
/// logJsonResponse(response);
|
||||
/// @END_EXAMPLE_ARANGOSH_RUN
|
||||
|
@ -374,7 +374,8 @@ function post_api_database (req, res) {
|
|||
|
||||
var result = arangodb.db._createDatabase(json.name || "", options, users);
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, { result : result });
|
||||
var returnCode = (req.compatibility <= 10400 ? actions.HTTP_OK : actions.HTTP_CREATED);
|
||||
actions.resultOk(req, res, returnCode, { result : result });
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -30,9 +30,6 @@
|
|||
|
||||
var arangodb = require("org/arangodb");
|
||||
var actions = require("org/arangodb/actions");
|
||||
|
||||
var db = arangodb.db;
|
||||
|
||||
var internal = require("internal");
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
|
||||
var actions = require("org/arangodb/actions");
|
||||
|
||||
var ArangoError = require("org/arangodb").ArangoError;
|
||||
var ERRORS = require("internal").errors;
|
||||
var EXPLAIN = require("internal").AQL_EXPLAIN;
|
||||
|
||||
|
|
|
@ -1046,6 +1046,18 @@ function process_property_compare (compare) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function process_property_filter (data, num, property, collname) {
|
||||
if (property.key !== undefined && property.compare === "HAS") {
|
||||
if (data.filter === "") { data.filter = " FILTER"; } else { data.filter += " &&";}
|
||||
data.filter += " HAS(" + collname + ", @key" + num.toString() + ") ";
|
||||
data.bindVars["key" + num.toString()] = property.key;
|
||||
return;
|
||||
}
|
||||
if (property.key !== undefined && property.compare === "HAS_NOT") {
|
||||
if (data.filter === "") { data.filter = " FILTER"; } else { data.filter += " &&";}
|
||||
data.filter += " !HAS(" + collname + ", @key" + num.toString() + ") ";
|
||||
data.bindVars["key" + num.toString()] = property.key;
|
||||
return;
|
||||
}
|
||||
if (property.key !== undefined && property.value !== undefined) {
|
||||
if (data.filter === "") { data.filter = " FILTER"; } else { data.filter += " &&";}
|
||||
data.filter += " " + collname + "[@key" + num.toString() + "] " +
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var actions = require("org/arangodb/actions");
|
||||
var simple = require("org/arangodb/simple-query");
|
||||
var db = require("org/arangodb").db;
|
||||
var ERRORS = require("internal").errors;
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ var console = require("console");
|
|||
var actions = require("org/arangodb/actions");
|
||||
var arangodb = require("org/arangodb");
|
||||
var db = arangodb.db;
|
||||
var ERRORS = arangodb.errors;
|
||||
|
||||
var DEFAULT_KEY = "default";
|
||||
var API = "_api/structure";
|
||||
|
|
|
@ -30,9 +30,6 @@
|
|||
|
||||
var arangodb = require("org/arangodb");
|
||||
var actions = require("org/arangodb/actions");
|
||||
|
||||
var db = arangodb.db;
|
||||
|
||||
var internal = require("internal");
|
||||
var console = require("console");
|
||||
|
||||
|
|
|
@ -32,8 +32,6 @@ var arangodb = require("org/arangodb");
|
|||
var actions = require("org/arangodb/actions");
|
||||
var users = require("org/arangodb/users");
|
||||
|
||||
var ArangoError = arangodb.ArangoError;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- private functions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -163,7 +161,7 @@ function post_api_user (req, res) {
|
|||
return;
|
||||
}
|
||||
|
||||
var result = users.save(json.username, json.passwd, json.active, json.extra);
|
||||
users.save(json.username, json.passwd, json.active, json.extra);
|
||||
users.reload();
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_CREATED, { });
|
||||
|
@ -251,7 +249,7 @@ function put_api_user (req, res) {
|
|||
}
|
||||
|
||||
try {
|
||||
var result = users.replace(username, json.passwd, json.active, json.extra);
|
||||
users.replace(username, json.passwd, json.active, json.extra);
|
||||
users.reload();
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, { });
|
||||
|
@ -350,7 +348,7 @@ function patch_api_user (req, res) {
|
|||
}
|
||||
|
||||
try {
|
||||
var result = users.update(username, json.passwd, json.active, json.extra);
|
||||
users.update(username, json.passwd, json.active, json.extra);
|
||||
users.reload();
|
||||
actions.resultOk(req, res, actions.HTTP_OK, { });
|
||||
}
|
||||
|
@ -419,7 +417,7 @@ function delete_api_user (req, res) {
|
|||
|
||||
var username = decodeURIComponent(req.suffix[0]);
|
||||
try {
|
||||
var result = users.remove(username);
|
||||
users.remove(username);
|
||||
users.reload();
|
||||
actions.resultOk(req, res, actions.HTTP_ACCEPTED, { });
|
||||
}
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
// -----------------------------------------------------------------------------
|
||||
|
||||
var actions = require("org/arangodb/actions");
|
||||
var simple = require("org/arangodb/simple-query");
|
||||
var db = require("org/arangodb").db;
|
||||
var internal = require("internal");
|
||||
var arangodb = require("org/arangodb");
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
},
|
||||
|
||||
initialize: function(opts) {
|
||||
var self = this;
|
||||
this.current = opts.current;
|
||||
this.collection.fetch({
|
||||
async: false
|
||||
|
|
|
@ -94,7 +94,6 @@
|
|||
},
|
||||
|
||||
renderVersion: function () {
|
||||
var self = this;
|
||||
if (this.system.hasOwnProperty('database') && this.system.hasOwnProperty('name')) {
|
||||
$(this.el).html(this.template.render({
|
||||
name: this.system.name,
|
||||
|
@ -116,7 +115,6 @@
|
|||
},
|
||||
|
||||
render: function () {
|
||||
var self = this;
|
||||
if (!this.system.version) {
|
||||
this.getVersion();
|
||||
}
|
||||
|
|
|
@ -31,9 +31,7 @@
|
|||
exports.Swagger = function () {
|
||||
"use strict";
|
||||
|
||||
// Define the Repository
|
||||
var Foxx = require("org/arangodb/foxx"),
|
||||
db = require("internal").db,
|
||||
var db = require("internal").db,
|
||||
_routing = db._collection("_routing"),
|
||||
_aal = db._collection("_aal"),
|
||||
_ = require("underscore"),
|
||||
|
|
|
@ -187,18 +187,21 @@ static char * FillVariables (const char* value) {
|
|||
if (v == NULL) {
|
||||
if (TRI_EqualString(k, "ROOTDIR")) {
|
||||
char* vv = TRI_LocateInstallDirectory();
|
||||
size_t lv = strlen(vv);
|
||||
|
||||
if (0 < lv) {
|
||||
if (vv[lv - 1] == TRI_DIR_SEPARATOR_CHAR || vv[lv - 1] == '/') {
|
||||
v = TRI_DuplicateString2(vv, lv - 1);
|
||||
}
|
||||
else {
|
||||
v = TRI_DuplicateString2(vv, lv);
|
||||
if (vv != NULL) {
|
||||
size_t lv = strlen(vv);
|
||||
|
||||
if (0 < lv) {
|
||||
if (vv[lv - 1] == TRI_DIR_SEPARATOR_CHAR || vv[lv - 1] == '/') {
|
||||
v = TRI_DuplicateString2(vv, lv - 1);
|
||||
}
|
||||
else {
|
||||
v = TRI_DuplicateString2(vv, lv);
|
||||
}
|
||||
}
|
||||
|
||||
TRI_FreeString(TRI_CORE_MEM_ZONE, vv);
|
||||
}
|
||||
|
||||
TRI_FreeString(TRI_CORE_MEM_ZONE, vv);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue