Fixed problem with CourseImpl where legs were initalized with wrong leg

start position
This commit is contained in:
Simon Pamies committed 2011-06-12 19:14:35 +02:00
1 parent 727325d25a
commit 322d6b02eb
3 files changed
+14 -1

No files matched your search

@@ -45,8 +45,14 @@ public abstract class AbstractTracTracLiveTest implements Listener {
// storedUri = new URI("tcp://sapsimulation.tracdev.dk:4421"); // or with tunneling: tcp://localhost:4421
// for stored race, non-real-time simulation:
paramUrl = new URL("http://germanmaster.traclive.dk/events/event_20110505_SailingTea/clientparams.php?event=event_20110505_SailingTea&race=bd8c778e-7c65-11e0-8236-406186cbf87c");
// tunneled:
liveUri = new URI("tcp://localhost:4412");
storedUri = new URI("tcp://localhost:4413");
//no tunnel:
//liveUri = new URI("tcp://germanmaster.traclive.dk:4400");
//storedUri = new URI("tcp://germanmaster.traclive.dk:4401");
receivers = new HashSet<Receiver>();
}
@@ -77,6 +77,10 @@ public class CourseUpdateTest extends AbstractTracTracLiveTest {
course = race.getCourse();
assertNotNull(course);
assertEquals(3, Util.size(course.getWaypoints()));
// make sure leg is initialized correctly in CourseImpl
assertEquals("start/finish", course.getLegs().get(0).getFrom().getName());
assertEquals("start/finish", course.getLegs().get(1).getFrom().getName());
}
@Test
@@ -36,12 +36,15 @@ public class CourseImpl extends NamedImpl implements Course {
if (waypointIter.hasNext()) {
Waypoint previous = waypointIter.next();
this.waypoints.add(previous);
int indexOfStartWaypoint = i;
waypointIndexes.put(previous, i++);
while (waypointIter.hasNext()) {
Waypoint current = waypointIter.next();
this.waypoints.add(current);
waypointIndexes.put(current, i++);
Leg leg = new LegImpl(this, i);
Leg leg = new LegImpl(this, indexOfStartWaypoint);
legs.add(leg);
previous = current;
}