Skip to content

Commit

Permalink
Merge pull request #34 from GIScience/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
TimMcCauley authored Oct 9, 2017
2 parents e7e6916 + b137afe commit 6209c6f
Show file tree
Hide file tree
Showing 32 changed files with 1,932 additions and 1,253 deletions.
537 changes: 282 additions & 255 deletions openrouteservice-api-tests/conf/app.config.test

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void testPolygon() {
.then()
.body("any { it.key == 'type' }", is(true))
.body("any { it.key == 'features' }", is(true))
.body("features[0].geometry.coordinates[0].size()", is(29))
.body("features[0].geometry.coordinates[0].size()", is(28))
.body("features[0].properties.center.size()", is(2))
.body("features[0].properties.center[0]", is(8.684177f))
.body("features[0].properties.center[1]", is(49.423034f))
Expand Down Expand Up @@ -110,7 +110,7 @@ public void testReachfactorAndArea() {
.then()
.body("any { it.key == 'type' }", is(true))
.body("any { it.key == 'features' }", is(true))
.body("features[0].properties.area", is(1.4872687E7f))
.body("features[0].properties.area", is(1.4874319E7f))
.body("features[0].properties.reachfactor", is(0.1534f))
.statusCode(200);
}
Expand Down Expand Up @@ -182,17 +182,17 @@ public void testTwoDifferentTravellers_POST() {
.body("features.size()", is(6))
.body("features[0].type", is("Feature"))
.body("features[0].geometry.type", is("Polygon"))
.body("features[0].geometry.coordinates[0].size", is(33))
.body("features[0].geometry.coordinates[0].size", is(32))
.body("features[0].properties.containsKey('area')", is(true))
.body("features[1].type", is("Feature"))
.body("features[1].geometry.type", is("Polygon"))
.body("features[1].geometry.coordinates[0].size", is(76))
.body("features[1].geometry.coordinates[0].size", is(78))
.body("features[2].type", is("Feature"))
.body("features[2].geometry.type", is("Polygon"))
.body("features[2].geometry.coordinates[0].size", is(25))
.body("features[2].geometry.coordinates[0].size", is(26))
.body("features[3].type", is("Feature"))
.body("features[3].geometry.type", is("Polygon"))
.body("features[3].geometry.coordinates[0].size", is(35))
.body("features[3].geometry.coordinates[0].size", is(33))
.body("features[4].properties.contours.size", is(2))
.body("features[5].properties.contours.size", is(2))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,79 @@ public void expectMaximumspeedError() {
.statusCode(400);
}

@Test
public void expectBearingsFormatError() {
given()
.param("coordinates", getParameter("coordinatesShort"))
.param("preference", getParameter("preference"))
.param("geometry", "true")
.param("profile", getParameter("carProfile"))
.param("bearings", "50,50|50,50|100,100")
.when()
.get(getEndPointName())
.then()
.assertThat()
.body("error.code", is(203))
.statusCode(400);

given()
.param("coordinates", getParameter("coordinatesShort"))
.param("preference", getParameter("preference"))
.param("geometry", "true")
.param("profile", getParameter("carProfile"))
.param("bearings", "50k,50|50,50")
.when()
.get(getEndPointName())
.then()
.assertThat()
.body("error.code", is(203))
.statusCode(400);
}

@Test
public void expectRadiusesFormatError() {
given()
.param("coordinates", getParameter("coordinatesShort"))
.param("preference", getParameter("preference"))
.param("geometry", "true")
.param("profile", getParameter("carProfile"))
.param("radiuses", "50|50|100")
.when()
.get(getEndPointName())
.then()
.assertThat()
.body("error.code", is(203))
.statusCode(400);

given()
.param("coordinates", getParameter("coordinatesShort"))
.param("preference", getParameter("preference"))
.param("geometry", "true")
.param("profile", getParameter("carProfile"))
.param("radiuses", "h50|50")
.when()
.get(getEndPointName())
.then()
.assertThat()
.body("error.code", is(203))
.statusCode(400);
}

@Test
public void expectNoNearestEdge() {
given()
.param("coordinates", "8.689585,49.399733|8.686495,49.40349")
.param("preference", "fastest")
.param("geometry", "true")
.param("profile", "cycling-regular")
.param("radiuses", "5|150")
.when()
.get(getEndPointName())
.then()
.assertThat()
.body("error.code", is(299))
.statusCode(500);
}
@Test
public void expectUnknownUnits() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void testSummary() {
.body("routes[0].containsKey('segments')", is(true))
.body("routes[0].segments.size()", is(2))
.body("routes[0].summary.distance", is(14132.5f))
.body("routes[0].summary.duration", is(4115.6f))
.body("routes[0].summary.duration", is(3815.6f))
.body("routes[0].summary.ascent", is(349.4f))
.body("routes[0].summary.descent", is(340))
.statusCode(200);
Expand All @@ -127,7 +127,7 @@ public void testSegmentDistances() {
.body("routes[0].segments[0].distance", is(7199.4f))
.body("routes[0].segments[0].duration", is(2597.4f))
.body("routes[0].segments[1].distance", is(6933.1f))
.body("routes[0].segments[1].duration", is(1518.2f))
.body("routes[0].segments[1].duration", is(1218.2f))
.statusCode(200);
}

Expand Down Expand Up @@ -432,7 +432,73 @@ public void testTollwaysExtraDetails() {

checkExtraConsistency(response);
}

@Test
public void testOptimizedAndTurnRestrictions() {
given()
.param("coordinates", "8.684081,49.398155|8.684703,49.397359")
.param("instructions", "true")
.param("preference", getParameter("preference"))
.param("profile", "driving-car")
.param("optimized", "false")
.when()
.get(getEndPointName())
.then()
.assertThat()
.body("any { it.key == 'routes' }", is(true))
.body("routes[0].summary.distance", is(694.1f))
.statusCode(200);
}

@Test
public void testNoBearings() {
given()
.param("coordinates", "8.688694,49.399374|8.686495,49.40349")
.param("preference", "fastest")
.param("geometry", "true")
.param("profile", "cycling-regular")
.when()
.get(getEndPointName())
.then()
.assertThat()
.body("any { it.key == 'routes' }", is(true))
.body("routes[0].summary.distance", is(620.5f))
.statusCode(200);
}

@Test
public void testBearingsForStartPoint() {
given()
.param("coordinates", "8.688694,49.399374|8.686495,49.40349")
.param("preference", "fastest")
.param("geometry", "true")
.param("profile", "cycling-regular")
.when()
.get(getEndPointName())
.then()
.assertThat()
.body("any { it.key == 'routes' }", is(true))
.body("routes[0].summary.distance", is(620.5f))
.statusCode(200);
}

@Test
public void testBearingsForStartAndEndPoints() {
given()
.param("coordinates", "8.688694,49.399374|8.686495,49.40349")
.param("preference", "fastest")
.param("geometry", "true")
.param("profile", "cycling-regular")
.param("bearings", "25,30|90,20")
.when()
.get(getEndPointName())
.then()
.assertThat()
.body("any { it.key == 'routes' }", is(true))
.body("routes[0].summary.distance", is(805.6f))
.statusCode(200);
}

@Test
public void testSteps() {

Expand Down
27 changes: 17 additions & 10 deletions openrouteservice/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>heigit.ors</groupId>
<artifactId>openrouteservice</artifactId>
<version>4.3.0</version>
<version>4.4.0</version>
<packaging>war</packaging>
<name>OpenRouteService</name>
<url>openrouteservice.org</url>
Expand Down Expand Up @@ -181,9 +181,23 @@
<dependency>
<groupId>com.github.GIScience</groupId>
<artifactId>graphhopper</artifactId>
<version>v0.9.3</version>
<version>v0.9.8</version>
</dependency>


<!-- remove the comment to enable debugging
<dependency>
<groupId>com.graphhopper</groupId>
<artifactId>graphhopper-core</artifactId>
<version>0.10-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.graphhopper</groupId>
<artifactId>graphhopper-reader-osm</artifactId>
<version>0.10-SNAPSHOT</version>
</dependency>
-->
<dependency>
<groupId>com.typesafe</groupId>
<artifactId>config</artifactId>
Expand All @@ -202,14 +216,7 @@
<artifactId>postgresql</artifactId>
<version>9.4.1212</version>
</dependency>

<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>3.0.3</version>
<scope>test</scope>
</dependency>


<dependency>
<groupId>org.meteogroup.jbrotli</groupId>
<artifactId>jbrotli</artifactId>
Expand Down
Loading

0 comments on commit 6209c6f

Please sign in to comment.