Skip to content

Commit

Permalink
Support of AG 4.6 - Rfe8881 - Optionally suppress duplicates at commi…
Browse files Browse the repository at this point in the history
…t time

Signed-off-by: Aymeric Brisse <aymeric.brisse@perfect-memory.com>
  • Loading branch information
abrisse committed Jun 28, 2012
1 parent 628a37e commit f473656
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/allegro_graph/repository.rb
Expand Up @@ -70,6 +70,16 @@ def remove_duplicates(mode=:spog)
response.to_i
end

def suppress_duplicates=(type=:spog)
response = @server.request_http :put, self.path + "/suppressDuplicates", :parameters => {:type => type.to_s}, :expected_status_code => 204
true
end

def suppress_duplicates
strategy = @server.request_http :get, self.path + "/suppressDuplicates", :expected_status_code => 200
strategy == 'false' ? false : strategy.to_sym
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
Expand Down
14 changes: 14 additions & 0 deletions spec/fake_transport.yml
Expand Up @@ -121,6 +121,20 @@
:response:
:code: "204"
:body: "nil"
-
:http_method: "get"
:url: "http://localhost:10035/catalogs/test_catalog/repositories/test_repository/suppressDuplicates"
:response:
:code: "200"
:body: "spog"
-
:http_method: "put"
:url: "http://localhost:10035/catalogs/test_catalog/repositories/test_repository/suppressDuplicates"
:parameters:
:type: "spog"
:response:
:code: "204"
:body: "nil"
-
:http_method: "delete"
:url: "http://localhost:10035/catalogs/test_catalog/repositories/test_repository/statements/duplicates"
Expand Down
16 changes: 16 additions & 0 deletions spec/lib/allegro_graph/repository_spec.rb
Expand Up @@ -211,6 +211,22 @@

end

describe "suppress_duplicates=" do

it "should set the suppress duplicates" do
(@repository.suppress_duplicates=:spog).should == :spog
end

end

describe "suppress_duplicates" do

it "should set the suppress duplicates" do
@repository.suppress_duplicates.should == :spog
end

end

describe "optimize" do

it "should optimize the indices" do
Expand Down

0 comments on commit f473656

Please sign in to comment.