Merge branch 'master' into racecommittee_app

This commit is contained in:
Armin Zamani committed 2013-06-26 11:41:03 +02:00
commit a573ffb6fc
5 files changed
+29 -2

No files matched your search

@@ -591,6 +591,8 @@ public class IncrementalLeaderboardDTO extends LeaderboardDTO implements Increme
} else {
LeaderboardEntryDTO newLeaderboardEntryDTO = new LeaderboardEntryDTO();
cloner.clone(raceColumnNameAndLeaderboardEntry.getValue(), newLeaderboardEntryDTO);
// clone the leg details collection to ensure that when we need to manipulate it we don't manipulate the original
newLeaderboardEntryDTO.legDetails = new ArrayList<LegEntryDTO>(newLeaderboardEntryDTO.legDetails);
newFieldsByRaceColumnName.put(raceColumnNameAndLeaderboardEntry.getKey(), newLeaderboardEntryDTO);
if (newLeaderboardEntryDTO.legDetails != null) {
for (int legDetailsIndex = 0; legDetailsIndex < newLeaderboardEntryDTO.legDetails.size(); legDetailsIndex++) {
@@ -71,4 +71,8 @@ public class MarkImpl extends NamedImpl implements Mark {
public MarkType getType() {
return type;
}
public String toString() {
return getId() + " " + getColor() + super.toString();
}
}
@@ -34,6 +34,7 @@ import com.sap.sailing.domain.common.dto.LegEntryDTO;
import com.sap.sailing.domain.common.dto.RaceColumnDTO;
import com.sap.sailing.domain.common.dto.RaceDTO;
import com.sap.sailing.domain.common.impl.Util;
import com.sap.sailing.domain.common.impl.Util.Pair;
import com.sap.sailing.domain.test.StoredTrackBasedTest;
import com.sap.sailing.util.ClonerImpl;
@@ -118,6 +119,15 @@ public class LeaderboardDTODiffingTest {
@Test
public void testStrippingExceptOneColumnInOneRace() {
Map<Pair<CompetitorDTO, String>, List<LegEntryDTO>> previousLegDetailsBeforeStripping = new HashMap<>();
for (Map.Entry<CompetitorDTO, LeaderboardRowDTO> e : previousVersion.rows.entrySet()) {
for (Map.Entry<String, LeaderboardEntryDTO> e2 : e.getValue().fieldsByRaceColumnName.entrySet()) {
if (e2.getValue().legDetails != null) {
previousLegDetailsBeforeStripping.put(new Pair<CompetitorDTO, String>(e.getKey(), e2.getKey()),
new ArrayList<>(e2.getValue().legDetails));
}
}
}
HashMap<CompetitorDTO, LeaderboardRowDTO> newRows = new HashMap<CompetitorDTO, LeaderboardRowDTO>(newVersion.rows);
double newDistance = 1234;
String nameOfRaceColumnToChange = "R9";
@@ -144,6 +154,14 @@ public class LeaderboardDTODiffingTest {
newVersion.rows = newRows;
Map<CompetitorDTO, LeaderboardRowDTO> rowsBeforeStripping = newVersion.rows;
newVersion.strip(previousVersion);
// see bug 1455; check that the stripping doesn't kill the previous leaderboard's legDetails lists
for (Map.Entry<Pair<CompetitorDTO, String>, List<LegEntryDTO>> e : previousLegDetailsBeforeStripping.entrySet()) {
final LeaderboardRowDTO leaderboardRowDTO = previousVersion.rows.get(e.getKey().getA());
if (leaderboardRowDTO != null) {
List<LegEntryDTO> newLegDetails = leaderboardRowDTO.fieldsByRaceColumnName.get(e.getKey().getB()).legDetails;
assertEquals(e.getValue(), newLegDetails);
}
}
assertAllRowsKeysAreIdenticalToAllLeaderboardRowDTOCompetitors(newVersion);
assertNotNull(newVersion.rows);
assertEquals(previousVersion.rows.size()-17, newVersion.rows.size()); // all rows have changed except for 17 that have no leg details in leg 8
@@ -91,8 +91,8 @@ public class MarkPositionReceiver extends AbstractReceiverWithQueue<ControlPoint
TimePoint now = MillisecondsTimePoint.now();
long fromTime = startOfTracking == null ? 0l : startOfTracking.compareTo(now) > 0 ? now.asMillis() : startOfTracking.asMillis();
long toTime = endOfTracking == null ? Long.MAX_VALUE : endOfTracking.asMillis();
logger.fine("subscribing to ControlPointPositionData for time range "+new MillisecondsTimePoint(fromTime)+"/"+
new MillisecondsTimePoint(toTime));
logger.info("Subscribing to ControlPointPositionData for time range "+new MillisecondsTimePoint(fromTime)+"/"+
new MillisecondsTimePoint(toTime) + " for event " + getTracTracEvent().getName());
TypeController controlPointListener = ControlPointPositionData.subscribe(getTracTracEvent(),
new ICallbackData<ControlPoint, ControlPointPositionData>() {
@Override
@@ -196,6 +196,9 @@ public class TracTracRaceTrackerImpl extends AbstractRaceTrackerImpl implements
throw new RuntimeException("Connection failed. Could not connect to " + paramURL);
}
logger.info("Starting race tracker: " + tractracEvent.getName() + " " + paramURL + " " + liveURI
+ storedURI + " startOfTracking:" + (startOfTracking != null ? startOfTracking.asMillis() : "n/a") + " endOfTracking:" + (endOfTracking != null ? endOfTracking.asMillis() : "n/a"));
// Initialize data controller using live and stored data sources
controller = new DataController(liveURI, storedURI, this);
// Start live and stored data streams