cuke testing of timestamp api
This commit is contained in:
@@ -23,6 +23,7 @@ edgesData=#{@osm_file}.osrm.edges
|
||||
ramIndex=#{@osm_file}.osrm.ramIndex
|
||||
fileIndex=#{@osm_file}.osrm.fileIndex
|
||||
namesData=#{@osm_file}.osrm.names
|
||||
timestamp=#{@osm_file}.osrm.timestamp
|
||||
EOF
|
||||
File.open( 'server.ini', 'w') {|f| f.write( s ) }
|
||||
end
|
||||
|
||||
@@ -198,9 +198,14 @@ def prepared?
|
||||
File.exist?("#{@osm_file}.osrm.hsgr")
|
||||
end
|
||||
|
||||
def write_timestamp
|
||||
File.open( "#{@osm_file}.osrm.timestamp", 'w') {|f| f.write(OSM_TIMESTAMP) }
|
||||
end
|
||||
|
||||
def reprocess
|
||||
Dir.chdir TEST_FOLDER do
|
||||
write_osm
|
||||
write_timestamp
|
||||
convert_osm_to_pbf
|
||||
unless extracted?
|
||||
log_preprocess_info
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
require 'net/http'
|
||||
|
||||
HOST = 'http://localhost:5000'
|
||||
|
||||
def request_path path
|
||||
@query = path
|
||||
log path
|
||||
uri = URI.parse "#{HOST}/#{path}"
|
||||
Net::HTTP.get_response uri
|
||||
rescue Errno::ECONNREFUSED => e
|
||||
raise "*** osrm-routed is not running."
|
||||
rescue Timeout::Error
|
||||
raise "*** osrm-routed did not respond."
|
||||
end
|
||||
@@ -1,17 +1,8 @@
|
||||
require 'net/http'
|
||||
|
||||
DESTINATION_REACHED = 15 #OSRM instruction code
|
||||
|
||||
|
||||
def request_route a,b
|
||||
@query = "http://localhost:5000/viaroute?loc=#{a}&loc=#{b}&output=json&instructions=true&alt=false"
|
||||
#log @query
|
||||
uri = URI.parse @query
|
||||
Net::HTTP.get_response uri
|
||||
rescue Errno::ECONNREFUSED => e
|
||||
raise "*** osrm-routed is not running."
|
||||
rescue Timeout::Error
|
||||
raise "*** osrm-routed did not respond."
|
||||
request_path "viaroute?loc=#{a}&loc=#{b}&output=json&instructions=true&alt=false"
|
||||
end
|
||||
|
||||
def parse_response response
|
||||
|
||||
Reference in New Issue
Block a user