Skip to content

Commit

Permalink
Support of POST /repositories/[name]/indices/optimize
Browse files Browse the repository at this point in the history
Signed-off-by: Aymeric Brisse <aymeric.brisse@perfect-memory.com>
  • Loading branch information
abrisse committed Mar 26, 2012
1 parent aa5739b commit 628a37e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/allegro_graph/repository.rb
Expand Up @@ -70,6 +70,12 @@ def remove_duplicates(mode=:spog)
response.to_i response.to_i
end 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) def transaction(options={}, &block)
self.class.transaction self, options, &block self.class.transaction self, options, &block
end end
Expand Down
9 changes: 9 additions & 0 deletions spec/fake_transport.yml
Expand Up @@ -112,6 +112,15 @@
:response: :response:
:code: "200" :code: "200"
:body: "3" :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" :http_method: "delete"
:url: "http://localhost:10035/catalogs/test_catalog/repositories/test_repository/statements/duplicates" :url: "http://localhost:10035/catalogs/test_catalog/repositories/test_repository/statements/duplicates"
Expand Down
8 changes: 8 additions & 0 deletions spec/lib/allegro_graph/repository_spec.rb
Expand Up @@ -211,6 +211,14 @@


end end


describe "optimize" do

it "should optimize the indices" do
@repository.optimize.should be_true
end

end

describe "transaction" do describe "transaction" do


before :each do before :each do
Expand Down

0 comments on commit 628a37e

Please sign in to comment.