added crc logic for datafile access

This commit is contained in:
Arndt Brenschede 2014-02-02 17:04:17 +01:00
parent e88465f5ec
commit b4aa961f2d
26 changed files with 621 additions and 1364 deletions

View file

@ -51,5 +51,9 @@
<artifactId>brouter-map-creator</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>
</project>

View file

@ -0,0 +1,56 @@
package btools.server;
import java.util.*;
import org.junit.Assert;
import org.junit.Test;
import java.net.URL;
import java.io.File;
import btools.router.*;
import btools.mapaccess.*;
public class RouterTest
{
@Test
public void routerTest() throws Exception
{
URL resulturl = this.getClass().getResource( "/testtrack0.gpx" );
Assert.assertTrue( "reference result not found: ", resulturl != null );
File resultfile = new File(resulturl.getFile());
File workingDir = resultfile.getParentFile();
String wd = workingDir.getAbsolutePath();
List<OsmNodeNamed> wplist = new ArrayList<OsmNodeNamed>();
OsmNodeNamed n;
n = new OsmNodeNamed();
n.name = "from";
n.ilon = 180000000 + 8720897;
n.ilat = 90000000 + 50002515;
wplist.add( n );
n = new OsmNodeNamed();
n.name = "to";
n.ilon = 180000000 + 8723658;
n.ilat = 90000000 + 49997510;
wplist.add( n );
RoutingContext rctx = new RoutingContext();
rctx.localFunction = wd + "/../../../misc/profiles2/trekking.brf";
// c.setAlternativeIdx( 1 );
RoutingEngine re = new RoutingEngine(
wd + "/testtrack",
wd + "/testlog",
wd + "/../../../brouter-map-creator/target/test-classes/tmp/segments", wplist, rctx );
re.doRun( 0 );
// error message from router?
Assert.assertTrue( "routing failed: " + re.getErrorMessage(), re.getErrorMessage() == null );
// if the track didn't change, we expect the first alternative also
File a1 = new File( workingDir, "testtrack1.gpx" );
Assert.assertTrue( "result content missmatch", a1.exists() );
}
}

View file

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- track-length = 728 filtered ascend = 0 plain-ascend = 0 cost=728 -->
<gpx
xmlns="http://www.topografix.com/GPX/1/1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
creator="BRouter-0.98" version="1.1">
<trk>
<name>brouter_trekking_0</name>
<trkseg>
<trkpt lon="8.720889" lat="50.002512"></trkpt>
<trkpt lon="8.720897" lat="50.002503"></trkpt>
<trkpt lon="8.720976" lat="50.002389"></trkpt>
<trkpt lon="8.720787" lat="50.002390"></trkpt>
<trkpt lon="8.720662" lat="50.002363"></trkpt>
<trkpt lon="8.720553" lat="50.002331"></trkpt>
<trkpt lon="8.720339" lat="50.002251"></trkpt>
<trkpt lon="8.720158" lat="50.002159"></trkpt>
<trkpt lon="8.719973" lat="50.002051"></trkpt>
<trkpt lon="8.719729" lat="50.001823"></trkpt>
<trkpt lon="8.719541" lat="50.001606"></trkpt>
<trkpt lon="8.719807" lat="50.001508"></trkpt>
<trkpt lon="8.719989" lat="50.001421"></trkpt>
<trkpt lon="8.720085" lat="50.001367"></trkpt>
<trkpt lon="8.720324" lat="50.001211"></trkpt>
<trkpt lon="8.720482" lat="50.001041"></trkpt>
<trkpt lon="8.720597" lat="50.000795"></trkpt>
<trkpt lon="8.720672" lat="50.000551"></trkpt>
<trkpt lon="8.720760" lat="50.000387"></trkpt>
<trkpt lon="8.720921" lat="50.000228"></trkpt>
<trkpt lon="8.721129" lat="50.000074"></trkpt>
<trkpt lon="8.721409" lat="49.999885"></trkpt>
<trkpt lon="8.721622" lat="49.999733"></trkpt>
<trkpt lon="8.722176" lat="49.999309"></trkpt>
<trkpt lon="8.722416" lat="49.999100"></trkpt>
<trkpt lon="8.722474" lat="49.999038"></trkpt>
<trkpt lon="8.722547" lat="49.998975"></trkpt>
<trkpt lon="8.722669" lat="49.998853"></trkpt>
<trkpt lon="8.723046" lat="49.998397"></trkpt>
<trkpt lon="8.723659" lat="49.997526"></trkpt>
<trkpt lon="8.723669" lat="49.997514"></trkpt>
</trkseg>
</trk>
</gpx>