Permalink
Browse files

Support of POST /repositories/[name]/indices/optimize

Signed-off-by: Aymeric Brisse <aymeric.brisse@perfect-memory.com>
  • Loading branch information...
1 parent aa5739b commit 628a37eb824d9af4f64cfe019bc9aa5e290ffca9 @abrisse abrisse committed Mar 26, 2012
Showing with 23 additions and 0 deletions.
  1. +6 −0 lib/allegro_graph/repository.rb
  2. +9 −0 spec/fake_transport.yml
  3. +8 −0 spec/lib/allegro_graph/repository_spec.rb
@@ -70,6 +70,12 @@ def remove_duplicates(mode=:spog)
response.to_i
end
+ def optimize(parameters={})
+ parameters = { :wait => 'false', :level => '1' }.merge(parameters)
+ response = @server.request_http :post, self.path + "/indices/optimize", :parameters => parameters, :expected_status_code => 204
+ response == 'nil'
+ end
+
def transaction(options={}, &block)
self.class.transaction self, options, &block
end
View
@@ -113,6 +113,15 @@
:code: "200"
:body: "3"
-
+ :http_method: "post"
+ :url: "http://localhost:10035/catalogs/test_catalog/repositories/test_repository/indices/optimize"
+ :parameters:
+ :wait: "false"
+ :level: "1"
+ :response:
+ :code: "204"
+ :body: "nil"
+-
:http_method: "delete"
:url: "http://localhost:10035/catalogs/test_catalog/repositories/test_repository/statements/duplicates"
:parameters:
@@ -211,6 +211,14 @@
end
+ describe "optimize" do
+
+ it "should optimize the indices" do
+ @repository.optimize.should be_true
+ end
+
+ end
+
describe "transaction" do
before :each do

0 comments on commit 628a37e

Please sign in to comment.