Merge branch master in bug2851

This commit is contained in:
Jan Broß committed 2015-11-04 13:36:29 +01:00
commit f36c072247
160 files changed
+1554 -1843

No files matched your search

@@ -18,8 +18,10 @@ import org.junit.Test;
import com.sap.sailing.domain.abstractlog.impl.LogEventAuthorImpl;
import com.sap.sailing.domain.abstractlog.race.RaceLog;
import com.sap.sailing.domain.abstractlog.race.RaceLogEventFactory;
import com.sap.sailing.domain.abstractlog.race.impl.RaceLogRevokeEventImpl;
import com.sap.sailing.domain.abstractlog.race.tracking.RaceLogRegisterCompetitorEvent;
import com.sap.sailing.domain.abstractlog.race.tracking.impl.RaceLogRegisterCompetitorEventImpl;
import com.sap.sailing.domain.abstractlog.race.tracking.impl.RaceLogUseCompetitorsFromRaceLogEventImpl;
import com.sap.sailing.domain.abstractlog.regatta.RegattaLog;
import com.sap.sailing.domain.abstractlog.regatta.events.RegattaLogRegisterCompetitorEvent;
import com.sap.sailing.domain.abstractlog.regatta.events.impl.RegattaLogRegisterCompetitorEventImpl;
@@ -107,10 +109,10 @@ public class CompetitorProviderCacheInvalidationTest extends AbstractLeaderboard
RaceLog raceLog = flexibleLeaderboard.getRacelog("R1", LeaderboardNameConstants.DEFAULT_FLEET_NAME);
final int passId = 1;
final LogEventAuthorImpl author = new LogEventAuthorImpl("Me", 0);
raceLog.add(RaceLogEventFactory.INSTANCE.createUseCompetitorsFromRaceLogEvent(MillisecondsTimePoint.now(), author, UUID.randomUUID(), passId));
raceLog.add(new RaceLogUseCompetitorsFromRaceLogEventImpl(MillisecondsTimePoint.now(), author, MillisecondsTimePoint.now(), UUID.randomUUID(), passId));
final Map<Competitor, RaceLogRegisterCompetitorEvent> competitorOnRaceLogRegistrationEvents = new HashMap<>();
for (Competitor c : compLists[0]) {
final RaceLogRegisterCompetitorEvent registerCompetitorEvent = RaceLogEventFactory.INSTANCE.createRegisterCompetitorEvent(MillisecondsTimePoint.now(), author, passId, c);
final RaceLogRegisterCompetitorEvent registerCompetitorEvent = new RaceLogRegisterCompetitorEventImpl(MillisecondsTimePoint.now(), author, passId, c);
raceLog.add(registerCompetitorEvent);
competitorOnRaceLogRegistrationEvents.put(c, registerCompetitorEvent);
}
@@ -126,7 +128,7 @@ public class CompetitorProviderCacheInvalidationTest extends AbstractLeaderboard
// we're now revoking a competitor registration on the race log and assert
// that the competitor is gone from the list:
final Competitor competitorToRevokeFromRaceLog = compLists[0].get(2);
raceLog.add(RaceLogEventFactory.INSTANCE.createRevokeEvent(author, passId, competitorOnRaceLogRegistrationEvents.get(competitorToRevokeFromRaceLog), "Test revoking"));
raceLog.add(new RaceLogRevokeEventImpl(author, passId, competitorOnRaceLogRegistrationEvents.get(competitorToRevokeFromRaceLog), "Test revoking"));
actualForRace = new HashSet<>(); // try another time; cache should of course yield an equal result (although
// we're not asserting here that the result actually comes from the cache)
Util.addAll(competitorProviderFlexibleLeaderboard.getAllCompetitors(
@@ -150,7 +152,7 @@ public class CompetitorProviderCacheInvalidationTest extends AbstractLeaderboard
flexibleLeaderboard.addRaceColumn("R1", /* medalRace */ false);
RegattaLog regattaLog = flexibleLeaderboard.getRegattaLog();
for (Competitor c : compLists[0]) {
regattaLog.add(new RegattaLogRegisterCompetitorEventImpl(MillisecondsTimePoint.now(), new LogEventAuthorImpl("Me", 0), MillisecondsTimePoint.now(), UUID.randomUUID(), c));
regattaLog.add(new RegattaLogRegisterCompetitorEventImpl(MillisecondsTimePoint.now(), MillisecondsTimePoint.now(), new LogEventAuthorImpl("Me", 0), UUID.randomUUID(), c));
}
Set<Competitor> expected = new HashSet<>(compLists[0]);
Set<Competitor> actual = new HashSet<>();
@@ -168,14 +170,14 @@ public class CompetitorProviderCacheInvalidationTest extends AbstractLeaderboard
flexibleLeaderboard.addRaceColumn("R1", /* medalRace */ false);
RegattaLog regattaLog = flexibleLeaderboard.getRegattaLog();
for (Competitor c : compLists[0]) {
regattaLog.add(new RegattaLogRegisterCompetitorEventImpl(MillisecondsTimePoint.now(), new LogEventAuthorImpl("Me", 0), MillisecondsTimePoint.now(), UUID.randomUUID(), c));
regattaLog.add(new RegattaLogRegisterCompetitorEventImpl(MillisecondsTimePoint.now(), MillisecondsTimePoint.now(), new LogEventAuthorImpl("Me", 0), UUID.randomUUID(), c));
}
RaceLog raceLog = flexibleLeaderboard.getRacelog("R1", LeaderboardNameConstants.DEFAULT_FLEET_NAME);
final LogEventAuthorImpl author = new LogEventAuthorImpl("Me", 0);
int passId = 1;
raceLog.add(RaceLogEventFactory.INSTANCE.createUseCompetitorsFromRaceLogEvent(MillisecondsTimePoint.now(), author, UUID.randomUUID(), passId));
for (Competitor c : compLists[1]) {
raceLog.add(RaceLogEventFactory.INSTANCE.createRegisterCompetitorEvent(MillisecondsTimePoint.now(), author, passId, c));
raceLog.add(new RaceLogUseCompetitorsFromRaceLogEventImpl(MillisecondsTimePoint.now(), author, MillisecondsTimePoint.now(), UUID.randomUUID(), passId));
for (Competitor c : compLists[1]) {
raceLog.add(new RaceLogRegisterCompetitorEventImpl(MillisecondsTimePoint.now(), new LogEventAuthorImpl("Me", 0), 1, c));
}
//expected are all competitors, because the getAllCopmetitors method is called
//this includes competitors Registered in the RaceLogs, for which the RaceLog
@@ -262,9 +264,9 @@ public class CompetitorProviderCacheInvalidationTest extends AbstractLeaderboard
RaceLog raceLog = regattaLeaderboard.getRacelog("R1", "Yellow");
final LogEventAuthorImpl author = new LogEventAuthorImpl("Me", 0);
int passId = 1;
raceLog.add(RaceLogEventFactory.INSTANCE.createUseCompetitorsFromRaceLogEvent(MillisecondsTimePoint.now(), author, UUID.randomUUID(), passId));
raceLog.add(new RaceLogUseCompetitorsFromRaceLogEventImpl(MillisecondsTimePoint.now(), author, MillisecondsTimePoint.now(), UUID.randomUUID(), passId));
for (Competitor c : compLists[0]) {
raceLog.add(RaceLogEventFactory.INSTANCE.createRegisterCompetitorEvent(MillisecondsTimePoint.now(), author, passId, c));
raceLog.add(new RaceLogRegisterCompetitorEventImpl(MillisecondsTimePoint.now(), new LogEventAuthorImpl("Me", 0), 1, c));
}
Set<Competitor> expected = new HashSet<>(compLists[0]);
Set<Competitor> actual = new HashSet<>();
@@ -282,7 +284,7 @@ public class CompetitorProviderCacheInvalidationTest extends AbstractLeaderboard
final Map<Competitor, RegattaLogRegisterCompetitorEvent> competitorOnRegattaLogRegistrationEvents = new HashMap<>();
final LogEventAuthorImpl author = new LogEventAuthorImpl("Me", 0);
for (Competitor c : compLists[0]) {
final RegattaLogRegisterCompetitorEventImpl registerCompetitorEvent = new RegattaLogRegisterCompetitorEventImpl(MillisecondsTimePoint.now(), author, MillisecondsTimePoint.now(), UUID.randomUUID(), c);
final RegattaLogRegisterCompetitorEventImpl registerCompetitorEvent = new RegattaLogRegisterCompetitorEventImpl(MillisecondsTimePoint.now(), MillisecondsTimePoint.now(), author, UUID.randomUUID(), c);
regattaLog.add(registerCompetitorEvent);
competitorOnRegattaLogRegistrationEvents.put(c, registerCompetitorEvent);
}
@@ -315,14 +317,14 @@ public class CompetitorProviderCacheInvalidationTest extends AbstractLeaderboard
final RegattaLog regattaLog = regattaLeaderboard.getRegatta().getRegattaLog();
final LogEventAuthorImpl author = new LogEventAuthorImpl("Me", 0);
for (Competitor c : compLists[0]) {
regattaLog.add(new RegattaLogRegisterCompetitorEventImpl(MillisecondsTimePoint.now(), author, MillisecondsTimePoint.now(), UUID.randomUUID(), c));
regattaLog.add(new RegattaLogRegisterCompetitorEventImpl(MillisecondsTimePoint.now(), MillisecondsTimePoint.now(), author, UUID.randomUUID(), c));
}
final RaceLog raceLog = regattaLeaderboard.getRacelog("R1", "Yellow");
final int passId = 1;
raceLog.add(RaceLogEventFactory.INSTANCE.createUseCompetitorsFromRaceLogEvent(MillisecondsTimePoint.now(), author, UUID.randomUUID(), passId));
raceLog.add(new RaceLogUseCompetitorsFromRaceLogEventImpl(MillisecondsTimePoint.now(), author, MillisecondsTimePoint.now(), UUID.randomUUID(), passId));
final Map<Competitor, RaceLogRegisterCompetitorEvent> competitorOnRaceLogRegistrationEvents = new HashMap<>();
for (Competitor c : compLists[passId]) {
final RaceLogRegisterCompetitorEvent registerCompetitorEvent = RaceLogEventFactory.INSTANCE.createRegisterCompetitorEvent(MillisecondsTimePoint.now(), author, passId, c);
final RaceLogRegisterCompetitorEvent registerCompetitorEvent = new RaceLogRegisterCompetitorEventImpl(MillisecondsTimePoint.now(), author, passId, c);
raceLog.add(registerCompetitorEvent);
competitorOnRaceLogRegistrationEvents.put(c, registerCompetitorEvent);
}
@@ -350,7 +352,7 @@ public class CompetitorProviderCacheInvalidationTest extends AbstractLeaderboard
// But now it gets interesting: we're revoking a competitor registration on the race log and assert
// that the competitor is gone from the list:
final Competitor competitorToRevokeFromRaceLog = compLists[passId].get(2);
raceLog.add(RaceLogEventFactory.INSTANCE.createRevokeEvent(author, passId, competitorOnRaceLogRegistrationEvents.get(competitorToRevokeFromRaceLog), "Test revoking"));
raceLog.add(new RaceLogRevokeEventImpl(author, passId, competitorOnRaceLogRegistrationEvents.get(competitorToRevokeFromRaceLog), "Test revoking"));
actualForRaceYellow = new HashSet<>(); // try another time; cache should of course yield an equal result (although
// we're not asserting here that the result actually comes from the cache)
Util.addAll(competitorProviderRegattaLeaderboard.getAllCompetitors(
@@ -1213,11 +1213,11 @@ public class LeaderboardScoringAndRankingTest extends AbstractLeaderboardTest {
assertEquals(new Double(18), leaderboardHighPoint10Or8AndLastBreaksTie.getTotalPoints(competitors[1], later));
assertEquals(new Double(2), leaderboardHighPoint10Or8AndLastBreaksTie.getTotalPoints(competitors[9], later));
RaceLog raceLogForRace2 = leaderboardHighPoint10Or8AndLastBreaksTie.getRaceColumnByName("R2").getRaceLog(leaderboardHighPoint10Or8AndLastBreaksTie.getFleet(null));
raceLogForRace2.add(new RaceLogAdditionalScoringInformationEventImpl(now, new LogEventAuthorImpl("Plopp", 1), later, "12345678", Collections.<Competitor>emptyList(), 0, AdditionalScoringInformationType.UNKNOWN));
raceLogForRace2.add(new RaceLogAdditionalScoringInformationEventImpl(now, later, new LogEventAuthorImpl("Plopp", 1), "12345678", 0, AdditionalScoringInformationType.UNKNOWN));
assertEquals(new Double(20), leaderboardHighPoint10Or8AndLastBreaksTie.getTotalPoints(competitors[0], later));
assertEquals(new Double(18), leaderboardHighPoint10Or8AndLastBreaksTie.getTotalPoints(competitors[1], later));
assertEquals(new Double(2), leaderboardHighPoint10Or8AndLastBreaksTie.getTotalPoints(competitors[9], later));
raceLogForRace2.add(new RaceLogAdditionalScoringInformationEventImpl(now, new LogEventAuthorImpl("Plopp", 1), later.plus(Duration.ONE_MINUTE), "123456789873773762", Collections.<Competitor>emptyList(), 0, AdditionalScoringInformationType.MAX_POINTS_DECREASE_MAX_SCORE));
raceLogForRace2.add(new RaceLogAdditionalScoringInformationEventImpl(now, later.plus(Duration.ONE_MINUTE), new LogEventAuthorImpl("Plopp", 1), "123456789873773762", 0, AdditionalScoringInformationType.MAX_POINTS_DECREASE_MAX_SCORE));
assertEquals(new Double(18), leaderboardHighPoint10Or8AndLastBreaksTie.getTotalPoints(competitors[0], later));
assertEquals(new Double(16), leaderboardHighPoint10Or8AndLastBreaksTie.getTotalPoints(competitors[1], later));
assertEquals(new Double(2), leaderboardHighPoint10Or8AndLastBreaksTie.getTotalPoints(competitors[9], later));