Skip to content

Commit

Permalink
Gemfile.lock update
Browse files Browse the repository at this point in the history
  • Loading branch information
mdorf committed Jan 31, 2023
1 parent f61c7f9 commit 1502314
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 47 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ GEM
mime-types-data (3.2022.0105)
minitest (4.7.5)
multi_json (1.15.0)
multipart-post (2.2.3)
multipart-post (2.3.0)
mustermann (3.0.0)
ruby2_keywords (~> 0.0.1)
net-http-persistent (2.9.4)
Expand Down
84 changes: 38 additions & 46 deletions test/test_chunks_write.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
require_relative 'test_case'

module TestChunkWrite
ONT_ID = "http:://example.org/data/nemo"
ONT_ID_EXTRA = "http:://example.org/data/nemo/extra"
ONT_ID = "http://example.org/data/nemo"
ONT_ID_EXTRA = "http://example.org/data/nemo/extra"

class TestChunkWrite < MiniTest::Unit::TestCase

BACKEND_4STORE = '4store'
BACKEND_AG = 'ag'

def initialize(*args)
super(*args)
end
Expand All @@ -19,24 +22,13 @@ def self.after_suite
end

def self._delete
graphs = [ONT_ID,ONT_ID_EXTRA]
graphs = [ONT_ID, ONT_ID_EXTRA]
url = Goo.sparql_data_client.url


# url = File.join(url, "")


graphs.each do |graph|
graphs.each { |graph|
# This bypasses the chunks stuff
delete_url = url.to_s + (Goo.sparql_backend_name.downcase === 'ag' ? "?context=#{CGI.escape(graph.to_s)}" : graph.to_s)
params = { method: :delete, url: delete_url, timeout: nil }


binding.pry


params = self.params_for_backend(:delete, graph.to_s)
RestClient::Request.execute(params)
end
}
end

def test_put_data
Expand Down Expand Up @@ -84,14 +76,7 @@ def test_reentrant_queries
ntriples_file_path = "./test/data/nemo_ontology.ntriples"

# Bypass in chunks
url = Goo.sparql_data_client.url
params = {
method: :put,
url: "#{url.to_s}#{ONT_ID}",
payload: File.read(ntriples_file_path),
headers: {content_type: "application/x-turtle"},
timeout: nil
}
params = self.class.params_for_backend(:put, ONT_ID, ntriples_file_path)
RestClient::Request.execute(params)

tput = Thread.new {
Expand Down Expand Up @@ -146,16 +131,7 @@ def test_reentrant_queries

def test_query_flood
ntriples_file_path = "./test/data/nemo_ontology.ntriples"

# Bypass in chunks
url = Goo.sparql_data_client.url
params = {
method: :put,
url: "#{url.to_s}#{ONT_ID}",
payload: File.read(ntriples_file_path),
headers: {content_type: "application/x-turtle"},
timeout: nil
}
params = self.class.params_for_backend(:put, ONT_ID, ntriples_file_path)
RestClient::Request.execute(params)

tput = Thread.new {
Expand All @@ -174,21 +150,37 @@ def test_query_flood
}
end

log_status = []
Thread.new {
10.times do |i|
log_status << Goo.sparql_query_client.status
sleep(1.2)
if Goo.sparql_backend_name.downcase === BACKEND_4STORE
log_status = []
Thread.new {
10.times do |i|
log_status << Goo.sparql_query_client.status
sleep(1.2)
end
}

threads.each do |t|
t.join
end
}
tput.join

threads.each do |t|
t.join
assert log_status.map { |x| x[:outstanding] }.max > 0
assert_equal 16, log_status.map { |x| x[:running] }.max
end
tput.join
end

assert log_status.map { |x| x[:outstanding] }.max > 0
assert_equal 16, log_status.map { |x| x[:running] }.max
def self.params_for_backend(method, graph_name, ntriples_file_path = nil)
url = Goo.sparql_data_client.url
params = {method: method, headers: {content_type: "application/x-turtle"}, timeout: nil}

if Goo.sparql_backend_name.downcase === BACKEND_AG
params[:url] = "#{url.to_s}?context=%22#{CGI.escape(graph_name)}%22"
params[:payload] = File.read(ntriples_file_path) if ntriples_file_path
else
params[:url] = "#{url.to_s}#{graph_name}"
params[:payload] = File.read(ntriples_file_path) if ntriples_file_path
end
params
end

end
Expand Down

0 comments on commit 1502314

Please sign in to comment.