diff --git a/arangod/Cluster/v8-cluster.cpp b/arangod/Cluster/v8-cluster.cpp index 10770161c4..80f76a9e5b 100644 --- a/arangod/Cluster/v8-cluster.cpp +++ b/arangod/Cluster/v8-cluster.cpp @@ -126,6 +126,22 @@ static v8::Handle JS_CreateDirectoryAgency (v8::Arguments const& argv return scope.Close(v8::True()); } +//////////////////////////////////////////////////////////////////////////////// +/// @brief whether or not the agency is enabled +//////////////////////////////////////////////////////////////////////////////// + +static v8::Handle JS_IsEnabledAgency (v8::Arguments const& argv) { + v8::HandleScope scope; + + if (argv.Length() != 0) { + TRI_V8_EXCEPTION_USAGE(scope, "isEnabled()"); + } + + const std::string prefix = AgencyComm::prefix(); + + return scope.Close(v8::Boolean::New(! prefix.empty())); +} + //////////////////////////////////////////////////////////////////////////////// /// @brief gets a value from the agency //////////////////////////////////////////////////////////////////////////////// @@ -507,6 +523,7 @@ void TRI_InitV8Cluster (v8::Handle context) { TRI_AddMethodVocbase(rt, "cas", JS_CasAgency); TRI_AddMethodVocbase(rt, "createDirectory", JS_CreateDirectoryAgency); TRI_AddMethodVocbase(rt, "get", JS_GetAgency); + TRI_AddMethodVocbase(rt, "isEnabled", JS_IsEnabledAgency); TRI_AddMethodVocbase(rt, "remove", JS_RemoveAgency); TRI_AddMethodVocbase(rt, "set", JS_SetAgency); TRI_AddMethodVocbase(rt, "watch", JS_WatchAgency); diff --git a/js/server/tests/agency.js b/js/server/tests/agency.js index cf66bdbbcc..f15c969c09 100644 --- a/js/server/tests/agency.js +++ b/js/server/tests/agency.js @@ -534,7 +534,10 @@ function AgencySuite () { /// @brief executes the test suites //////////////////////////////////////////////////////////////////////////////// -jsunity.run(AgencySuite); +var agency = new ArangoAgency(); +if (agency.isEnabled()) { + jsunity.run(AgencySuite); +} return jsunity.done();