Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'develop' of https://DennisOSRM@github.com/DennisOSRM/Pr…

…oject-OSRM.git into develop
  • Loading branch information...
commit 3ff7febde01e5f6181727f7c105d8588fc6544a2 2 parents f7fdb8b + cc7f761
DennisOSRM authored
View
1  Rakefile
@@ -68,6 +68,7 @@ def write_server_ini osm_file
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
View
1  features/step_definitions/processing.rb
@@ -61,6 +61,7 @@ def node(node)
File.exists?("#{area}.osrm.edges").should == true
File.exists?("#{area}.osrm.ramIndex").should == true
File.exists?("#{area}.osrm.fileIndex").should == true
+ File.exists?("#{area}.osrm.tiemstamp").should == true
end
Then /^I should see the file "([^"]*)"$/ do |file|
View
24 features/step_definitions/requests.rb
@@ -0,0 +1,24 @@
+When /^I request \/(.*)$/ do |path|
+ osrm_kill
+ reprocess
+ OSRMLauncher.new do
+ @response = request_path path
+ end
+end
+
+Then /^I should get a response/ do
+ @response.code.should == "200"
+ @response.body.should_not == nil
+ @response.body.should_not == ''
+end
+
+Then /^response should be valid JSON$/ do
+ @json = JSON.parse @response.body
+end
+
+Then /^response should be well-formed$/ do
+ @json['version'].class.should == Float
+ @json['status'].class.should == Fixnum
+ @json['transactionId'].class.should == String
+end
+
View
18 features/step_definitions/routing.rb
@@ -12,25 +12,13 @@
@response = request_route "#{locations[a][0]},#{locations[a][1]}", "#{locations[b][0]},#{locations[b][1]}"
end
-Then /^I should get a response/ do
- @response.code.should == "200"
- @response.body.should_not == nil
- @response.body.should_not == ''
-end
-
-Then /^response should be valid JSON$/ do
- @json = JSON.parse @response.body
-end
-
-Then /^response should be well-formed$/ do
- @json['version'].class.should == Float
- @json['status'].class.should == Fixnum
+Then /^response should be a well-formed route$/ do
+ step "response should be well-formed"
@json['status_message'].class.should == String
@json['route_summary'].class.should == Hash
@json['route_geometry'].class.should == String
@json['route_instructions'].class.should == Array
@json['via_points'].class.should == Array
- @json['transactionId'].class.should == String
end
Then /^a route should be found$/ do
@@ -46,7 +34,7 @@
Then /^I should get a valid response$/ do
step "I should get a response"
step "response should be valid JSON"
- step "response should be well-formed"
+ step "response should be a well-formed route"
#step "no error should be reported in terminal"
end
View
7 features/step_definitions/timestamp.rb
@@ -0,0 +1,7 @@
+Then /^I should get a valid timestamp/ do
+ step "I should get a response"
+ step "response should be valid JSON"
+ step "response should be well-formed"
+ @json['timestamp'].class.should == String
+ @json['timestamp'].should == OSM_TIMESTAMP
+end
View
1  features/support/config.rb
@@ -23,6 +23,7 @@ def write_server_ini
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
View
5 features/support/data.rb
@@ -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
View
14 features/support/request.rb
@@ -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
View
11 features/support/route.rb
@@ -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=true"
end
def parse_response response
View
12 features/timestamp/timestamp.feature
@@ -0,0 +1,12 @@
+@timestamp
+Feature: Timestamp
+
+ Scenario: Request timestamp
+ Given the node map
+ | a | b |
+ And the ways
+ | nodes |
+ | ab |
+ When I request /timestamp
+ Then I should get a valid timestamp
+

2 comments on commit 3ff7feb

@emiltin
Collaborator

if you want to avoid these merge messages in the commit history, you can use rebase instead of merge or pull when merging

@DennisOSRM
Owner

yeah, thanks. will do.

Please sign in to comment.
Something went wrong with that request. Please try again.