mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-10 14:20:55 +00:00
Merge branch 'racecommittee_integrated' of ssh://sapsailing.com/home/trac/git into racecommittee_integrated
Conflicts: java/com.sap.sailing.domain/src/com/sap/sailing/domain/racecommittee/RaceCommitteeEventFactory.java java/com.sap.sailing.domain/src/com/sap/sailing/domain/racecommittee/impl/RaceCommitteeEventFactoryImpl.java java/com.sap.sailing.server.gateway.serialization.test/src/com/sap/sailing/server/gateway/serialization/test/RaceLogEventTest.java java/com.sap.sailing.server.gateway.serialization.test/src/com/sap/sailing/server/gateway/serialization/test/RaceLogFlagEventSerializerTest.java java/com.sap.sailing.server.gateway.serialization.test/src/com/sap/sailing/server/gateway/serialization/test/RaceLogStartTimeEventSerializerTest.java java/com.sap.sailing.server.gateway.serialization/src/com/sap/sailing/server/gateway/deserialization/impl/BaseRaceLogEventDeserializer.java java/com.sap.sailing.server.gateway.serialization/src/com/sap/sailing/server/gateway/deserialization/impl/RaceCommitteeFlagEventDeserializer.java java/com.sap.sailing.server.gateway.serialization/src/com/sap/sailing/server/gateway/deserialization/impl/RaceCommitteeStartTimeEventDeserializer.java java/com.sap.sailing.server.gateway.serialization/src/com/sap/sailing/server/gateway/serialization/impl/BaseRaceLogEventSerializer.java java/com.sap.sailing.server.gateway.serialization/src/com/sap/sailing/server/gateway/serialization/impl/RaceCommitteeEventSerializer.java java/com.sap.sailing.server.gateway.serialization/src/com/sap/sailing/server/gateway/serialization/impl/RaceCommitteeStartTimeEventSerializer.java java/com.sap.sailing.server.gateway.serialization/src/com/sap/sailing/server/gateway/serialization/impl/RaceLogFlagEventSerializer.java java/com.sap.sailing.server.gateway/src/com/sap/sailing/server/gateway/impl/rc/EventTrackJsonExportServlet.java
This commit is contained in:
commit
ad6b6fa37c
126 files changed
+1498
-1382
No files matched your search
+2
-2
@@ -12,7 +12,7 @@ import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.leaderboard.Leaderboard;
|
||||
import com.sap.sailing.domain.leaderboard.LeaderboardGroup;
|
||||
import com.sap.sailing.domain.leaderboard.LeaderboardRegistry;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEventTrack;
|
||||
import com.sap.sailing.domain.racelog.RaceLog;
|
||||
import com.sap.sailing.domain.tracking.TrackedRegattaRegistry;
|
||||
import com.sap.sailing.domain.tracking.WindTrack;
|
||||
|
||||
@@ -84,5 +84,5 @@ public interface DomainObjectFactory {
|
||||
|
||||
Map<String, Regatta> loadRaceIDToRegattaAssociations(RegattaRegistry regattaRegistry);
|
||||
|
||||
RaceCommitteeEventTrack loadRaceCommitteeEventTrack(Regatta regatta, RaceDefinition race);
|
||||
RaceLog loadRaceLog(Regatta regatta, RaceDefinition race);
|
||||
}
|
||||
+2
-2
@@ -28,11 +28,11 @@ public interface MongoObjectFactory {
|
||||
void addWindTrackDumper(TrackedRegatta trackedRegatta, TrackedRace trackedRace, WindSource windSource);
|
||||
|
||||
/**
|
||||
* Registers for new race committee events on the <code>trackedRace</code>. Each
|
||||
* Registers for new race log events on the <code>trackedRace</code>. Each
|
||||
* update received will be appended to the MongoDB and can later be retrieved. The key used to identify the race is
|
||||
* the {@link RaceDefinition#getName() race name} and the {@link Regatta#getName() regatta name}.
|
||||
*/
|
||||
void addRaceCommitteeEventTrackDumper(TrackedRegatta trackedRegatta, TrackedRace trackedRace);
|
||||
void addRaceLogDumper(TrackedRegatta trackedRegatta, TrackedRace trackedRace);
|
||||
|
||||
/**
|
||||
* Stores the configuration data of <code>leaderboard</code> in the Mongo DB associated with this
|
||||
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
package com.sap.sailing.domain.persistence;
|
||||
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStore;
|
||||
|
||||
public interface MongoRaceCommitteeStore extends RaceCommitteeStore {
|
||||
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.sap.sailing.domain.persistence;
|
||||
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
|
||||
public interface MongoRaceLogStore extends RaceLogStore {
|
||||
|
||||
}
|
||||
+4
-4
@@ -3,16 +3,16 @@ package com.sap.sailing.domain.persistence;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import com.mongodb.MongoException;
|
||||
import com.sap.sailing.domain.persistence.impl.MongoRaceCommitteeStoreFactoryImpl;
|
||||
import com.sap.sailing.domain.persistence.impl.MongoRaceLogStoreFactoryImpl;
|
||||
import com.sap.sailing.mongodb.MongoDBService;
|
||||
|
||||
public interface MongoRaceCommitteeStoreFactory {
|
||||
MongoRaceCommitteeStoreFactory INSTANCE = new MongoRaceCommitteeStoreFactoryImpl(MongoDBService.INSTANCE.getDB());
|
||||
public interface MongoRaceLogStoreFactory {
|
||||
MongoRaceLogStoreFactory INSTANCE = new MongoRaceLogStoreFactoryImpl(MongoDBService.INSTANCE.getDB());
|
||||
|
||||
/**
|
||||
* Gets the default Mongo store based on the properties mongo.hostname[=localhost], mongo.port[=27017]
|
||||
* and mongo.dbName[=<contents of constant {@link #DEFAULT_DB_NAME}>] specified in the bundle context
|
||||
*/
|
||||
MongoRaceCommitteeStore getMongoRaceCommitteeStore(MongoObjectFactory mongoObjectFactory, DomainObjectFactory domainObjectFactory)
|
||||
MongoRaceLogStore getMongoRaceLogStore(MongoObjectFactory mongoObjectFactory, DomainObjectFactory domainObjectFactory)
|
||||
throws UnknownHostException, MongoException;
|
||||
}
|
||||
+2
-2
@@ -49,7 +49,7 @@ public enum CollectionNames {
|
||||
REGATTA_FOR_RACE_ID,
|
||||
|
||||
/**
|
||||
* Stores the race committee events for a tracked race.
|
||||
* Stores the race log events for a tracked race.
|
||||
*/
|
||||
RACECOMMITTEE_TRACKS;
|
||||
RACE_LOGS;
|
||||
}
|
||||
+33
-33
@@ -73,13 +73,13 @@ import com.sap.sailing.domain.leaderboard.impl.ResultDiscardingRuleImpl;
|
||||
import com.sap.sailing.domain.leaderboard.impl.ScoreCorrectionImpl;
|
||||
import com.sap.sailing.domain.leaderboard.meta.LeaderboardGroupMetaLeaderboard;
|
||||
import com.sap.sailing.domain.persistence.DomainObjectFactory;
|
||||
import com.sap.sailing.domain.racecommittee.Flags;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEvent;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEventFactory;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEventTrack;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeFlagEvent;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStartTimeEvent;
|
||||
import com.sap.sailing.domain.racecommittee.impl.RaceCommitteeEventTrackImpl;
|
||||
import com.sap.sailing.domain.racelog.Flags;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEventFactory;
|
||||
import com.sap.sailing.domain.racelog.RaceLog;
|
||||
import com.sap.sailing.domain.racelog.RaceLogFlagEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStartTimeEvent;
|
||||
import com.sap.sailing.domain.racelog.impl.RaceLogImpl;
|
||||
import com.sap.sailing.domain.tracking.TrackedRegattaRegistry;
|
||||
import com.sap.sailing.domain.tracking.Wind;
|
||||
import com.sap.sailing.domain.tracking.WindTrack;
|
||||
@@ -876,62 +876,62 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceCommitteeEventTrack loadRaceCommitteeEventTrack(Regatta regatta, RaceDefinition race) {
|
||||
RaceCommitteeEventTrack result = new RaceCommitteeEventTrackImpl(RaceCommitteeEventTrackImpl.class.getSimpleName());
|
||||
public RaceLog loadRaceLog(Regatta regatta, RaceDefinition race) {
|
||||
RaceLog result = new RaceLogImpl(RaceLogImpl.class.getSimpleName());
|
||||
try {
|
||||
BasicDBObject query = new BasicDBObject();
|
||||
query.put(FieldNames.REGATTA_NAME.name(), regatta.getName());
|
||||
query.put(FieldNames.RACE_NAME.name(), race.getName());
|
||||
DBCollection raceCommitteeTrack = database.getCollection(CollectionNames.RACECOMMITTEE_TRACKS.name());
|
||||
for (DBObject o : raceCommitteeTrack.find(query)) {
|
||||
RaceCommitteeEvent raceCommitteeEvent = loadRaceCommitteeEvent((DBObject) o.get(FieldNames.RC_EVENT.name()));
|
||||
DBCollection raceLog = database.getCollection(CollectionNames.RACE_LOGS.name());
|
||||
for (DBObject o : raceLog.find(query)) {
|
||||
RaceLogEvent raceLogEvent = loadRaceLogEvent((DBObject) o.get(FieldNames.RACE_LOG_EVENT.name()));
|
||||
|
||||
if (raceCommitteeEvent != null)
|
||||
result.add(raceCommitteeEvent);
|
||||
if (raceLogEvent != null)
|
||||
result.add(raceLogEvent);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
// something went wrong during DB access; report, then use empty new race committee track
|
||||
logger.log(Level.SEVERE, "Error connecting to MongoDB, unable to load recorded race committee data. Check MongoDB settings.");
|
||||
logger.throwing(DomainObjectFactoryImpl.class.getName(), "loadRaceCommitteeEventTrack", t);
|
||||
// something went wrong during DB access; report, then use empty new race log
|
||||
logger.log(Level.SEVERE, "Error connecting to MongoDB, unable to load recorded race log data. Check MongoDB settings.");
|
||||
logger.throwing(DomainObjectFactoryImpl.class.getName(), "loadRaceLog", t);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public RaceCommitteeEvent loadRaceCommitteeEvent(DBObject dbObject) {
|
||||
public RaceLogEvent loadRaceLogEvent(DBObject dbObject) {
|
||||
TimePoint timePoint = loadTimePoint(dbObject);
|
||||
Serializable id = (Serializable) dbObject.get(FieldNames.RC_EVENT_ID.name());
|
||||
Integer passId = (Integer) dbObject.get(FieldNames.RC_EVENT_PASS_ID.name());
|
||||
Serializable id = (Serializable) dbObject.get(FieldNames.RACE_LOG_EVENT_ID.name());
|
||||
Integer passId = (Integer) dbObject.get(FieldNames.RACE_LOG_EVENT_PASS_ID.name());
|
||||
//BasicDBList dbList = (BasicDBList) dbObject.get(FieldNames.RC_EVENT_INVOLVED_BOATS.name());
|
||||
List<Competitor> competitors = new ArrayList<Competitor>();
|
||||
|
||||
String eventClass = (String) dbObject.get(FieldNames.RC_EVENT_CLASS.name());
|
||||
if (eventClass.equals(RaceCommitteeStartTimeEvent.class.getSimpleName())) {
|
||||
return loadRaceCommitteeStartTimeEvent(timePoint, id, passId, competitors, dbObject);
|
||||
} else if (eventClass.equals(RaceCommitteeFlagEvent.class.getSimpleName())) {
|
||||
return loadRaceCommitteeFlagEvent(timePoint, id, passId, competitors, dbObject);
|
||||
String eventClass = (String) dbObject.get(FieldNames.RACE_LOG_EVENT_CLASS.name());
|
||||
if (eventClass.equals(RaceLogStartTimeEvent.class.getSimpleName())) {
|
||||
return loadRaceLogStartTimeEvent(timePoint, id, passId, competitors, dbObject);
|
||||
} else if (eventClass.equals(RaceLogFlagEvent.class.getSimpleName())) {
|
||||
return loadRaceLogFlagEvent(timePoint, id, passId, competitors, dbObject);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private RaceCommitteeEvent loadRaceCommitteeFlagEvent(TimePoint timePoint, Serializable id, Integer passId, List<Competitor> competitors, DBObject dbObject) {
|
||||
Flags upperFlag = Flags.valueOf((String) dbObject.get(FieldNames.RC_EVENT_FLAG_UPPER.name()));
|
||||
Flags lowerFlag = Flags.valueOf((String) dbObject.get(FieldNames.RC_EVENT_FLAG_LOWER.name()));
|
||||
Boolean displayed = Boolean.valueOf((String) dbObject.get(FieldNames.RC_EVENT_FLAG_DISPLAYED.name()));
|
||||
private RaceLogEvent loadRaceLogFlagEvent(TimePoint timePoint, Serializable id, Integer passId, List<Competitor> competitors, DBObject dbObject) {
|
||||
Flags upperFlag = Flags.valueOf((String) dbObject.get(FieldNames.RACE_LOG_EVENT_FLAG_UPPER.name()));
|
||||
Flags lowerFlag = Flags.valueOf((String) dbObject.get(FieldNames.RACE_LOG_EVENT_FLAG_LOWER.name()));
|
||||
Boolean displayed = Boolean.valueOf((String) dbObject.get(FieldNames.RACE_LOG_EVENT_FLAG_DISPLAYED.name()));
|
||||
|
||||
if (upperFlag == null || lowerFlag == null || displayed == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return RaceCommitteeEventFactory.INSTANCE.createFlagEvent(timePoint, id, competitors, passId, upperFlag, lowerFlag, displayed);
|
||||
return RaceLogEventFactory.INSTANCE.createFlagEvent(timePoint, id, competitors, passId, upperFlag, lowerFlag, displayed);
|
||||
}
|
||||
|
||||
private RaceCommitteeStartTimeEvent loadRaceCommitteeStartTimeEvent(TimePoint timePoint, Serializable id, Integer passId, List<Competitor> competitors, DBObject dbObject) {
|
||||
Long startTimeInMillis = (Long) dbObject.get(FieldNames.RC_EVENT_START_TIME.name());
|
||||
private RaceLogStartTimeEvent loadRaceLogStartTimeEvent(TimePoint timePoint, Serializable id, Integer passId, List<Competitor> competitors, DBObject dbObject) {
|
||||
Long startTimeInMillis = (Long) dbObject.get(FieldNames.RACE_LOG_EVENT_START_TIME.name());
|
||||
if (startTimeInMillis == null) {
|
||||
return null;
|
||||
}
|
||||
TimePoint startTime = new MillisecondsTimePoint(startTimeInMillis);
|
||||
return RaceCommitteeEventFactory.INSTANCE.createStartTimeEvent(timePoint, passId, competitors, passId, startTime);
|
||||
return RaceLogEventFactory.INSTANCE.createStartTimeEvent(timePoint, passId, competitors, passId, startTime);
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -64,7 +64,7 @@ public enum FieldNames {
|
||||
// race ID to regatta name
|
||||
RACE_ID_AS_STRING,
|
||||
|
||||
// race committee
|
||||
RC_EVENT, RC_EVENT_PASS_ID, RC_EVENT_ID, RC_EVENT_INVOLVED_BOATS, RC_EVENT_FLAG_UPPER, RC_EVENT_FLAG_LOWER, RC_EVENT_FLAG_DISPLAYED,
|
||||
RC_EVENT_START_TIME, RC_EVENT_CLASS;
|
||||
// race log
|
||||
RACE_LOG_EVENT, RACE_LOG_EVENT_PASS_ID, RACE_LOG_EVENT_ID, RACE_LOG_EVENT_INVOLVED_BOATS, RACE_LOG_EVENT_FLAG_UPPER, RACE_LOG_EVENT_FLAG_LOWER,
|
||||
RACE_LOG_EVENT_FLAG_DISPLAYED, RACE_LOG_EVENT_START_TIME, RACE_LOG_EVENT_CLASS;
|
||||
}
|
||||
+31
-31
@@ -37,10 +37,10 @@ import com.sap.sailing.domain.leaderboard.RegattaLeaderboard;
|
||||
import com.sap.sailing.domain.leaderboard.SettableScoreCorrection;
|
||||
import com.sap.sailing.domain.leaderboard.ThresholdBasedResultDiscardingRule;
|
||||
import com.sap.sailing.domain.persistence.MongoObjectFactory;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEvent;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEventTrack;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeFlagEvent;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStartTimeEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLog;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogFlagEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStartTimeEvent;
|
||||
import com.sap.sailing.domain.tracking.Positioned;
|
||||
import com.sap.sailing.domain.tracking.TrackedRace;
|
||||
import com.sap.sailing.domain.tracking.TrackedRegatta;
|
||||
@@ -471,66 +471,66 @@ public class MongoObjectFactoryImpl implements MongoObjectFactory {
|
||||
regattaForRaceIDCollection.update(query, entry, /* upsrt */ true, /* multi */ false);
|
||||
}
|
||||
|
||||
public DBCollection getRaceCommitteeTrackCollection() {
|
||||
DBCollection result = database.getCollection(CollectionNames.RACECOMMITTEE_TRACKS.name());
|
||||
public DBCollection getRaceLogCollection() {
|
||||
DBCollection result = database.getCollection(CollectionNames.RACE_LOGS.name());
|
||||
result.ensureIndex(new BasicDBObject(FieldNames.RACE_NAME.name(), null));
|
||||
//TODO: Clarify which field shall be the index/ which fields identifies a race uniquely over all events and regattas
|
||||
return result;
|
||||
}
|
||||
|
||||
public DBObject storeRaceCommitteeTrackEntry(Regatta regatta, RaceDefinition race, RaceCommitteeFlagEvent flagEvent) {
|
||||
public DBObject storeRaceLogEntry(Regatta regatta, RaceDefinition race, RaceLogFlagEvent flagEvent) {
|
||||
BasicDBObject result = new BasicDBObject();
|
||||
storeRegattaAndRaceForRaceCommitteeEvent(regatta, race, result);
|
||||
storeRegattaAndRaceForRaceLogEvent(regatta, race, result);
|
||||
|
||||
result.put(FieldNames.RC_EVENT.name(), storeRaceCommitteeFlagEvent(flagEvent));
|
||||
result.put(FieldNames.RACE_LOG_EVENT.name(), storeRaceLogFlagEvent(flagEvent));
|
||||
return result;
|
||||
}
|
||||
|
||||
public DBObject storeRaceCommitteeTrackEntry(Regatta regatta, RaceDefinition race, RaceCommitteeStartTimeEvent startTimeEvent) {
|
||||
public DBObject storeRaceLogEntry(Regatta regatta, RaceDefinition race, RaceLogStartTimeEvent startTimeEvent) {
|
||||
BasicDBObject result = new BasicDBObject();
|
||||
storeRegattaAndRaceForRaceCommitteeEvent(regatta, race, result);
|
||||
storeRegattaAndRaceForRaceLogEvent(regatta, race, result);
|
||||
|
||||
result.put(FieldNames.RC_EVENT.name(), storeRaceCommitteeStartTimeEvent(startTimeEvent));
|
||||
result.put(FieldNames.RACE_LOG_EVENT.name(), storeRaceLogStartTimeEvent(startTimeEvent));
|
||||
return result;
|
||||
}
|
||||
|
||||
private void storeRegattaAndRaceForRaceCommitteeEvent(Regatta regatta, RaceDefinition race, DBObject result) {
|
||||
private void storeRegattaAndRaceForRaceLogEvent(Regatta regatta, RaceDefinition race, DBObject result) {
|
||||
result.put(FieldNames.REGATTA_NAME.name(), regatta.getName());
|
||||
result.put(FieldNames.RACE_NAME.name(), race.getName());
|
||||
}
|
||||
|
||||
private Object storeRaceCommitteeStartTimeEvent(RaceCommitteeStartTimeEvent startTimeEvent) {
|
||||
private Object storeRaceLogStartTimeEvent(RaceLogStartTimeEvent startTimeEvent) {
|
||||
DBObject result = new BasicDBObject();
|
||||
storeTimed(startTimeEvent, result);
|
||||
storeRaceCommitteeEventProperties(startTimeEvent, result);
|
||||
storeRaceLogEventProperties(startTimeEvent, result);
|
||||
|
||||
result.put(FieldNames.RC_EVENT_CLASS.name(), RaceCommitteeStartTimeEvent.class.getSimpleName());
|
||||
result.put(FieldNames.RACE_LOG_EVENT_CLASS.name(), RaceLogStartTimeEvent.class.getSimpleName());
|
||||
|
||||
result.put(FieldNames.RC_EVENT_START_TIME.name(), startTimeEvent.getStartTime().asMillis());
|
||||
result.put(FieldNames.RACE_LOG_EVENT_START_TIME.name(), startTimeEvent.getStartTime().asMillis());
|
||||
return result;
|
||||
}
|
||||
|
||||
public DBObject storeRaceCommitteeFlagEvent(RaceCommitteeFlagEvent flagEvent) {
|
||||
public DBObject storeRaceLogFlagEvent(RaceLogFlagEvent flagEvent) {
|
||||
DBObject result = new BasicDBObject();
|
||||
storeTimed(flagEvent, result);
|
||||
storeRaceCommitteeEventProperties(flagEvent, result);
|
||||
storeRaceLogEventProperties(flagEvent, result);
|
||||
|
||||
result.put(FieldNames.RC_EVENT_CLASS.name(), RaceCommitteeFlagEvent.class.getSimpleName());
|
||||
result.put(FieldNames.RACE_LOG_EVENT_CLASS.name(), RaceLogFlagEvent.class.getSimpleName());
|
||||
|
||||
result.put(FieldNames.RC_EVENT_FLAG_UPPER.name(), flagEvent.getUpperFlag().name());
|
||||
result.put(FieldNames.RC_EVENT_FLAG_LOWER.name(), flagEvent.getLowerFlag().name());
|
||||
result.put(FieldNames.RC_EVENT_FLAG_DISPLAYED.name(), String.valueOf(flagEvent.isDisplayed()));
|
||||
result.put(FieldNames.RACE_LOG_EVENT_FLAG_UPPER.name(), flagEvent.getUpperFlag().name());
|
||||
result.put(FieldNames.RACE_LOG_EVENT_FLAG_LOWER.name(), flagEvent.getLowerFlag().name());
|
||||
result.put(FieldNames.RACE_LOG_EVENT_FLAG_DISPLAYED.name(), String.valueOf(flagEvent.isDisplayed()));
|
||||
return result;
|
||||
}
|
||||
|
||||
private void storeRaceCommitteeEventProperties(RaceCommitteeEvent event, DBObject result) {
|
||||
result.put(FieldNames.RC_EVENT_ID.name(), event.getId());
|
||||
result.put(FieldNames.RC_EVENT_PASS_ID.name(), event.getPassId());
|
||||
result.put(FieldNames.RC_EVENT_INVOLVED_BOATS.name(), storeInvolvedBoatsForRaceCommitteeEvent(event.getInvolvedBoats()));
|
||||
private void storeRaceLogEventProperties(RaceLogEvent event, DBObject result) {
|
||||
result.put(FieldNames.RACE_LOG_EVENT_ID.name(), event.getId());
|
||||
result.put(FieldNames.RACE_LOG_EVENT_PASS_ID.name(), event.getPassId());
|
||||
result.put(FieldNames.RACE_LOG_EVENT_INVOLVED_BOATS.name(), storeInvolvedBoatsForRaceLogEvent(event.getInvolvedBoats()));
|
||||
}
|
||||
|
||||
|
||||
private BasicDBList storeInvolvedBoatsForRaceCommitteeEvent(List<Competitor> competitors) {
|
||||
private BasicDBList storeInvolvedBoatsForRaceLogEvent(List<Competitor> competitors) {
|
||||
BasicDBList dbInvolvedCompetitorNames = new BasicDBList();
|
||||
for (Competitor competitor : competitors) {
|
||||
dbInvolvedCompetitorNames.add(MongoUtils.escapeDollarAndDot(competitor.getName()));
|
||||
@@ -539,8 +539,8 @@ public class MongoObjectFactoryImpl implements MongoObjectFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRaceCommitteeEventTrackDumper(TrackedRegatta trackedRegatta, TrackedRace trackedRace) {
|
||||
RaceCommitteeEventTrack rcEventTrack = trackedRace.getRaceCommitteeEventTrack();
|
||||
rcEventTrack.addListener(new MongoRaceCommitteeListener(trackedRegatta, trackedRace, this, database));
|
||||
public void addRaceLogDumper(TrackedRegatta trackedRegatta, TrackedRace trackedRace) {
|
||||
RaceLog rcEventTrack = trackedRace.getRaceLog();
|
||||
rcEventTrack.addListener(new MongoRaceLogListener(trackedRegatta, trackedRace, this, database));
|
||||
}
|
||||
}
|
||||
-45
@@ -1,45 +0,0 @@
|
||||
package com.sap.sailing.domain.persistence.impl;
|
||||
|
||||
import com.mongodb.DB;
|
||||
import com.mongodb.DBCollection;
|
||||
import com.mongodb.DBObject;
|
||||
import com.sap.sailing.domain.persistence.MongoObjectFactory;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeFlagEvent;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeListener;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStartTimeEvent;
|
||||
import com.sap.sailing.domain.tracking.TrackedRace;
|
||||
import com.sap.sailing.domain.tracking.TrackedRegatta;
|
||||
|
||||
public class MongoRaceCommitteeListener implements RaceCommitteeListener {
|
||||
|
||||
private final TrackedRegatta trackedRegatta;
|
||||
private final TrackedRace trackedRace;
|
||||
private final MongoObjectFactoryImpl mongoObjectFactory;
|
||||
private final DBCollection raceCommitteeEventTracksCollection;
|
||||
|
||||
public MongoRaceCommitteeListener(TrackedRegatta trackedRegatta, TrackedRace trackedRace,
|
||||
MongoObjectFactory mongoObjectFactory, DB database) {
|
||||
super();
|
||||
this.trackedRegatta = trackedRegatta;
|
||||
this.trackedRace = trackedRace;
|
||||
this.mongoObjectFactory = (MongoObjectFactoryImpl) mongoObjectFactory;
|
||||
this.raceCommitteeEventTracksCollection = this.mongoObjectFactory.getRaceCommitteeTrackCollection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flagEventReceived(RaceCommitteeFlagEvent flagEvent) {
|
||||
DBObject flagEventTrackEntry = mongoObjectFactory.storeRaceCommitteeTrackEntry(trackedRegatta.getRegatta(),
|
||||
trackedRace.getRace(), flagEvent);
|
||||
raceCommitteeEventTracksCollection.insert(flagEventTrackEntry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startTimeEventReceived(
|
||||
RaceCommitteeStartTimeEvent startTimeEvent) {
|
||||
DBObject startTimeEventTrackEntry = mongoObjectFactory.storeRaceCommitteeTrackEntry(trackedRegatta.getRegatta(),
|
||||
trackedRace.getRace(), startTimeEvent);
|
||||
raceCommitteeEventTracksCollection.insert(startTimeEventTrackEntry);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
package com.sap.sailing.domain.persistence.impl;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import com.mongodb.DB;
|
||||
import com.mongodb.MongoException;
|
||||
import com.sap.sailing.domain.persistence.DomainObjectFactory;
|
||||
import com.sap.sailing.domain.persistence.MongoObjectFactory;
|
||||
import com.sap.sailing.domain.persistence.MongoRaceCommitteeStore;
|
||||
import com.sap.sailing.domain.persistence.MongoRaceCommitteeStoreFactory;
|
||||
|
||||
public class MongoRaceCommitteeStoreFactoryImpl implements MongoRaceCommitteeStoreFactory {
|
||||
private final DB db;
|
||||
|
||||
public MongoRaceCommitteeStoreFactoryImpl(DB db) {
|
||||
this.db = db;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MongoRaceCommitteeStore getMongoRaceCommitteeStore(MongoObjectFactory mongoObjectFactory,DomainObjectFactory domainObjectFactory)
|
||||
throws UnknownHostException, MongoException {
|
||||
return new MongoRaceCommitteeStoreImpl(db, mongoObjectFactory, domainObjectFactory);
|
||||
}
|
||||
|
||||
}
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
package com.sap.sailing.domain.persistence.impl;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import com.mongodb.DB;
|
||||
import com.mongodb.MongoException;
|
||||
import com.sap.sailing.domain.persistence.DomainObjectFactory;
|
||||
import com.sap.sailing.domain.persistence.MongoObjectFactory;
|
||||
import com.sap.sailing.domain.persistence.MongoRaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEventTrack;
|
||||
import com.sap.sailing.domain.racecommittee.impl.EmptyRaceCommitteeStore;
|
||||
import com.sap.sailing.domain.tracking.TrackedRace;
|
||||
import com.sap.sailing.domain.tracking.TrackedRegatta;
|
||||
|
||||
public class MongoRaceCommitteeStoreImpl extends EmptyRaceCommitteeStore implements MongoRaceCommitteeStore {
|
||||
private transient final DB db;
|
||||
private final MongoObjectFactory mongoObjectFactory;
|
||||
private final DomainObjectFactory domainObjectFactory;
|
||||
|
||||
public MongoRaceCommitteeStoreImpl(DB db, MongoObjectFactory mongoObjectFactory, DomainObjectFactory domainObjectFactory)
|
||||
throws UnknownHostException, MongoException {
|
||||
this.db = db;
|
||||
this.mongoObjectFactory = mongoObjectFactory;
|
||||
this.domainObjectFactory = domainObjectFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceCommitteeEventTrack getRaceCommitteeEventTrack(TrackedRegatta trackedRegatta, TrackedRace trackedRace) {
|
||||
RaceCommitteeEventTrack track;
|
||||
track = domainObjectFactory.loadRaceCommitteeEventTrack(trackedRegatta.getRegatta(), trackedRace.getRace());
|
||||
track.addListener(new MongoRaceCommitteeListener(trackedRegatta, trackedRace, mongoObjectFactory, db));
|
||||
return track;
|
||||
}
|
||||
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package com.sap.sailing.domain.persistence.impl;
|
||||
|
||||
import com.mongodb.DB;
|
||||
import com.mongodb.DBCollection;
|
||||
import com.mongodb.DBObject;
|
||||
import com.sap.sailing.domain.persistence.MongoObjectFactory;
|
||||
import com.sap.sailing.domain.racelog.RaceLogFlagEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogListener;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStartTimeEvent;
|
||||
import com.sap.sailing.domain.tracking.TrackedRace;
|
||||
import com.sap.sailing.domain.tracking.TrackedRegatta;
|
||||
|
||||
public class MongoRaceLogListener implements RaceLogListener {
|
||||
|
||||
private final TrackedRegatta trackedRegatta;
|
||||
private final TrackedRace trackedRace;
|
||||
private final MongoObjectFactoryImpl mongoObjectFactory;
|
||||
private final DBCollection raceLogsCollection;
|
||||
|
||||
public MongoRaceLogListener(TrackedRegatta trackedRegatta, TrackedRace trackedRace,
|
||||
MongoObjectFactory mongoObjectFactory, DB database) {
|
||||
super();
|
||||
this.trackedRegatta = trackedRegatta;
|
||||
this.trackedRace = trackedRace;
|
||||
this.mongoObjectFactory = (MongoObjectFactoryImpl) mongoObjectFactory;
|
||||
this.raceLogsCollection = this.mongoObjectFactory.getRaceLogCollection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flagEventReceived(RaceLogFlagEvent flagEvent) {
|
||||
DBObject flagEventTrackEntry = mongoObjectFactory.storeRaceLogEntry(trackedRegatta.getRegatta(),
|
||||
trackedRace.getRace(), flagEvent);
|
||||
raceLogsCollection.insert(flagEventTrackEntry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startTimeEventReceived(
|
||||
RaceLogStartTimeEvent startTimeEvent) {
|
||||
DBObject startTimeEventTrackEntry = mongoObjectFactory.storeRaceLogEntry(trackedRegatta.getRegatta(),
|
||||
trackedRace.getRace(), startTimeEvent);
|
||||
raceLogsCollection.insert(startTimeEventTrackEntry);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.sap.sailing.domain.persistence.impl;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import com.mongodb.DB;
|
||||
import com.mongodb.MongoException;
|
||||
import com.sap.sailing.domain.persistence.DomainObjectFactory;
|
||||
import com.sap.sailing.domain.persistence.MongoObjectFactory;
|
||||
import com.sap.sailing.domain.persistence.MongoRaceLogStore;
|
||||
import com.sap.sailing.domain.persistence.MongoRaceLogStoreFactory;
|
||||
|
||||
public class MongoRaceLogStoreFactoryImpl implements MongoRaceLogStoreFactory {
|
||||
private final DB db;
|
||||
|
||||
public MongoRaceLogStoreFactoryImpl(DB db) {
|
||||
this.db = db;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MongoRaceLogStore getMongoRaceLogStore(MongoObjectFactory mongoObjectFactory,DomainObjectFactory domainObjectFactory)
|
||||
throws UnknownHostException, MongoException {
|
||||
return new MongoRaceLogStoreImpl(db, mongoObjectFactory, domainObjectFactory);
|
||||
}
|
||||
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.sap.sailing.domain.persistence.impl;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import com.mongodb.DB;
|
||||
import com.mongodb.MongoException;
|
||||
import com.sap.sailing.domain.persistence.DomainObjectFactory;
|
||||
import com.sap.sailing.domain.persistence.MongoObjectFactory;
|
||||
import com.sap.sailing.domain.persistence.MongoRaceLogStore;
|
||||
import com.sap.sailing.domain.racelog.RaceLog;
|
||||
import com.sap.sailing.domain.racelog.impl.EmptyRaceLogStore;
|
||||
import com.sap.sailing.domain.tracking.TrackedRace;
|
||||
import com.sap.sailing.domain.tracking.TrackedRegatta;
|
||||
|
||||
public class MongoRaceLogStoreImpl extends EmptyRaceLogStore implements MongoRaceLogStore {
|
||||
private transient final DB db;
|
||||
private final MongoObjectFactory mongoObjectFactory;
|
||||
private final DomainObjectFactory domainObjectFactory;
|
||||
|
||||
public MongoRaceLogStoreImpl(DB db, MongoObjectFactory mongoObjectFactory, DomainObjectFactory domainObjectFactory)
|
||||
throws UnknownHostException, MongoException {
|
||||
this.db = db;
|
||||
this.mongoObjectFactory = mongoObjectFactory;
|
||||
this.domainObjectFactory = domainObjectFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLog getRaceLog(TrackedRegatta trackedRegatta, TrackedRace trackedRace) {
|
||||
RaceLog track;
|
||||
track = domainObjectFactory.loadRaceLog(trackedRegatta.getRegatta(), trackedRace.getRace());
|
||||
track.addListener(new MongoRaceLogListener(trackedRegatta, trackedRace, mongoObjectFactory, db));
|
||||
return track;
|
||||
}
|
||||
|
||||
}
|
||||
+4
-4
@@ -28,7 +28,7 @@ import com.sap.sailing.domain.base.RaceDefinition;
|
||||
import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.base.Waypoint;
|
||||
import com.sap.sailing.domain.common.impl.Util;
|
||||
import com.sap.sailing.domain.racecommittee.impl.EmptyRaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.impl.EmptyRaceLogStore;
|
||||
import com.sap.sailing.domain.swisstimingadapter.MessageType;
|
||||
import com.sap.sailing.domain.swisstimingadapter.SailMasterConnector;
|
||||
import com.sap.sailing.domain.swisstimingadapter.SailMasterTransceiver;
|
||||
@@ -65,7 +65,7 @@ public class EndToEndListeningStoreAndFowardTest {
|
||||
private SwissTimingFactory swissTimingFactory;
|
||||
|
||||
private EmptyWindStore emptyWindStore;
|
||||
private EmptyRaceCommitteeStore emptyRaceCommitteeStore;
|
||||
private EmptyRaceLogStore emptyRaceLogStore;
|
||||
private RacingEventService racingEventService;
|
||||
|
||||
private List<RacesHandle> raceHandles;
|
||||
@@ -85,7 +85,7 @@ public class EndToEndListeningStoreAndFowardTest {
|
||||
sendingStream = sendingSocket.getOutputStream();
|
||||
swissTimingFactory = SwissTimingFactory.INSTANCE;
|
||||
emptyWindStore = EmptyWindStore.INSTANCE;
|
||||
emptyRaceCommitteeStore = EmptyRaceCommitteeStore.INSTANCE;
|
||||
emptyRaceLogStore = EmptyRaceLogStore.INSTANCE;
|
||||
transceiver = swissTimingFactory.createSailMasterTransceiver();
|
||||
DBCollection lastMessageCountCollection = db.getCollection(CollectionNames.LAST_MESSAGE_COUNT.name());
|
||||
lastMessageCountCollection.update(new BasicDBObject(),
|
||||
@@ -339,7 +339,7 @@ public class EndToEndListeningStoreAndFowardTest {
|
||||
for (String raceToTrack : racesToTrack) {
|
||||
RacesHandle raceHandle = racingEventService.addSwissTimingRace(/* regattaToAddTo */ null /* use a default regatta */,
|
||||
raceToTrack, "localhost", /* canSendRequests */
|
||||
CLIENT_PORT, false, emptyWindStore, -1, emptyRaceCommitteeStore);
|
||||
CLIENT_PORT, false, emptyWindStore, -1, emptyRaceLogStore);
|
||||
raceHandles.add(raceHandle);
|
||||
if (connector == null) {
|
||||
connector = racingEventService.getSwissTimingFactory().getOrCreateSailMasterConnector("localhost",
|
||||
|
||||
+2
-2
@@ -11,7 +11,7 @@ import com.sap.sailing.domain.base.RaceDefinition;
|
||||
import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.base.Waypoint;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
import com.sap.sailing.domain.swisstimingadapter.impl.DomainFactoryImpl;
|
||||
import com.sap.sailing.domain.tracking.GPSFixMoving;
|
||||
import com.sap.sailing.domain.tracking.MarkPassing;
|
||||
@@ -50,7 +50,7 @@ public interface DomainFactory {
|
||||
|
||||
RaceTrackingConnectivityParameters createTrackingConnectivityParameters(String hostname, int port, String raceID,
|
||||
boolean canSendRequests, long delayToLiveInMillis,
|
||||
SwissTimingFactory swissTimingFactory, DomainFactory domainFactory, WindStore windStore, RaceCommitteeStore raceCommitteeStore,
|
||||
SwissTimingFactory swissTimingFactory, DomainFactory domainFactory, WindStore windStore, RaceLogStore raceLogStore,
|
||||
RaceSpecificMessageLoader messageLoader);
|
||||
|
||||
BoatClass getOrCreateBoatClassFromRaceID(String raceID);
|
||||
|
||||
+3
-3
@@ -6,7 +6,7 @@ import java.text.ParseException;
|
||||
|
||||
import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
import com.sap.sailing.domain.swisstimingadapter.impl.SwissTimingFactoryImpl;
|
||||
import com.sap.sailing.domain.tracking.RaceTracker;
|
||||
import com.sap.sailing.domain.tracking.TrackedRegattaRegistry;
|
||||
@@ -52,11 +52,11 @@ public interface SwissTimingFactory {
|
||||
|
||||
SwissTimingConfiguration createSwissTimingConfiguration(String name, String hostname, int port, boolean canSendRequests);
|
||||
|
||||
SwissTimingRaceTracker createRaceTracker(String raceID, String hostname, int port, boolean canSendRequests, long delayToLiveInMillis, WindStore windStore, RaceSpecificMessageLoader messageLoader, DomainFactory domainFactory, TrackedRegattaRegistry trackedRegattaRegistry, RaceCommitteeStore raceCommitteeStore) throws InterruptedException, UnknownHostException, IOException, ParseException;
|
||||
SwissTimingRaceTracker createRaceTracker(String raceID, String hostname, int port, boolean canSendRequests, long delayToLiveInMillis, WindStore windStore, RaceSpecificMessageLoader messageLoader, DomainFactory domainFactory, TrackedRegattaRegistry trackedRegattaRegistry, RaceLogStore raceLogStore) throws InterruptedException, UnknownHostException, IOException, ParseException;
|
||||
|
||||
RaceTracker createRaceTracker(Regatta regatta, String raceID, String hostname, int port, boolean canSendRequests, long delayToLiveInMillis,
|
||||
WindStore windStore, RaceSpecificMessageLoader messageLoader, DomainFactory domainFactory,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceCommitteeStore raceCommitteeStore) throws UnknownHostException, InterruptedException,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceLogStore raceLogStore) throws UnknownHostException, InterruptedException,
|
||||
IOException, ParseException;
|
||||
|
||||
Race createRace(String raceId, String description, TimePoint startTime);
|
||||
|
||||
+3
-3
@@ -30,7 +30,7 @@ import com.sap.sailing.domain.common.ScoringSchemeType;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.impl.Util;
|
||||
import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
import com.sap.sailing.domain.swisstimingadapter.Course;
|
||||
import com.sap.sailing.domain.swisstimingadapter.DomainFactory;
|
||||
import com.sap.sailing.domain.swisstimingadapter.Fix;
|
||||
@@ -308,10 +308,10 @@ public class DomainFactoryImpl implements DomainFactory {
|
||||
@Override
|
||||
public RaceTrackingConnectivityParameters createTrackingConnectivityParameters(String hostname, int port, String raceID,
|
||||
boolean canSendRequests, long delayToLiveInMillis,
|
||||
SwissTimingFactory swissTimingFactory, DomainFactory domainFactory, WindStore windStore, RaceCommitteeStore raceCommitteeStore,
|
||||
SwissTimingFactory swissTimingFactory, DomainFactory domainFactory, WindStore windStore, RaceLogStore raceLogStore,
|
||||
RaceSpecificMessageLoader messageLoader) {
|
||||
return new SwissTimingTrackingConnectivityParameters(hostname, port, raceID, canSendRequests, delayToLiveInMillis,
|
||||
swissTimingFactory, domainFactory, windStore, raceCommitteeStore, messageLoader);
|
||||
swissTimingFactory, domainFactory, windStore, raceLogStore, messageLoader);
|
||||
}
|
||||
|
||||
}
|
||||
+5
-5
@@ -9,7 +9,7 @@ import java.util.Map;
|
||||
import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.impl.Util.Triple;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
import com.sap.sailing.domain.swisstimingadapter.DomainFactory;
|
||||
import com.sap.sailing.domain.swisstimingadapter.Race;
|
||||
import com.sap.sailing.domain.swisstimingadapter.RaceSpecificMessageLoader;
|
||||
@@ -81,20 +81,20 @@ public class SwissTimingFactoryImpl implements SwissTimingFactory {
|
||||
@Override
|
||||
public SwissTimingRaceTracker createRaceTracker(String raceID, String hostname, int port, boolean canSendRequests, long delayToLiveInMillis,
|
||||
WindStore windStore, RaceSpecificMessageLoader messageLoader, DomainFactory domainFactory,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceCommitteeStore raceCommitteeStore) throws InterruptedException, UnknownHostException, IOException,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceLogStore raceLogStore) throws InterruptedException, UnknownHostException, IOException,
|
||||
ParseException {
|
||||
return new SwissTimingRaceTrackerImpl(raceID, hostname, port, windStore, domainFactory, this, messageLoader,
|
||||
trackedRegattaRegistry, canSendRequests, delayToLiveInMillis, raceCommitteeStore);
|
||||
trackedRegattaRegistry, canSendRequests, delayToLiveInMillis, raceLogStore);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceTracker createRaceTracker(Regatta regatta, String raceID, String hostname, int port,
|
||||
boolean canSendRequests, long delayToLiveInMillis, WindStore windStore, RaceSpecificMessageLoader messageLoader,
|
||||
DomainFactory domainFactory, TrackedRegattaRegistry trackedRegattaRegistry,
|
||||
RaceCommitteeStore raceCommitteeStore) throws UnknownHostException,
|
||||
RaceLogStore raceLogStore) throws UnknownHostException,
|
||||
InterruptedException, IOException, ParseException {
|
||||
return new SwissTimingRaceTrackerImpl(regatta, raceID, hostname, port, windStore, domainFactory, this,
|
||||
messageLoader, trackedRegattaRegistry, canSendRequests, delayToLiveInMillis, raceCommitteeStore);
|
||||
messageLoader, trackedRegattaRegistry, canSendRequests, delayToLiveInMillis, raceLogStore);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+7
-7
@@ -24,7 +24,7 @@ import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.TrackedRaceStatusEnum;
|
||||
import com.sap.sailing.domain.common.impl.Util;
|
||||
import com.sap.sailing.domain.common.impl.Util.Triple;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
import com.sap.sailing.domain.swisstimingadapter.Course;
|
||||
import com.sap.sailing.domain.swisstimingadapter.DomainFactory;
|
||||
import com.sap.sailing.domain.swisstimingadapter.Fix;
|
||||
@@ -63,7 +63,7 @@ public class SwissTimingRaceTrackerImpl extends AbstractRaceTrackerImpl implemen
|
||||
private final Triple<String, String, Integer> id;
|
||||
private final Regatta regatta;
|
||||
private final WindStore windStore;
|
||||
private final RaceCommitteeStore raceCommitteeStore;
|
||||
private final RaceLogStore raceLogStore;
|
||||
|
||||
private RaceDefinition race;
|
||||
private Course course;
|
||||
@@ -77,16 +77,16 @@ public class SwissTimingRaceTrackerImpl extends AbstractRaceTrackerImpl implemen
|
||||
protected SwissTimingRaceTrackerImpl(String raceID, String hostname, int port, WindStore windStore,
|
||||
DomainFactory domainFactory, SwissTimingFactory factory, RaceSpecificMessageLoader messageLoader,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, boolean canSendRequests, long delayToLiveInMillis,
|
||||
RaceCommitteeStore raceCommitteeStore) throws InterruptedException,
|
||||
RaceLogStore raceLogStore) throws InterruptedException,
|
||||
UnknownHostException, IOException, ParseException {
|
||||
this(domainFactory.getOrCreateDefaultRegatta(raceID, trackedRegattaRegistry), raceID, hostname, port, windStore, domainFactory, factory,
|
||||
messageLoader, trackedRegattaRegistry, canSendRequests, delayToLiveInMillis, raceCommitteeStore);
|
||||
messageLoader, trackedRegattaRegistry, canSendRequests, delayToLiveInMillis, raceLogStore);
|
||||
}
|
||||
|
||||
protected SwissTimingRaceTrackerImpl(Regatta regatta, String raceID, String hostname, int port, WindStore windStore,
|
||||
DomainFactory domainFactory, SwissTimingFactory factory, RaceSpecificMessageLoader messageLoader,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, boolean canSendRequests, long delayToLiveInMillis,
|
||||
RaceCommitteeStore raceCommitteeStore) throws InterruptedException,
|
||||
RaceLogStore raceLogStore) throws InterruptedException,
|
||||
UnknownHostException, IOException, ParseException {
|
||||
super();
|
||||
this.regatta = regatta;
|
||||
@@ -95,7 +95,7 @@ public class SwissTimingRaceTrackerImpl extends AbstractRaceTrackerImpl implemen
|
||||
this.raceID = raceID;
|
||||
this.messageLoader = messageLoader;
|
||||
this.windStore = windStore;
|
||||
this.raceCommitteeStore = raceCommitteeStore;
|
||||
this.raceLogStore = raceLogStore;
|
||||
this.id = createID(raceID, hostname, port);
|
||||
connector.addSailMasterListener(raceID, this);
|
||||
trackedRegatta = trackedRegattaRegistry.getOrCreateTrackedRegatta(regatta);
|
||||
@@ -305,7 +305,7 @@ public class SwissTimingRaceTrackerImpl extends AbstractRaceTrackerImpl implemen
|
||||
// we already know our single RaceDefinition
|
||||
assert SwissTimingRaceTrackerImpl.this.race == race;
|
||||
}
|
||||
}, raceCommitteeStore);
|
||||
}, raceLogStore);
|
||||
logger.info("Created SwissTiming RaceDefinition and TrackedRace for "+race.getName());
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
package com.sap.sailing.domain.swisstimingadapter.impl;
|
||||
|
||||
import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
import com.sap.sailing.domain.swisstimingadapter.DomainFactory;
|
||||
import com.sap.sailing.domain.swisstimingadapter.RaceSpecificMessageLoader;
|
||||
import com.sap.sailing.domain.swisstimingadapter.SwissTimingFactory;
|
||||
@@ -18,12 +18,12 @@ public class SwissTimingTrackingConnectivityParameters implements RaceTrackingCo
|
||||
private final SwissTimingFactory swissTimingFactory;
|
||||
private final DomainFactory domainFactory;
|
||||
private final WindStore windStore;
|
||||
private final RaceCommitteeStore raceCommitteeStore;
|
||||
private final RaceLogStore raceLogStore;
|
||||
private final RaceSpecificMessageLoader messageLoader;
|
||||
private final long delayToLiveInMillis;
|
||||
|
||||
public SwissTimingTrackingConnectivityParameters(String hostname, int port, String raceID, boolean canSendRequests, long delayToLiveInMillis,
|
||||
SwissTimingFactory swissTimingFactory, DomainFactory domainFactory, WindStore windStore, RaceCommitteeStore raceCommitteeStore,
|
||||
SwissTimingFactory swissTimingFactory, DomainFactory domainFactory, WindStore windStore, RaceLogStore raceLogStore,
|
||||
RaceSpecificMessageLoader messageLoader) {
|
||||
super();
|
||||
this.hostname = hostname;
|
||||
@@ -34,21 +34,21 @@ public class SwissTimingTrackingConnectivityParameters implements RaceTrackingCo
|
||||
this.swissTimingFactory = swissTimingFactory;
|
||||
this.domainFactory = domainFactory;
|
||||
this.windStore = windStore;
|
||||
this.raceCommitteeStore = raceCommitteeStore;
|
||||
this.raceLogStore = raceLogStore;
|
||||
this.messageLoader = messageLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceTracker createRaceTracker(TrackedRegattaRegistry trackedRegattaRegistry) throws Exception {
|
||||
return swissTimingFactory.createRaceTracker(raceID, hostname, port, canSendRequests, delayToLiveInMillis, windStore, messageLoader,
|
||||
domainFactory, trackedRegattaRegistry, raceCommitteeStore);
|
||||
domainFactory, trackedRegattaRegistry, raceLogStore);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceTracker createRaceTracker(Regatta regatta, TrackedRegattaRegistry trackedRegattaRegistry)
|
||||
throws Exception {
|
||||
return swissTimingFactory.createRaceTracker(regatta, raceID, hostname, port, canSendRequests, delayToLiveInMillis, windStore, messageLoader,
|
||||
domainFactory, trackedRegattaRegistry, raceCommitteeStore);
|
||||
domainFactory, trackedRegattaRegistry, raceLogStore);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -35,7 +35,7 @@ import com.sap.sailing.domain.common.impl.DegreeBearingImpl;
|
||||
import com.sap.sailing.domain.common.impl.DegreePosition;
|
||||
import com.sap.sailing.domain.common.impl.Util;
|
||||
import com.sap.sailing.domain.common.impl.WindSourceWithAdditionalID;
|
||||
import com.sap.sailing.domain.racecommittee.impl.EmptyRaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.impl.EmptyRaceLogStore;
|
||||
import com.sap.sailing.domain.swisstimingadapter.DomainFactory;
|
||||
import com.sap.sailing.domain.swisstimingreplayadapter.CompetitorStatus;
|
||||
import com.sap.sailing.domain.swisstimingreplayadapter.SwissTimingReplayListener;
|
||||
@@ -309,7 +309,7 @@ public class SwissTimingReplayToDomainAdapter extends SwissTimingReplayAdapter {
|
||||
createTrackedRace(race, EmptyWindStore.INSTANCE, TrackedRace.DEFAULT_LIVE_DELAY_IN_MILLISECONDS,
|
||||
WindTrack.DEFAULT_MILLISECONDS_OVER_WHICH_TO_AVERAGE_WIND,
|
||||
/* time over which to average speed: */ race.getBoatClass().getApproximateManeuverDurationInMilliseconds(),
|
||||
/* raceDefinitionSetToUpdate */ null, EmptyRaceCommitteeStore.INSTANCE);
|
||||
/* raceDefinitionSetToUpdate */ null, EmptyRaceLogStore.INSTANCE);
|
||||
trackedRace.setStatus(new TrackedRaceStatusImpl(TrackedRaceStatusEnum.LOADING, 0));
|
||||
TimePoint bestStartTimeKnownSoFar = bestStartTimePerRaceID.get(currentRaceID);
|
||||
if (bestStartTimeKnownSoFar != null) {
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.sap.sailing.domain.base.impl.MarkImpl;
|
||||
import com.sap.sailing.domain.base.impl.RaceDefinitionImpl;
|
||||
import com.sap.sailing.domain.base.impl.WaypointImpl;
|
||||
import com.sap.sailing.domain.common.impl.Util;
|
||||
import com.sap.sailing.domain.racecommittee.impl.EmptyRaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.impl.EmptyRaceLogStore;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRace;
|
||||
import com.sap.sailing.domain.tracking.TrackedLeg;
|
||||
import com.sap.sailing.domain.tracking.impl.DynamicTrackedRaceImpl;
|
||||
@@ -245,7 +245,7 @@ public class CourseTest {
|
||||
EmptyWindStore.INSTANCE, /* delayToLiveInMillis */ 3000,
|
||||
/* millisecondsOverWhichToAverageWind */ 30000,
|
||||
/* millisecondsOverWhichToAverageSpeed */ 8000,
|
||||
EmptyRaceCommitteeStore.INSTANCE);
|
||||
EmptyRaceLogStore.INSTANCE);
|
||||
assertLegStructure(course, trackedRace);
|
||||
course.removeWaypoint(0);
|
||||
assertLegStructure(course, trackedRace);
|
||||
@@ -276,7 +276,7 @@ public class CourseTest {
|
||||
EmptyWindStore.INSTANCE, /* delayToLiveInMillis */ 3000,
|
||||
/* millisecondsOverWhichToAverageWind */ 30000,
|
||||
/* millisecondsOverWhichToAverageSpeed */ 8000,
|
||||
EmptyRaceCommitteeStore.INSTANCE);
|
||||
EmptyRaceLogStore.INSTANCE);
|
||||
assertLegStructure(course, trackedRace);
|
||||
final WaypointImpl wp1_5 = new WaypointImpl(new MarkImpl("Test Mark 1.5"));
|
||||
assertWaypointIndexes(course);
|
||||
|
||||
+2
-2
@@ -31,7 +31,7 @@ import com.sap.sailing.domain.base.impl.MarkImpl;
|
||||
import com.sap.sailing.domain.base.impl.WaypointImpl;
|
||||
import com.sap.sailing.domain.common.impl.Util;
|
||||
import com.sap.sailing.domain.common.impl.Util.Triple;
|
||||
import com.sap.sailing.domain.racecommittee.impl.EmptyRaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.impl.EmptyRaceLogStore;
|
||||
import com.sap.sailing.domain.tracking.DynamicRaceDefinitionSet;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRegatta;
|
||||
import com.sap.sailing.domain.tracking.TrackedLeg;
|
||||
@@ -79,7 +79,7 @@ public class CourseUpdateTest extends AbstractTracTracLiveTest {
|
||||
public void addRaceDefinition(RaceDefinition race) {}
|
||||
}, /* delayToLiveInMillis */ 0l,
|
||||
/* millisecondsOverWhichToAverageWind */ 30000, /* simulator */ null,
|
||||
EmptyRaceCommitteeStore.INSTANCE) {
|
||||
EmptyRaceLogStore.INSTANCE) {
|
||||
@Override
|
||||
protected void handleEvent(Triple<Route, RouteData, Race> event) {
|
||||
super.handleEvent(event);
|
||||
|
||||
+5
-5
@@ -15,7 +15,7 @@ import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.domain.racecommittee.impl.EmptyRaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.impl.EmptyRaceLogStore;
|
||||
import com.sap.sailing.domain.tracking.impl.EmptyWindStore;
|
||||
import com.sap.sailing.domain.tractracadapter.DomainFactory;
|
||||
import com.sap.sailing.domain.tractracadapter.TracTracConnectionConstants;
|
||||
@@ -51,28 +51,28 @@ public class MultipleClassesInRegattaTest {
|
||||
httpAndHost+"/events/event_20110505_SailingTea/clientparams.php?event=event_20110505_SailingTea&race=cce678c8-97e6-11e0-9aed-406186cbf87c"),
|
||||
new URI(liveURI), new URI(storedURI),
|
||||
/* startOfTracking */ null, /* endOfTracking */ null, /* delayToLiveInMillis */ 0l, /* simulateWithStartTimeNow */ false,
|
||||
EmptyWindStore.INSTANCE, new DummyTrackedRegattaRegistry(), EmptyRaceCommitteeStore.INSTANCE);
|
||||
EmptyWindStore.INSTANCE, new DummyTrackedRegattaRegistry(), EmptyRaceLogStore.INSTANCE);
|
||||
kiwotest2 = domainFactory
|
||||
.createRaceTracker(
|
||||
new URL(
|
||||
httpAndHost+"/events/event_20110505_SailingTea/clientparams.php?event=event_20110505_SailingTea&race=11290bd6-97e7-11e0-9aed-406186cbf87c"),
|
||||
new URI(liveURI), new URI(storedURI),
|
||||
/* startOfTracking */ null, /* endOfTracking */ null, /* delayToLiveInMillis */ 0l, /* simulateWithStartTimeNow */ false, EmptyWindStore.INSTANCE, new DummyTrackedRegattaRegistry(),
|
||||
EmptyRaceCommitteeStore.INSTANCE);
|
||||
EmptyRaceLogStore.INSTANCE);
|
||||
kiwotest3 = domainFactory
|
||||
.createRaceTracker(
|
||||
new URL(
|
||||
httpAndHost+"/events/event_20110505_SailingTea/clientparams.php?event=event_20110505_SailingTea&race=39635b24-97e7-11e0-9aed-406186cbf87c"),
|
||||
new URI(liveURI), new URI(storedURI),
|
||||
/* startOfTracking */ null, /* endOfTracking */ null, /* delayToLiveInMillis */ 0l, /* simulateWithStartTimeNow */ false, EmptyWindStore.INSTANCE, new DummyTrackedRegattaRegistry(),
|
||||
EmptyRaceCommitteeStore.INSTANCE);
|
||||
EmptyRaceLogStore.INSTANCE);
|
||||
weym470may112014_2 = domainFactory
|
||||
.createRaceTracker(
|
||||
new URL(
|
||||
httpAndHost+"/events/event_20110505_SailingTea/clientparams.php?event=event_20110505_SailingTea&race=04498426-7dfd-11e0-8236-406186cbf87c"),
|
||||
new URI(liveURI), new URI(storedURI),
|
||||
/* startOfTracking */ null, /* endOfTracking */ null, /* delayToLiveInMillis */ 0l, /* simulateWithStartTimeNow */ false, EmptyWindStore.INSTANCE, new DummyTrackedRegattaRegistry(),
|
||||
EmptyRaceCommitteeStore.INSTANCE);
|
||||
EmptyRaceLogStore.INSTANCE);
|
||||
|
||||
assertEquals("STG", kiwotest1.getRegatta().getBoatClass().getName());
|
||||
assertEquals("505", kiwotest2.getRegatta().getBoatClass().getName());
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@ import com.sap.sailing.domain.base.impl.MillisecondsTimePoint;
|
||||
import com.sap.sailing.domain.common.Position;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.impl.DegreePosition;
|
||||
import com.sap.sailing.domain.racecommittee.impl.EmptyRaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.impl.EmptyRaceLogStore;
|
||||
import com.sap.sailing.domain.tracking.DynamicRaceDefinitionSet;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRegatta;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRace;
|
||||
@@ -90,7 +90,7 @@ public abstract class OnlineTracTracBasedTest extends AbstractTracTracLiveTest {
|
||||
throws InterruptedException {
|
||||
setStoredDataLoaded(false);
|
||||
ArrayList<Receiver> receivers = new ArrayList<Receiver>();
|
||||
for (Receiver r : domainFactory.getUpdateReceivers(trackedRegatta, getTracTracEvent(), EmptyWindStore.INSTANCE, EmptyRaceCommitteeStore.INSTANCE,
|
||||
for (Receiver r : domainFactory.getUpdateReceivers(trackedRegatta, getTracTracEvent(), EmptyWindStore.INSTANCE, EmptyRaceLogStore.INSTANCE,
|
||||
/* startOfTracking */null, /* endOfTracking */null, /* delayToLiveInMillis */0l, /* simulator */ null,
|
||||
new DynamicRaceDefinitionSet() {
|
||||
@Override
|
||||
|
||||
+31
-31
@@ -1,31 +1,31 @@
|
||||
package com.sap.sailing.domain.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.impl.MillisecondsTimePoint;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.racecommittee.Flags;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEventFactory;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeFlagEvent;
|
||||
|
||||
public class RaceCommitteeEventTest {
|
||||
|
||||
@Test
|
||||
public void testEqualityOfTwoNotSameEvents() {
|
||||
TimePoint t1 = MillisecondsTimePoint.now();
|
||||
int passId = 0;
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
RaceCommitteeFlagEvent rcEvent1 = RaceCommitteeEventFactory.INSTANCE.createFlagEvent(t1, randomUUID, new ArrayList<Competitor>(), passId, Flags.CLASS, Flags.NONE, false);
|
||||
RaceCommitteeFlagEvent rcEvent2 = RaceCommitteeEventFactory.INSTANCE.createFlagEvent(t1, randomUUID, new ArrayList<Competitor>(), passId, Flags.CLASS, Flags.NONE, false);
|
||||
assertNotSame(rcEvent1, rcEvent2);
|
||||
assertEquals(rcEvent1, rcEvent2);
|
||||
}
|
||||
|
||||
}
|
||||
package com.sap.sailing.domain.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.impl.MillisecondsTimePoint;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.racelog.Flags;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEventFactory;
|
||||
import com.sap.sailing.domain.racelog.RaceLogFlagEvent;
|
||||
|
||||
public class RaceLogEventTest {
|
||||
|
||||
@Test
|
||||
public void testEqualityOfTwoNotSameEvents() {
|
||||
TimePoint t1 = MillisecondsTimePoint.now();
|
||||
int passId = 0;
|
||||
UUID randomUUID = UUID.randomUUID();
|
||||
RaceLogFlagEvent rcEvent1 = RaceLogEventFactory.INSTANCE.createFlagEvent(t1, randomUUID, new ArrayList<Competitor>(), passId, Flags.CLASS, Flags.NONE, false);
|
||||
RaceLogFlagEvent rcEvent2 = RaceLogEventFactory.INSTANCE.createFlagEvent(t1, randomUUID, new ArrayList<Competitor>(), passId, Flags.CLASS, Flags.NONE, false);
|
||||
assertNotSame(rcEvent1, rcEvent2);
|
||||
assertEquals(rcEvent1, rcEvent2);
|
||||
}
|
||||
|
||||
}
|
||||
+20
-20
@@ -15,13 +15,13 @@ import com.sap.sailing.domain.base.impl.CompetitorImpl;
|
||||
import com.sap.sailing.domain.base.impl.MillisecondsTimePoint;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.impl.Util;
|
||||
import com.sap.sailing.domain.racecommittee.Flags;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEventTrack;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEventFactory;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeFlagEvent;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStartTimeEvent;
|
||||
import com.sap.sailing.domain.racelog.Flags;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEventFactory;
|
||||
import com.sap.sailing.domain.racelog.RaceLog;
|
||||
import com.sap.sailing.domain.racelog.RaceLogFlagEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStartTimeEvent;
|
||||
|
||||
public class RaceCommitteeEventsOnConstructedTrackedRaceTest extends TrackBasedTest {
|
||||
public class RaceLogEventsOnConstructedTrackedRaceTest extends TrackBasedTest {
|
||||
|
||||
private List<Competitor> competitors;
|
||||
private CompetitorImpl plattner;
|
||||
@@ -44,8 +44,8 @@ public class RaceCommitteeEventsOnConstructedTrackedRaceTest extends TrackBasedT
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRaceCommitteeEventTrackExists() {
|
||||
RaceCommitteeEventTrack track = getTrackedRace().getRaceCommitteeEventTrack();
|
||||
public void testRaceLogExists() {
|
||||
RaceLog track = getTrackedRace().getRaceLog();
|
||||
assertNotNull(track);
|
||||
|
||||
track.lockForRead();
|
||||
@@ -58,8 +58,8 @@ public class RaceCommitteeEventsOnConstructedTrackedRaceTest extends TrackBasedT
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRaceCommitteeEventTrackInsertSomeEvents() {
|
||||
RaceCommitteeEventTrack track = getTrackedRace().getRaceCommitteeEventTrack();
|
||||
public void testRaceLogInsertSomeEvents() {
|
||||
RaceLog track = getTrackedRace().getRaceLog();
|
||||
assertNotNull(track);
|
||||
|
||||
TimePoint t1 = MillisecondsTimePoint.now();
|
||||
@@ -69,17 +69,17 @@ public class RaceCommitteeEventsOnConstructedTrackedRaceTest extends TrackBasedT
|
||||
TimePoint t5 = new MillisecondsTimePoint(t1.asMillis() - 10000);
|
||||
|
||||
int passId = 0;
|
||||
RaceCommitteeFlagEvent rcEvent1 = RaceCommitteeEventFactory.INSTANCE.createFlagEvent(t1, passId, Flags.CLASS, Flags.NONE, false);
|
||||
RaceCommitteeFlagEvent rcEvent2 = RaceCommitteeEventFactory.INSTANCE.createFlagEvent(t2, passId, Flags.PAPA, Flags.NONE, false);
|
||||
RaceCommitteeFlagEvent rcEvent3 = RaceCommitteeEventFactory.INSTANCE.createFlagEvent(t3, passId, Flags.PAPA, Flags.NONE, true);
|
||||
RaceCommitteeFlagEvent rcEvent4 = RaceCommitteeEventFactory.INSTANCE.createFlagEvent(t4, passId, Flags.CLASS, Flags.NONE, true);
|
||||
RaceCommitteeStartTimeEvent rcEvent5 = RaceCommitteeEventFactory.INSTANCE.createStartTimeEvent(t5, passId, t1);
|
||||
RaceLogFlagEvent rcEvent1 = RaceLogEventFactory.INSTANCE.createFlagEvent(t1, passId, Flags.CLASS, Flags.NONE, false);
|
||||
RaceLogFlagEvent rcEvent2 = RaceLogEventFactory.INSTANCE.createFlagEvent(t2, passId, Flags.PAPA, Flags.NONE, false);
|
||||
RaceLogFlagEvent rcEvent3 = RaceLogEventFactory.INSTANCE.createFlagEvent(t3, passId, Flags.PAPA, Flags.NONE, true);
|
||||
RaceLogFlagEvent rcEvent4 = RaceLogEventFactory.INSTANCE.createFlagEvent(t4, passId, Flags.CLASS, Flags.NONE, true);
|
||||
RaceLogStartTimeEvent rcEvent5 = RaceLogEventFactory.INSTANCE.createStartTimeEvent(t5, passId, t1);
|
||||
|
||||
getTrackedRace().recordRaceCommitteeEvent(rcEvent1);
|
||||
getTrackedRace().recordRaceCommitteeEvent(rcEvent2);
|
||||
getTrackedRace().recordRaceCommitteeEvent(rcEvent3);
|
||||
getTrackedRace().recordRaceCommitteeEvent(rcEvent4);
|
||||
getTrackedRace().recordRaceCommitteeEvent(rcEvent5);
|
||||
getTrackedRace().recordRaceLogEvent(rcEvent1);
|
||||
getTrackedRace().recordRaceLogEvent(rcEvent2);
|
||||
getTrackedRace().recordRaceLogEvent(rcEvent3);
|
||||
getTrackedRace().recordRaceLogEvent(rcEvent4);
|
||||
getTrackedRace().recordRaceLogEvent(rcEvent5);
|
||||
|
||||
track.lockForRead();
|
||||
try {
|
||||
+23
-23
@@ -12,28 +12,28 @@ import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.domain.base.impl.MillisecondsTimePoint;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.racecommittee.Flags;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEvent;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEventFactory;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEventTrack;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeFlagEvent;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStartTimeEvent;
|
||||
import com.sap.sailing.domain.racecommittee.impl.RaceCommitteeEventTrackImpl;
|
||||
import com.sap.sailing.domain.racelog.Flags;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEventFactory;
|
||||
import com.sap.sailing.domain.racelog.RaceLog;
|
||||
import com.sap.sailing.domain.racelog.RaceLogFlagEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStartTimeEvent;
|
||||
import com.sap.sailing.domain.racelog.impl.RaceLogImpl;
|
||||
|
||||
public class RaceCommitteeTrackTest {
|
||||
public class RaceLogTest {
|
||||
|
||||
@Test
|
||||
public void testAddOfEvent() {
|
||||
RaceCommitteeEventTrack rcEventTrack = new RaceCommitteeEventTrackImpl("RaceCommitteeEventTrack");
|
||||
RaceLog rcEventTrack = new RaceLogImpl("RaceLogTest");
|
||||
TimePoint t1 = MillisecondsTimePoint.now();
|
||||
int passId = 0;
|
||||
boolean isDisplayed = true;
|
||||
RaceCommitteeFlagEvent rcEvent = RaceCommitteeEventFactory.INSTANCE.createFlagEvent(t1, passId, Flags.CLASS, Flags.NONE, isDisplayed);
|
||||
RaceLogFlagEvent rcEvent = RaceLogEventFactory.INSTANCE.createFlagEvent(t1, passId, Flags.CLASS, Flags.NONE, isDisplayed);
|
||||
rcEventTrack.add(rcEvent);
|
||||
|
||||
rcEventTrack.lockForRead();
|
||||
try {
|
||||
Iterator<RaceCommitteeEvent> iterator = rcEventTrack.getFixes().iterator();
|
||||
Iterator<RaceLogEvent> iterator = rcEventTrack.getFixes().iterator();
|
||||
int count = 0;
|
||||
|
||||
do
|
||||
@@ -53,8 +53,8 @@ public class RaceCommitteeTrackTest {
|
||||
|
||||
@Test
|
||||
public void testTrackAPIForEventLogUsage() {
|
||||
RaceCommitteeEventTrack rcEventTrack = new RaceCommitteeEventTrackImpl("RaceCommitteeEventTrack");
|
||||
List<RaceCommitteeEvent> expectedOrderingList = new ArrayList<RaceCommitteeEvent>();
|
||||
RaceLog rcEventTrack = new RaceLogImpl("RaceLog");
|
||||
List<RaceLogEvent> expectedOrderingList = new ArrayList<RaceLogEvent>();
|
||||
TimePoint t1 = MillisecondsTimePoint.now();
|
||||
TimePoint t2 = new MillisecondsTimePoint(t1.asMillis() - 1000);
|
||||
TimePoint t3 = new MillisecondsTimePoint(t1.asMillis() - 4000);
|
||||
@@ -64,11 +64,11 @@ public class RaceCommitteeTrackTest {
|
||||
TimePoint tx = new MillisecondsTimePoint(t1.asMillis() - 7000);
|
||||
|
||||
int passId = 0;
|
||||
RaceCommitteeFlagEvent rcEvent1 = RaceCommitteeEventFactory.INSTANCE.createFlagEvent(t1, passId, Flags.CLASS, Flags.NONE, false);
|
||||
RaceCommitteeFlagEvent rcEvent2 = RaceCommitteeEventFactory.INSTANCE.createFlagEvent(t2, passId, Flags.PAPA, Flags.NONE, false);
|
||||
RaceCommitteeFlagEvent rcEvent3 = RaceCommitteeEventFactory.INSTANCE.createFlagEvent(t3, passId, Flags.PAPA, Flags.NONE, true);
|
||||
RaceCommitteeFlagEvent rcEvent4 = RaceCommitteeEventFactory.INSTANCE.createFlagEvent(t4, passId, Flags.CLASS, Flags.NONE, true);
|
||||
RaceCommitteeStartTimeEvent rcEvent5 = RaceCommitteeEventFactory.INSTANCE.createStartTimeEvent(t5, passId, t1);
|
||||
RaceLogFlagEvent rcEvent1 = RaceLogEventFactory.INSTANCE.createFlagEvent(t1, passId, Flags.CLASS, Flags.NONE, false);
|
||||
RaceLogFlagEvent rcEvent2 = RaceLogEventFactory.INSTANCE.createFlagEvent(t2, passId, Flags.PAPA, Flags.NONE, false);
|
||||
RaceLogFlagEvent rcEvent3 = RaceLogEventFactory.INSTANCE.createFlagEvent(t3, passId, Flags.PAPA, Flags.NONE, true);
|
||||
RaceLogFlagEvent rcEvent4 = RaceLogEventFactory.INSTANCE.createFlagEvent(t4, passId, Flags.CLASS, Flags.NONE, true);
|
||||
RaceLogStartTimeEvent rcEvent5 = RaceLogEventFactory.INSTANCE.createStartTimeEvent(t5, passId, t1);
|
||||
|
||||
rcEventTrack.add(rcEvent5);
|
||||
rcEventTrack.add(rcEvent3);
|
||||
@@ -85,13 +85,13 @@ public class RaceCommitteeTrackTest {
|
||||
rcEventTrack.lockForRead();
|
||||
try {
|
||||
|
||||
Iterator<RaceCommitteeEvent> iterator = rcEventTrack.getFixes().iterator();
|
||||
Iterator<RaceLogEvent> iterator = rcEventTrack.getFixes().iterator();
|
||||
checkOrderingAndListLength(expectedOrderingList, iterator, 0, 5);
|
||||
|
||||
iterator = rcEventTrack.getRawFixes().iterator();
|
||||
checkOrderingAndListLength(expectedOrderingList, iterator, 0, 5);
|
||||
|
||||
RaceCommitteeEvent event = rcEventTrack.getFirstRawFix();
|
||||
RaceLogEvent event = rcEventTrack.getFirstRawFix();
|
||||
checkEquality(rcEvent5, event);
|
||||
|
||||
event = rcEventTrack.getLastRawFix();
|
||||
@@ -133,12 +133,12 @@ public class RaceCommitteeTrackTest {
|
||||
}
|
||||
}
|
||||
|
||||
private void checkOrderingAndListLength(List<RaceCommitteeEvent> expectedOrderingList, Iterator<RaceCommitteeEvent> iterator, int countOffset, int expectedLength) {
|
||||
private void checkOrderingAndListLength(List<RaceLogEvent> expectedOrderingList, Iterator<RaceLogEvent> iterator, int countOffset, int expectedLength) {
|
||||
int count = 0;
|
||||
|
||||
while(iterator.hasNext())
|
||||
{
|
||||
RaceCommitteeEvent event = iterator.next();
|
||||
RaceLogEvent event = iterator.next();
|
||||
assertEquals(event, expectedOrderingList.get(count + countOffset));
|
||||
count++;
|
||||
}
|
||||
@@ -149,7 +149,7 @@ public class RaceCommitteeTrackTest {
|
||||
}
|
||||
|
||||
|
||||
private void checkEquality(RaceCommitteeEvent knownRcEvent, RaceCommitteeEvent trackEvent) {
|
||||
private void checkEquality(RaceLogEvent knownRcEvent, RaceLogEvent trackEvent) {
|
||||
if (trackEvent != null) {
|
||||
assertEquals(trackEvent, knownRcEvent);
|
||||
} else {
|
||||
+2
-2
@@ -40,7 +40,7 @@ import com.sap.sailing.domain.common.WindSourceType;
|
||||
import com.sap.sailing.domain.common.impl.DegreeBearingImpl;
|
||||
import com.sap.sailing.domain.common.impl.DegreePosition;
|
||||
import com.sap.sailing.domain.common.impl.WindSourceImpl;
|
||||
import com.sap.sailing.domain.racecommittee.impl.EmptyRaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.impl.EmptyRaceLogStore;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRace;
|
||||
import com.sap.sailing.domain.tracking.MarkPassing;
|
||||
import com.sap.sailing.domain.tracking.TrackedLeg;
|
||||
@@ -103,7 +103,7 @@ public class ReachingLegTest extends TrackBasedTest {
|
||||
/* delayToLiveInMillis */ 0,
|
||||
/* millisecondsOverWhichToAverageWind */ 30000, /* millisecondsOverWhichToAverageSpeed */ 30000,
|
||||
/* delay for wind estimation cache invalidation */ 0,
|
||||
EmptyRaceCommitteeStore.INSTANCE);
|
||||
EmptyRaceLogStore.INSTANCE);
|
||||
// in this simplified artificial course, the top mark is exactly north of the right leeward gate, the offset
|
||||
// mark is slightly west of the top mark; wind from the north makes the leg from top to offset a reaching leg
|
||||
Position leftPosition = new DegreePosition(0, -0.00001);
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@ import org.junit.Test;
|
||||
import com.maptrack.client.io.TypeController;
|
||||
import com.sap.sailing.domain.base.RaceDefinition;
|
||||
import com.sap.sailing.domain.base.Waypoint;
|
||||
import com.sap.sailing.domain.racecommittee.impl.EmptyRaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.impl.EmptyRaceLogStore;
|
||||
import com.sap.sailing.domain.tracking.DynamicRaceDefinitionSet;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRace;
|
||||
import com.sap.sailing.domain.tracking.impl.DynamicTrackedRegattaImpl;
|
||||
@@ -96,7 +96,7 @@ public class ReceiveMarkPassingDataTest extends AbstractTracTracLiveTest {
|
||||
receivers.add(receiver);
|
||||
for (Receiver r : DomainFactory.INSTANCE.getUpdateReceivers(
|
||||
new DynamicTrackedRegattaImpl(DomainFactory.INSTANCE.getOrCreateDefaultRegatta(getTracTracEvent(), /* trackedRegattaRegistry */ null)),
|
||||
getTracTracEvent(), EmptyWindStore.INSTANCE, EmptyRaceCommitteeStore.INSTANCE, /* startOfTracking */ null, /* endOfTracking */ null, /* delayToLiveInMillis */ 0l,
|
||||
getTracTracEvent(), EmptyWindStore.INSTANCE, EmptyRaceLogStore.INSTANCE, /* startOfTracking */ null, /* endOfTracking */ null, /* delayToLiveInMillis */ 0l,
|
||||
/* simulator */ null, new DynamicRaceDefinitionSet() {
|
||||
@Override
|
||||
public void addRaceDefinition(RaceDefinition race) {}
|
||||
|
||||
+3
-3
@@ -14,7 +14,7 @@ import com.maptrack.client.io.TypeController;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.base.RaceDefinition;
|
||||
import com.sap.sailing.domain.racecommittee.impl.EmptyRaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.impl.EmptyRaceLogStore;
|
||||
import com.sap.sailing.domain.tracking.DynamicRaceDefinitionSet;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRegatta;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRace;
|
||||
@@ -84,7 +84,7 @@ public class ReceiveTrackingDataTest extends AbstractTracTracLiveTest {
|
||||
@Override
|
||||
public void addRaceDefinition(RaceDefinition race) {
|
||||
}
|
||||
}, /* trackedRegattaRegistry */ null, EmptyRaceCommitteeStore.INSTANCE)) {
|
||||
}, /* trackedRegattaRegistry */ null, EmptyRaceLogStore.INSTANCE)) {
|
||||
for (TypeController raceListener : receiver.getTypeControllersAndStart()) {
|
||||
listeners.add(raceListener);
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public class ReceiveTrackingDataTest extends AbstractTracTracLiveTest {
|
||||
@Override
|
||||
public void addRaceDefinition(RaceDefinition race) {
|
||||
}
|
||||
}, /* trackedRegattaRegistry */ null, EmptyRaceCommitteeStore.INSTANCE));
|
||||
}, /* trackedRegattaRegistry */ null, EmptyRaceLogStore.INSTANCE));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@ import com.sap.sailing.domain.common.WindSourceType;
|
||||
import com.sap.sailing.domain.common.impl.DegreeBearingImpl;
|
||||
import com.sap.sailing.domain.common.impl.DegreePosition;
|
||||
import com.sap.sailing.domain.common.impl.WindSourceImpl;
|
||||
import com.sap.sailing.domain.racecommittee.impl.EmptyRaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.impl.EmptyRaceLogStore;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRace;
|
||||
import com.sap.sailing.domain.tracking.MarkPassing;
|
||||
import com.sap.sailing.domain.tracking.TrackedRegatta;
|
||||
@@ -113,7 +113,7 @@ public abstract class TrackBasedTest {
|
||||
/* delayToLiveInMillis */ 0,
|
||||
/* millisecondsOverWhichToAverageWind */ 30000, /* millisecondsOverWhichToAverageSpeed */ 30000,
|
||||
/* delay for wind estimation cache invalidation */ 0,
|
||||
EmptyRaceCommitteeStore.INSTANCE);
|
||||
EmptyRaceLogStore.INSTANCE);
|
||||
// in this simplified artificial course, the top mark is exactly north of the right leeward gate
|
||||
DegreePosition topPosition = new DegreePosition(54.48, 10.24);
|
||||
TimePoint afterTheRace = new MillisecondsTimePoint(timePointForFixes.asMillis() + 36000000); // 10h after the fix time
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.racecommittee.impl.EmptyRaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.impl.EmptyRaceLogStore;
|
||||
import com.sap.sailing.domain.tracking.impl.EmptyWindStore;
|
||||
import com.sap.sailing.domain.tractracadapter.DomainFactory;
|
||||
import com.sap.sailing.domain.tractracadapter.TracTracConnectionConstants;
|
||||
@@ -55,7 +55,7 @@ public class UnicodeCharactersInCompetitorNamesTest {
|
||||
+ TracTracConnectionConstants.PORT_STORED),
|
||||
/* startOfTracking */null, /* endOfTracking */null, /* delayToLiveInMillis */0l,
|
||||
/* simulateWithStartTimeNow */ false, EmptyWindStore.INSTANCE,
|
||||
new DummyTrackedRegattaRegistry(), EmptyRaceCommitteeStore.INSTANCE);
|
||||
new DummyTrackedRegattaRegistry(), EmptyRaceLogStore.INSTANCE);
|
||||
|
||||
Iterable<Competitor> competitors = fourtyninerYellow_2.getRacesHandle().getRaces().iterator().next()
|
||||
.getCompetitors();
|
||||
|
||||
@@ -36,7 +36,7 @@ import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.impl.DegreeBearingImpl;
|
||||
import com.sap.sailing.domain.common.impl.DegreePosition;
|
||||
import com.sap.sailing.domain.common.impl.Util;
|
||||
import com.sap.sailing.domain.racecommittee.impl.EmptyRaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.impl.EmptyRaceLogStore;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRace;
|
||||
import com.sap.sailing.domain.tracking.MarkPassing;
|
||||
import com.sap.sailing.domain.tracking.Wind;
|
||||
@@ -270,7 +270,7 @@ public class WindTest {
|
||||
EmptyWindStore.INSTANCE, /* delayToLiveInMillis */ 1000,
|
||||
/* millisecondsOverWhichToAverageWind */ 30000,
|
||||
/* millisecondsOverWhichToAverageSpeed */ 30000,
|
||||
EmptyRaceCommitteeStore.INSTANCE);
|
||||
EmptyRaceLogStore.INSTANCE);
|
||||
TimePoint start = MillisecondsTimePoint.now();
|
||||
TimePoint topMarkRounding = start.plus(30000);
|
||||
TimePoint finish = topMarkRounding.plus(30000);
|
||||
|
||||
+8
-8
@@ -25,9 +25,9 @@ import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.common.WindSourceType;
|
||||
import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
import com.sap.sailing.domain.leaderboard.ScoringScheme;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEvent;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEventTrack;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLog;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
import com.sap.sailing.domain.tracking.DynamicGPSFixTrack;
|
||||
import com.sap.sailing.domain.tracking.DynamicRaceDefinitionSet;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRegatta;
|
||||
@@ -453,7 +453,7 @@ public class MockedTrackedRace implements DynamicTrackedRace {
|
||||
@Override
|
||||
public DynamicTrackedRace createTrackedRace(RaceDefinition raceDefinition, WindStore windStore,
|
||||
long delayToLiveInMillis, long millisecondsOverWhichToAverageWind, long millisecondsOverWhichToAverageSpeed,
|
||||
DynamicRaceDefinitionSet raceDefinitionSetToUpdate, RaceCommitteeStore raceCommitteeStore) {
|
||||
DynamicRaceDefinitionSet raceDefinitionSetToUpdate, RaceLogStore raceLogStore) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
@@ -701,13 +701,13 @@ public class MockedTrackedRace implements DynamicTrackedRace {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceCommitteeEventTrack getRaceCommitteeEventTrack() {
|
||||
public RaceLog getRaceLog() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordRaceCommitteeEvent(RaceCommitteeEvent event) {
|
||||
public void recordRaceLogEvent(RaceLogEvent event) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
@@ -724,14 +724,14 @@ public class MockedTrackedRace implements DynamicTrackedRace {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void waitUntilRaceCommitteeEventLoadingComplete()
|
||||
public void waitUntilRaceLogLoadingComplete()
|
||||
throws InterruptedException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceCommitteeStore getRaceCommitteeStore() {
|
||||
public RaceLogStore getRaceLogStore() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
+5
-5
@@ -21,8 +21,8 @@ import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.common.WindSourceType;
|
||||
import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEventTrack;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.RaceLog;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
import com.sap.sailing.domain.tracking.GPSFix;
|
||||
import com.sap.sailing.domain.tracking.GPSFixMoving;
|
||||
import com.sap.sailing.domain.tracking.GPSFixTrack;
|
||||
@@ -456,7 +456,7 @@ public class MockedTrackedRaceWithStartTimeAndRanks implements TrackedRace {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceCommitteeEventTrack getRaceCommitteeEventTrack() {
|
||||
public RaceLog getRaceLog() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
@@ -472,14 +472,14 @@ public class MockedTrackedRaceWithStartTimeAndRanks implements TrackedRace {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void waitUntilRaceCommitteeEventLoadingComplete()
|
||||
public void waitUntilRaceLogLoadingComplete()
|
||||
throws InterruptedException {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceCommitteeStore getRaceCommitteeStore() {
|
||||
public RaceLogStore getRaceLogStore() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
+12
-12
@@ -22,7 +22,7 @@ import com.sap.sailing.domain.base.Team;
|
||||
import com.sap.sailing.domain.base.Waypoint;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
import com.sap.sailing.domain.tracking.DynamicRaceDefinitionSet;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRace;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRegatta;
|
||||
@@ -123,23 +123,23 @@ public interface DomainFactory {
|
||||
* Provides the capability to obtain the {@link WindTrack}s for the different wind sources. A trivial
|
||||
* implementation is {@link EmptyWindStore} which simply provides new, empty tracks. This is always
|
||||
* available but loses track of the wind, e.g., during server restarts.
|
||||
* @param raceCommitteeStore
|
||||
* Provides the capability to obtain the {@link RaceCommitteeTrack} for the race. A trivial
|
||||
* implementation is {@link EmptyRaceCommitteeStore} which simply provides new, empty tracks. This is always
|
||||
* available but loses track of race committee events, e.g., during server restarts.
|
||||
* @param raceLogStore
|
||||
* Provides the capability to obtain the {@link RaceLog} for the race. A trivial
|
||||
* implementation is {@link EmptyRaceLogStore} which simply provides new, empty tracks. This is always
|
||||
* available but loses track of race log events, e.g., during server restarts.
|
||||
*/
|
||||
TracTracRaceTracker createRaceTracker(URL paramURL, URI liveURI, URI storedURI, TimePoint startOfTracking,
|
||||
TimePoint endOfTracking, long delayToLiveInMillis, boolean simulateWithStartTimeNow, WindStore windStore,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceCommitteeStore raceCommitteeStore) throws MalformedURLException, FileNotFoundException,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceLogStore raceLogStore) throws MalformedURLException, FileNotFoundException,
|
||||
URISyntaxException;
|
||||
|
||||
/**
|
||||
* Same as {@link #createRaceTracker(URL, URI, URI, TimePoint, TimePoint, WindStore, TrackedRegattaRegistry, RaceCommitteeStore)}, only that
|
||||
* Same as {@link #createRaceTracker(URL, URI, URI, TimePoint, TimePoint, WindStore, TrackedRegattaRegistry, RaceLogStore)}, only that
|
||||
* a predefined {@link Regatta} is used to hold the resulting races.
|
||||
*/
|
||||
RaceTracker createRaceTracker(Regatta regatta, URL paramURL, URI liveURI, URI storedURI, TimePoint startOfTracking,
|
||||
TimePoint endOfTracking, long delayToLiveInMillis, boolean simulateWithStartTimeNow, WindStore windStore,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceCommitteeStore raceCommitteeStore) throws MalformedURLException, FileNotFoundException,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceLogStore raceLogStore) throws MalformedURLException, FileNotFoundException,
|
||||
URISyntaxException;
|
||||
|
||||
BoatClass getOrCreateBoatClass(CompetitorClass competitorClass);
|
||||
@@ -170,7 +170,7 @@ public interface DomainFactory {
|
||||
Iterable<Receiver> getUpdateReceivers(DynamicTrackedRegatta trackedRegatta, Event tractracEvent,
|
||||
TimePoint startOfTracking, TimePoint endOfTracking, long delayToLiveInMillis, Simulator simulator,
|
||||
WindStore windStore, DynamicRaceDefinitionSet raceDefinitionSetToUpdate,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceCommitteeStore raceCommitteeStore);
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceLogStore raceLogStore);
|
||||
|
||||
/**
|
||||
* Creates a {@link RaceDefinition} from a TracTrac {@link Race} and a domain {@link Course} definition. The
|
||||
@@ -191,7 +191,7 @@ public interface DomainFactory {
|
||||
*/
|
||||
DynamicTrackedRace getOrCreateRaceDefinitionAndTrackedRace(TrackedRegatta trackedRegatta, Race race,
|
||||
Course course, WindStore windStore, long delayToLiveInMillis, long millisecondsOverWhichToAverageWind,
|
||||
DynamicRaceDefinitionSet raceDefinitionSetToUpdate, RaceCommitteeStore raceCommitteeStore);
|
||||
DynamicRaceDefinitionSet raceDefinitionSetToUpdate, RaceLogStore raceLogStore);
|
||||
|
||||
/**
|
||||
* The record may be for a single mark or a gate. If for a gate, the
|
||||
@@ -204,7 +204,7 @@ public interface DomainFactory {
|
||||
|
||||
MarkPassing createMarkPassing(TimePoint timePoint, Waypoint passed, com.sap.sailing.domain.base.Competitor competitor);
|
||||
|
||||
Iterable<Receiver> getUpdateReceivers(DynamicTrackedRegatta trackedRegatta, Event tractracEvent, WindStore windStore, RaceCommitteeStore raceCommitteeStore,
|
||||
Iterable<Receiver> getUpdateReceivers(DynamicTrackedRegatta trackedRegatta, Event tractracEvent, WindStore windStore, RaceLogStore raceLogStore,
|
||||
TimePoint startOfTracking, TimePoint endOfTracking, long delayToLiveInMillis, Simulator simulator, DynamicRaceDefinitionSet raceDefinitionSetToUpdate, TrackedRegattaRegistry trackedRegattaRegistry, ReceiverType... types);
|
||||
|
||||
JSONService parseJSONURL(URL jsonURL) throws IOException, ParseException, org.json.simple.parser.ParseException, URISyntaxException;
|
||||
@@ -241,7 +241,7 @@ public interface DomainFactory {
|
||||
|
||||
RaceTrackingConnectivityParameters createTrackingConnectivityParameters(URL paramURL, URI liveURI, URI storedURI,
|
||||
TimePoint startOfTracking, TimePoint endOfTracking, long delayToLiveInMillis, boolean simulateWithStartTimeNow, WindStore windStore,
|
||||
RaceCommitteeStore raceCommitteeStore);
|
||||
RaceLogStore raceLogStore);
|
||||
/**
|
||||
* Removes all knowledge about <code>tractracRace</code> which includes removing it from the race cache, from the
|
||||
* {@link com.sap.sailing.domain.base.Regatta} and, if a {@link TrackedRace} for the corresponding
|
||||
|
||||
+15
-15
@@ -46,7 +46,7 @@ import com.sap.sailing.domain.common.impl.DegreeBearingImpl;
|
||||
import com.sap.sailing.domain.common.impl.DegreePosition;
|
||||
import com.sap.sailing.domain.common.impl.Util;
|
||||
import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
import com.sap.sailing.domain.tracking.DynamicRaceDefinitionSet;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRace;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRegatta;
|
||||
@@ -349,7 +349,7 @@ public class DomainFactoryImpl implements DomainFactory {
|
||||
|
||||
@Override
|
||||
public Iterable<Receiver> getUpdateReceivers(DynamicTrackedRegatta trackedRegatta,
|
||||
com.tractrac.clientmodule.Event tractracEvent, WindStore windStore, RaceCommitteeStore raceCommitteeStore, TimePoint startOfTracking,
|
||||
com.tractrac.clientmodule.Event tractracEvent, WindStore windStore, RaceLogStore raceLogStore, TimePoint startOfTracking,
|
||||
TimePoint endOfTracking, long delayToLiveInMillis, Simulator simulator,
|
||||
DynamicRaceDefinitionSet raceDefinitionSetToUpdate, TrackedRegattaRegistry trackedRegattaRegistry,
|
||||
ReceiverType... types) {
|
||||
@@ -360,7 +360,7 @@ public class DomainFactoryImpl implements DomainFactory {
|
||||
result.add(new RaceCourseReceiver(
|
||||
this, trackedRegatta, tractracEvent, windStore,
|
||||
raceDefinitionSetToUpdate, delayToLiveInMillis,
|
||||
WindTrack.DEFAULT_MILLISECONDS_OVER_WHICH_TO_AVERAGE_WIND, simulator, raceCommitteeStore));
|
||||
WindTrack.DEFAULT_MILLISECONDS_OVER_WHICH_TO_AVERAGE_WIND, simulator, raceLogStore));
|
||||
break;
|
||||
case MARKPOSITIONS:
|
||||
result.add(new MarkPositionReceiver(
|
||||
@@ -387,8 +387,8 @@ public class DomainFactoryImpl implements DomainFactory {
|
||||
public Iterable<Receiver> getUpdateReceivers(DynamicTrackedRegatta trackedRegatta,
|
||||
com.tractrac.clientmodule.Event tractracEvent, TimePoint startOfTracking, TimePoint endOfTracking,
|
||||
long delayToLiveInMillis, Simulator simulator, WindStore windStore,
|
||||
DynamicRaceDefinitionSet raceDefinitionSetToUpdate, TrackedRegattaRegistry trackedRegattaRegistry, RaceCommitteeStore raceCommitteeStore) {
|
||||
return getUpdateReceivers(trackedRegatta, tractracEvent, windStore, raceCommitteeStore, startOfTracking, endOfTracking,
|
||||
DynamicRaceDefinitionSet raceDefinitionSetToUpdate, TrackedRegattaRegistry trackedRegattaRegistry, RaceLogStore raceLogStore) {
|
||||
return getUpdateReceivers(trackedRegatta, tractracEvent, windStore, raceLogStore, startOfTracking, endOfTracking,
|
||||
delayToLiveInMillis, simulator, raceDefinitionSetToUpdate, trackedRegattaRegistry,
|
||||
ReceiverType.RACECOURSE, ReceiverType.MARKPASSINGS, ReceiverType.MARKPOSITIONS,
|
||||
ReceiverType.RACESTARTFINISH, ReceiverType.RAWPOSITIONS);
|
||||
@@ -448,7 +448,7 @@ public class DomainFactoryImpl implements DomainFactory {
|
||||
@Override
|
||||
public DynamicTrackedRace getOrCreateRaceDefinitionAndTrackedRace(TrackedRegatta trackedRegatta,
|
||||
Race race, Course course, WindStore windStore, long delayToLiveInMillis, long millisecondsOverWhichToAverageWind,
|
||||
DynamicRaceDefinitionSet raceDefinitionSetToUpdate, RaceCommitteeStore raceCommitteeStore) {
|
||||
DynamicRaceDefinitionSet raceDefinitionSetToUpdate, RaceLogStore raceLogStore) {
|
||||
synchronized (raceCache) {
|
||||
RaceDefinition raceDefinition = raceCache.get(race);
|
||||
if (raceDefinition == null) {
|
||||
@@ -460,7 +460,7 @@ public class DomainFactoryImpl implements DomainFactory {
|
||||
if (raceDefinition.getBoatClass() == trackedRegatta.getRegatta().getBoatClass()) {
|
||||
trackedRegatta.getRegatta().addRace(raceDefinition);
|
||||
DynamicTrackedRace trackedRace = createTrackedRace(trackedRegatta, raceDefinition, windStore,
|
||||
delayToLiveInMillis, millisecondsOverWhichToAverageWind, raceDefinitionSetToUpdate, raceCommitteeStore);
|
||||
delayToLiveInMillis, millisecondsOverWhichToAverageWind, raceDefinitionSetToUpdate, raceLogStore);
|
||||
logger.info("Added race "+raceDefinition+" to regatta "+trackedRegatta.getRegatta());
|
||||
synchronized (raceCache) {
|
||||
raceCache.put(race, raceDefinition);
|
||||
@@ -481,11 +481,11 @@ public class DomainFactoryImpl implements DomainFactory {
|
||||
|
||||
private DynamicTrackedRace createTrackedRace(TrackedRegatta trackedRegatta, RaceDefinition race, WindStore windStore,
|
||||
long delayToLiveInMillis, long millisecondsOverWhichToAverageWind, DynamicRaceDefinitionSet raceDefinitionSetToUpdate,
|
||||
RaceCommitteeStore raceCommitteeStore) {
|
||||
RaceLogStore raceLogStore) {
|
||||
return trackedRegatta.createTrackedRace(race,
|
||||
windStore, delayToLiveInMillis, millisecondsOverWhichToAverageWind,
|
||||
/* time over which to average speed: */ race.getBoatClass().getApproximateManeuverDurationInMilliseconds(),
|
||||
raceDefinitionSetToUpdate, raceCommitteeStore);
|
||||
raceDefinitionSetToUpdate, raceLogStore);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -550,20 +550,20 @@ public class DomainFactoryImpl implements DomainFactory {
|
||||
@Override
|
||||
public TracTracRaceTracker createRaceTracker(URL paramURL, URI liveURI, URI storedURI, TimePoint startOfTracking,
|
||||
TimePoint endOfTracking, long delayToLiveInMillis, boolean simulateWithStartTimeNow, WindStore windStore,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceCommitteeStore raceCommitteeStore) throws MalformedURLException, FileNotFoundException,
|
||||
TrackedRegattaRegistry trackedRegattaRegistry, RaceLogStore raceLogStore) throws MalformedURLException, FileNotFoundException,
|
||||
URISyntaxException {
|
||||
return new TracTracRaceTrackerImpl(this, paramURL, liveURI, storedURI, startOfTracking, endOfTracking, delayToLiveInMillis,
|
||||
simulateWithStartTimeNow, windStore, trackedRegattaRegistry, raceCommitteeStore);
|
||||
simulateWithStartTimeNow, windStore, trackedRegattaRegistry, raceLogStore);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceTracker createRaceTracker(Regatta regatta, URL paramURL, URI liveURI, URI storedURI,
|
||||
TimePoint startOfTracking, TimePoint endOfTracking, long delayToLiveInMillis,
|
||||
boolean simulateWithStartTimeNow, WindStore windStore, TrackedRegattaRegistry trackedRegattaRegistry,
|
||||
RaceCommitteeStore raceCommitteeStore)
|
||||
RaceLogStore raceLogStore)
|
||||
throws MalformedURLException, FileNotFoundException, URISyntaxException {
|
||||
return new TracTracRaceTrackerImpl(regatta, this, paramURL, liveURI, storedURI, startOfTracking, endOfTracking, delayToLiveInMillis,
|
||||
simulateWithStartTimeNow, windStore, trackedRegattaRegistry, raceCommitteeStore);
|
||||
simulateWithStartTimeNow, windStore, trackedRegattaRegistry, raceLogStore);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -579,9 +579,9 @@ public class DomainFactoryImpl implements DomainFactory {
|
||||
@Override
|
||||
public RaceTrackingConnectivityParameters createTrackingConnectivityParameters(URL paramURL, URI liveURI,
|
||||
URI storedURI, TimePoint startOfTracking, TimePoint endOfTracking, long delayToLiveInMillis,
|
||||
boolean simulateWithStartTimeNow, WindStore windStore, RaceCommitteeStore raceCommitteeStore) {
|
||||
boolean simulateWithStartTimeNow, WindStore windStore, RaceLogStore raceLogStore) {
|
||||
return new RaceTrackingConnectivityParametersImpl(paramURL, liveURI, storedURI, startOfTracking, endOfTracking,
|
||||
delayToLiveInMillis, simulateWithStartTimeNow, windStore, this, raceCommitteeStore);
|
||||
delayToLiveInMillis, simulateWithStartTimeNow, windStore, this, raceLogStore);
|
||||
}
|
||||
|
||||
}
|
||||
+6
-6
@@ -11,7 +11,7 @@ import com.sap.sailing.domain.base.Course;
|
||||
import com.sap.sailing.domain.base.RaceDefinition;
|
||||
import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.common.impl.Util.Triple;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
import com.sap.sailing.domain.tracking.DynamicRaceDefinitionSet;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRace;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRegatta;
|
||||
@@ -41,13 +41,13 @@ public class RaceCourseReceiver extends AbstractReceiverWithQueue<Route, RouteDa
|
||||
private final long millisecondsOverWhichToAverageWind;
|
||||
private final long delayToLiveInMillis;
|
||||
private final WindStore windStore;
|
||||
private final RaceCommitteeStore raceCommitteeStore;
|
||||
private final RaceLogStore raceLogStore;
|
||||
private final DynamicRaceDefinitionSet raceDefinitionSetToUpdate;
|
||||
|
||||
public RaceCourseReceiver(DomainFactory domainFactory, DynamicTrackedRegatta trackedRegatta,
|
||||
com.tractrac.clientmodule.Event tractracEvent, WindStore windStore,
|
||||
DynamicRaceDefinitionSet raceDefinitionSetToUpdate, long delayToLiveInMillis,
|
||||
long millisecondsOverWhichToAverageWind, Simulator simulator, RaceCommitteeStore raceCommitteeStore) {
|
||||
long millisecondsOverWhichToAverageWind, Simulator simulator, RaceLogStore raceLogStore) {
|
||||
super(domainFactory, tractracEvent, trackedRegatta, simulator);
|
||||
this.millisecondsOverWhichToAverageWind = millisecondsOverWhichToAverageWind;
|
||||
this.delayToLiveInMillis = delayToLiveInMillis;
|
||||
@@ -57,7 +57,7 @@ public class RaceCourseReceiver extends AbstractReceiverWithQueue<Route, RouteDa
|
||||
this.windStore = simulator.simulatingWindStore(windStore);
|
||||
}
|
||||
this.raceDefinitionSetToUpdate = raceDefinitionSetToUpdate;
|
||||
this.raceCommitteeStore = raceCommitteeStore;
|
||||
this.raceLogStore = raceLogStore;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,7 +109,7 @@ public class RaceCourseReceiver extends AbstractReceiverWithQueue<Route, RouteDa
|
||||
// create race definition and add to event
|
||||
DynamicTrackedRace trackedRace = getDomainFactory().getOrCreateRaceDefinitionAndTrackedRace(
|
||||
getTrackedRegatta(), event.getC(), course, windStore, delayToLiveInMillis,
|
||||
millisecondsOverWhichToAverageWind, raceDefinitionSetToUpdate, raceCommitteeStore);
|
||||
millisecondsOverWhichToAverageWind, raceDefinitionSetToUpdate, raceLogStore);
|
||||
if (getSimulator() != null) {
|
||||
getSimulator().setTrackedRace(trackedRace);
|
||||
}
|
||||
@@ -120,7 +120,7 @@ public class RaceCourseReceiver extends AbstractReceiverWithQueue<Route, RouteDa
|
||||
getTrackedRegatta().createTrackedRace(race,
|
||||
windStore, delayToLiveInMillis, millisecondsOverWhichToAverageWind,
|
||||
/* time over which to average speed: */ race.getBoatClass().getApproximateManeuverDurationInMilliseconds(),
|
||||
raceDefinitionSetToUpdate, raceCommitteeStore);
|
||||
raceDefinitionSetToUpdate, raceLogStore);
|
||||
}
|
||||
|
||||
}
|
||||
+6
-6
@@ -9,7 +9,7 @@ import java.net.URL;
|
||||
import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.impl.Util;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
import com.sap.sailing.domain.tracking.RaceTracker;
|
||||
import com.sap.sailing.domain.tracking.RaceTrackingConnectivityParameters;
|
||||
import com.sap.sailing.domain.tracking.TrackedRegattaRegistry;
|
||||
@@ -23,14 +23,14 @@ public class RaceTrackingConnectivityParametersImpl implements RaceTrackingConne
|
||||
private final TimePoint startOfTracking;
|
||||
private final TimePoint endOfTracking;
|
||||
private final WindStore windStore;
|
||||
private final RaceCommitteeStore raceCommitteeStore;
|
||||
private final RaceLogStore raceLogStore;
|
||||
private final DomainFactory domainFactory;
|
||||
private final long delayToLiveInMillis;
|
||||
private final boolean simulateWithStartTimeNow;
|
||||
|
||||
public RaceTrackingConnectivityParametersImpl(URL paramURL, URI liveURI, URI storedURI, TimePoint startOfTracking,
|
||||
TimePoint endOfTracking, long delayToLiveInMillis, boolean simulateWithStartTimeNow, WindStore windStore,
|
||||
DomainFactory domainFactory, RaceCommitteeStore raceCommitteeStore) {
|
||||
DomainFactory domainFactory, RaceLogStore raceLogStore) {
|
||||
super();
|
||||
this.paramURL = paramURL;
|
||||
this.liveURI = liveURI;
|
||||
@@ -39,7 +39,7 @@ public class RaceTrackingConnectivityParametersImpl implements RaceTrackingConne
|
||||
this.endOfTracking = endOfTracking;
|
||||
this.delayToLiveInMillis = delayToLiveInMillis;
|
||||
this.windStore = windStore;
|
||||
this.raceCommitteeStore = raceCommitteeStore;
|
||||
this.raceLogStore = raceLogStore;
|
||||
this.domainFactory = domainFactory;
|
||||
this.simulateWithStartTimeNow = simulateWithStartTimeNow;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ public class RaceTrackingConnectivityParametersImpl implements RaceTrackingConne
|
||||
public RaceTracker createRaceTracker(TrackedRegattaRegistry trackedRegattaRegistry) throws MalformedURLException,
|
||||
FileNotFoundException, URISyntaxException {
|
||||
RaceTracker tracker = domainFactory.createRaceTracker(paramURL, liveURI, storedURI, startOfTracking,
|
||||
endOfTracking, delayToLiveInMillis, simulateWithStartTimeNow, windStore, trackedRegattaRegistry, raceCommitteeStore);
|
||||
endOfTracking, delayToLiveInMillis, simulateWithStartTimeNow, windStore, trackedRegattaRegistry, raceLogStore);
|
||||
return tracker;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class RaceTrackingConnectivityParametersImpl implements RaceTrackingConne
|
||||
public RaceTracker createRaceTracker(Regatta regatta, TrackedRegattaRegistry trackedRegattaRegistry)
|
||||
throws Exception {
|
||||
RaceTracker tracker = domainFactory.createRaceTracker(regatta, paramURL, liveURI, storedURI, startOfTracking,
|
||||
endOfTracking, delayToLiveInMillis, simulateWithStartTimeNow, windStore, trackedRegattaRegistry, raceCommitteeStore);
|
||||
endOfTracking, delayToLiveInMillis, simulateWithStartTimeNow, windStore, trackedRegattaRegistry, raceLogStore);
|
||||
return tracker;
|
||||
}
|
||||
|
||||
|
||||
+9
-9
@@ -32,7 +32,7 @@ import com.sap.sailing.domain.common.Position;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.TrackedRaceStatusEnum;
|
||||
import com.sap.sailing.domain.common.impl.Util.Triple;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
import com.sap.sailing.domain.tracking.AbstractRaceTrackerImpl;
|
||||
import com.sap.sailing.domain.tracking.DynamicGPSFixTrack;
|
||||
import com.sap.sailing.domain.tracking.DynamicRaceDefinitionSet;
|
||||
@@ -123,18 +123,18 @@ public class TracTracRaceTrackerImpl extends AbstractRaceTrackerImpl implements
|
||||
protected TracTracRaceTrackerImpl(DomainFactory domainFactory, URL paramURL, URI liveURI, URI storedURI,
|
||||
TimePoint startOfTracking, TimePoint endOfTracking, long delayToLiveInMillis,
|
||||
boolean simulateWithStartTimeNow, WindStore windStore, TrackedRegattaRegistry trackedRegattaRegistry,
|
||||
RaceCommitteeStore raceCommitteeStore)
|
||||
RaceLogStore raceLogStore)
|
||||
throws URISyntaxException, MalformedURLException, FileNotFoundException {
|
||||
this(KeyValue.setup(paramURL), domainFactory, paramURL, liveURI, storedURI, startOfTracking, endOfTracking,
|
||||
delayToLiveInMillis, simulateWithStartTimeNow, windStore, trackedRegattaRegistry, raceCommitteeStore);
|
||||
delayToLiveInMillis, simulateWithStartTimeNow, windStore, trackedRegattaRegistry, raceLogStore);
|
||||
}
|
||||
|
||||
private TracTracRaceTrackerImpl(Event tractracEvent, DomainFactory domainFactory, URL paramURL, URI liveURI, URI storedURI,
|
||||
TimePoint startOfTracking, TimePoint endOfTracking, long delayToLiveInMillis, boolean simulateWithStartTimeNow,
|
||||
WindStore windStore, TrackedRegattaRegistry trackedRegattaRegistry, RaceCommitteeStore raceCommitteeStore)
|
||||
WindStore windStore, TrackedRegattaRegistry trackedRegattaRegistry, RaceLogStore raceLogStore)
|
||||
throws URISyntaxException, MalformedURLException, FileNotFoundException {
|
||||
this(tractracEvent, null, domainFactory, paramURL, liveURI, storedURI,
|
||||
startOfTracking, endOfTracking, delayToLiveInMillis, simulateWithStartTimeNow, windStore, trackedRegattaRegistry, raceCommitteeStore);
|
||||
startOfTracking, endOfTracking, delayToLiveInMillis, simulateWithStartTimeNow, windStore, trackedRegattaRegistry, raceLogStore);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,10 +145,10 @@ public class TracTracRaceTrackerImpl extends AbstractRaceTrackerImpl implements
|
||||
*/
|
||||
protected TracTracRaceTrackerImpl(Regatta regatta, DomainFactory domainFactory, URL paramURL, URI liveURI, URI storedURI,
|
||||
TimePoint startOfTracking, TimePoint endOfTracking, long delayToLiveInMillis, boolean simulateWithStartTimeNow,
|
||||
WindStore windStore, TrackedRegattaRegistry trackedRegattaRegistry, RaceCommitteeStore raceCommitteeStore)
|
||||
WindStore windStore, TrackedRegattaRegistry trackedRegattaRegistry, RaceLogStore raceLogStore)
|
||||
throws URISyntaxException, MalformedURLException, FileNotFoundException {
|
||||
this(KeyValue.setup(paramURL), regatta, domainFactory, paramURL, liveURI, storedURI, startOfTracking,
|
||||
endOfTracking, delayToLiveInMillis, simulateWithStartTimeNow, windStore, trackedRegattaRegistry, raceCommitteeStore);
|
||||
endOfTracking, delayToLiveInMillis, simulateWithStartTimeNow, windStore, trackedRegattaRegistry, raceLogStore);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -165,7 +165,7 @@ public class TracTracRaceTrackerImpl extends AbstractRaceTrackerImpl implements
|
||||
private TracTracRaceTrackerImpl(Event tractracEvent, final Regatta regatta, DomainFactory domainFactory,
|
||||
URL paramURL, URI liveURI, URI storedURI, TimePoint startOfTracking, TimePoint endOfTracking,
|
||||
long delayToLiveInMillis, boolean simulateWithStartTimeNow, WindStore windStore, TrackedRegattaRegistry trackedRegattaRegistry,
|
||||
RaceCommitteeStore raceCommitteeStore)
|
||||
RaceLogStore raceLogStore)
|
||||
throws URISyntaxException, MalformedURLException, FileNotFoundException {
|
||||
super();
|
||||
this.tractracEvent = tractracEvent;
|
||||
@@ -210,7 +210,7 @@ public class TracTracRaceTrackerImpl extends AbstractRaceTrackerImpl implements
|
||||
receivers = new HashSet<Receiver>();
|
||||
Set<TypeController> typeControllers = new HashSet<TypeController>();
|
||||
for (Receiver receiver : domainFactory.getUpdateReceivers(getTrackedRegatta(), tractracEvent, startOfTracking,
|
||||
endOfTracking, delayToLiveInMillis, simulator, windStore, this, trackedRegattaRegistry, raceCommitteeStore)) {
|
||||
endOfTracking, delayToLiveInMillis, simulator, windStore, this, trackedRegattaRegistry, raceLogStore)) {
|
||||
receivers.add(receiver);
|
||||
for (TypeController typeController : receiver.getTypeControllersAndStart()) {
|
||||
typeControllers.add(typeController);
|
||||
|
||||
@@ -13,8 +13,8 @@ Export-Package: com.sap.sailing.domain.base,
|
||||
com.sap.sailing.domain.leaderboard,
|
||||
com.sap.sailing.domain.leaderboard.impl,
|
||||
com.sap.sailing.domain.leaderboard.meta,
|
||||
com.sap.sailing.domain.racecommittee,
|
||||
com.sap.sailing.domain.racecommittee.impl,
|
||||
com.sap.sailing.domain.racelog,
|
||||
com.sap.sailing.domain.racelog.impl,
|
||||
com.sap.sailing.domain.tracking,
|
||||
com.sap.sailing.domain.tracking.impl,
|
||||
com.sap.sailing.util,
|
||||
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
package com.sap.sailing.domain.racecommittee;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public interface RaceCommitteeCourseAreaChangedEvent extends RaceCommitteeEvent {
|
||||
|
||||
Serializable getCourseAreaId();
|
||||
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
package com.sap.sailing.domain.racecommittee;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.Timed;
|
||||
import com.sap.sailing.domain.common.WithID;
|
||||
|
||||
/**
|
||||
* Records an event that is sent by the race committee via the Race Committee Cockpit App. The event is timed and may influence the state of a race depending on its context the the current
|
||||
* state of the RaceCommitteeEventTrack.
|
||||
* Subtypes may be flag events (AP, N, X, P, etc.) or operational race events
|
||||
*
|
||||
*/
|
||||
public interface RaceCommitteeEvent extends Timed, WithID {
|
||||
List<Competitor> getInvolvedBoats();
|
||||
|
||||
int getPassId();
|
||||
}
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
package com.sap.sailing.domain.racecommittee;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.racecommittee.impl.RaceCommitteeEventFactoryImpl;
|
||||
|
||||
public interface RaceCommitteeEventFactory {
|
||||
RaceCommitteeEventFactory INSTANCE = new RaceCommitteeEventFactoryImpl();
|
||||
|
||||
RaceCommitteeFlagEvent createFlagEvent(TimePoint timePoint, Serializable id, List<Competitor> involvedBoats, int passId, Flags upperFlag, Flags lowerFlag, boolean isDisplayed);
|
||||
RaceCommitteeFlagEvent createFlagEvent(TimePoint timePoint, int passId, Flags upperFlag, Flags lowerFlag, boolean isDisplayed);
|
||||
|
||||
RaceCommitteeStartTimeEvent createStartTimeEvent(TimePoint timePoint, Serializable id, List<Competitor> involvedBoats, int passId, TimePoint startTime);
|
||||
RaceCommitteeStartTimeEvent createStartTimeEvent(TimePoint timePoint, int passId, TimePoint startTime);
|
||||
|
||||
RaceCommitteeCourseAreaChangedEvent createCourseAreaChangedEvent(TimePoint timePoint, Serializable id, List<Competitor> involvedBoats, int passId, Serializable courseAreaId);
|
||||
RaceCommitteeCourseAreaChangedEvent createCourseAreaChangedEvent(TimePoint timePoint, int passId, Serializable courseAreaId);
|
||||
|
||||
}
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
package com.sap.sailing.domain.racecommittee;
|
||||
|
||||
import com.sap.sailing.domain.tracking.Track;
|
||||
|
||||
|
||||
public interface RaceCommitteeEventTrack extends Track<RaceCommitteeEvent> {
|
||||
|
||||
void add(RaceCommitteeEvent event);
|
||||
|
||||
void addListener(RaceCommitteeListener newListener);
|
||||
|
||||
}
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
package com.sap.sailing.domain.racecommittee;
|
||||
|
||||
public interface RaceCommitteeFlagEvent extends RaceCommitteeEvent {
|
||||
|
||||
Flags getUpperFlag();
|
||||
|
||||
Flags getLowerFlag();
|
||||
|
||||
boolean isDisplayed();
|
||||
}
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
package com.sap.sailing.domain.racecommittee;
|
||||
|
||||
public interface RaceCommitteeListener {
|
||||
void flagEventReceived(RaceCommitteeFlagEvent flagEvent);
|
||||
|
||||
void startTimeEventReceived(RaceCommitteeStartTimeEvent startTimeEvent);
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
package com.sap.sailing.domain.racecommittee;
|
||||
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
|
||||
public interface RaceCommitteeStartTimeEvent extends RaceCommitteeEvent {
|
||||
|
||||
TimePoint getStartTime();
|
||||
}
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
package com.sap.sailing.domain.racecommittee;
|
||||
|
||||
import com.sap.sailing.domain.tracking.TrackedRace;
|
||||
import com.sap.sailing.domain.tracking.TrackedRegatta;
|
||||
|
||||
|
||||
/**
|
||||
* Capsulating store interface providing a {@link RaceCommitteeEventTrack} for a given regatta / race combination.
|
||||
*
|
||||
*/
|
||||
public interface RaceCommitteeStore {
|
||||
RaceCommitteeEventTrack getRaceCommitteeEventTrack(TrackedRegatta trackedRegatta, TrackedRace trackedRace);
|
||||
}
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
package com.sap.sailing.domain.racecommittee.impl;
|
||||
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEventTrack;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStore;
|
||||
import com.sap.sailing.domain.tracking.TrackedRace;
|
||||
import com.sap.sailing.domain.tracking.TrackedRegatta;
|
||||
|
||||
/**
|
||||
* Since the RaceCommitteeStore is part of the TrackedRace constructor and not all TrackedRace instances need a RaceCommitteeStore (e.g. tests)
|
||||
* this dummy implementation is provided.
|
||||
*
|
||||
*/
|
||||
public class EmptyRaceCommitteeStore implements RaceCommitteeStore {
|
||||
public static EmptyRaceCommitteeStore INSTANCE = new EmptyRaceCommitteeStore();
|
||||
|
||||
@Override
|
||||
public RaceCommitteeEventTrack getRaceCommitteeEventTrack(TrackedRegatta trackedRegatta, TrackedRace trackedRace) {
|
||||
return new RaceCommitteeEventTrackImpl("Lock for " + trackedRace.toString());
|
||||
}
|
||||
}
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
package com.sap.sailing.domain.racecommittee.impl;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import com.sap.sailing.domain.base.Timed;
|
||||
|
||||
/**
|
||||
* This comparator compares two timed objects, in this case two {@link RaceCommitteeEvent}s and is used for the race committee event track. The event on top of the list shall be the latest
|
||||
*
|
||||
*/
|
||||
public class RaceCommitteeEventComparator implements Comparator<Timed> {
|
||||
|
||||
public static final Comparator<Timed> INSTANCE = new RaceCommitteeEventComparator();
|
||||
|
||||
@Override
|
||||
public int compare(Timed left, Timed right) {
|
||||
return left.getTimePoint().compareTo(right.getTimePoint());
|
||||
}
|
||||
|
||||
}
|
||||
-58
@@ -1,58 +0,0 @@
|
||||
package com.sap.sailing.domain.racecommittee.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.racecommittee.Flags;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeCourseAreaChangedEvent;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEventFactory;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeFlagEvent;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStartTimeEvent;
|
||||
|
||||
public class RaceCommitteeEventFactoryImpl implements RaceCommitteeEventFactory {
|
||||
|
||||
@Override
|
||||
public RaceCommitteeFlagEvent createFlagEvent(TimePoint timePoint,
|
||||
Serializable id, List<Competitor> involvedBoats, int passId,
|
||||
Flags upperFlag, Flags lowerFlag, boolean isDisplayed) {
|
||||
return new RaceCommitteeFlagEventImpl(timePoint, id, involvedBoats, passId, upperFlag, lowerFlag, isDisplayed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceCommitteeFlagEvent createFlagEvent(TimePoint timePoint,
|
||||
int passId, Flags upperFlag, Flags lowerFlag, boolean isDisplayed) {
|
||||
return createFlagEvent(timePoint, UUID.randomUUID(), new ArrayList<Competitor>(), passId, upperFlag, lowerFlag, isDisplayed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceCommitteeStartTimeEvent createStartTimeEvent(
|
||||
TimePoint timePoint, Serializable id,
|
||||
List<Competitor> involvedBoats, int passId, TimePoint startTime) {
|
||||
return new RaceCommitteeStartTimeEventImpl(timePoint, id, involvedBoats, passId, startTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceCommitteeStartTimeEvent createStartTimeEvent(
|
||||
TimePoint timePoint, int passId, TimePoint startTime) {
|
||||
return createStartTimeEvent(timePoint, UUID.randomUUID(), new ArrayList<Competitor>(), passId, startTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceCommitteeCourseAreaChangedEvent createCourseAreaChangedEvent(
|
||||
TimePoint timePoint, Serializable id,
|
||||
List<Competitor> involvedBoats, int passId,
|
||||
Serializable courseAreaId) {
|
||||
return new RaceCommitteeCourseAreaChangeEventImpl(timePoint, id, involvedBoats, passId, courseAreaId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceCommitteeCourseAreaChangedEvent createCourseAreaChangedEvent(
|
||||
TimePoint timePoint, int passId, Serializable courseAreaId) {
|
||||
return createCourseAreaChangedEvent(timePoint, UUID.randomUUID(), new ArrayList<Competitor>(), passId, courseAreaId);
|
||||
}
|
||||
|
||||
}
|
||||
-82
@@ -1,82 +0,0 @@
|
||||
package com.sap.sailing.domain.racecommittee.impl;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.sap.sailing.domain.base.Timed;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEvent;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEventTrack;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeFlagEvent;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeListener;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStartTimeEvent;
|
||||
import com.sap.sailing.domain.tracking.impl.TrackImpl;
|
||||
import com.sap.sailing.util.impl.ArrayListNavigableSet;
|
||||
|
||||
public class RaceCommitteeEventTrackImpl extends TrackImpl<RaceCommitteeEvent> implements RaceCommitteeEventTrack {
|
||||
|
||||
private static final long serialVersionUID = -176745401321893502L;
|
||||
|
||||
private transient Set<RaceCommitteeListener> listeners;
|
||||
|
||||
private final static Logger logger = Logger.getLogger(RaceCommitteeEventTrackImpl.class.getName());
|
||||
|
||||
public RaceCommitteeEventTrackImpl(String nameForReadWriteLock) {
|
||||
super(new ArrayListNavigableSet<Timed>(RaceCommitteeEventComparator.INSTANCE), nameForReadWriteLock);
|
||||
listeners = new HashSet<RaceCommitteeListener>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(RaceCommitteeEvent event) {
|
||||
lockForWrite();
|
||||
try {
|
||||
getInternalRawFixes().add(event);
|
||||
} finally {
|
||||
unlockAfterWrite();
|
||||
}
|
||||
notifyListenersAboutReceive(event);
|
||||
}
|
||||
|
||||
private void notifyListenersAboutReceive(RaceCommitteeEvent event) {
|
||||
if (event instanceof RaceCommitteeFlagEvent) {
|
||||
notifiyListenersAboutReceivedFlagEvent((RaceCommitteeFlagEvent) event);
|
||||
} else if (event instanceof RaceCommitteeStartTimeEvent) {
|
||||
notifiyListenersAboutReceivedStartTimeEvent((RaceCommitteeStartTimeEvent) event);
|
||||
}
|
||||
}
|
||||
|
||||
private void notifiyListenersAboutReceivedStartTimeEvent(RaceCommitteeStartTimeEvent event) {
|
||||
synchronized (listeners) {
|
||||
for (RaceCommitteeListener listener : listeners) {
|
||||
try {
|
||||
listener.startTimeEventReceived(event);
|
||||
} catch (Throwable t) {
|
||||
logger.log(Level.SEVERE, "RaceCommitteeListener " + listener + " threw exception " + t.getMessage());
|
||||
logger.throwing(RaceCommitteeEventTrackImpl.class.getName(), "notifiyListenersAboutReceivedStartTimeEvent(RaceCommitteeStartTimeEvent)", t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void notifiyListenersAboutReceivedFlagEvent(RaceCommitteeFlagEvent event) {
|
||||
synchronized (listeners) {
|
||||
for (RaceCommitteeListener listener : listeners) {
|
||||
try {
|
||||
listener.flagEventReceived(event);
|
||||
} catch (Throwable t) {
|
||||
logger.log(Level.SEVERE, "RaceCommitteeListener " + listener + " threw exception " + t.getMessage());
|
||||
logger.throwing(RaceCommitteeEventTrackImpl.class.getName(), "notifiyListenersAboutReceivedFlagEvent(RaceCommitteeFlagEvent)", t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(RaceCommitteeListener newListener) {
|
||||
synchronized (listeners) {
|
||||
listeners.add(newListener);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-49
@@ -1,49 +0,0 @@
|
||||
package com.sap.sailing.domain.racecommittee.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.racecommittee.Flags;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeFlagEvent;
|
||||
|
||||
public class RaceCommitteeFlagEventImpl extends RaceCommitteeEventImpl implements RaceCommitteeFlagEvent {
|
||||
|
||||
private static final long serialVersionUID = 6333303528852541914L;
|
||||
private Flags upperFlag;
|
||||
private Flags lowerFlag;
|
||||
private boolean isDisplayed;
|
||||
|
||||
public RaceCommitteeFlagEventImpl(TimePoint pTimePoint, Serializable pId, List<Competitor> pInvolvedBoats, int pPassId, Flags pUpperFlag, Flags pLowerFlag, boolean pIsDisplayed) {
|
||||
super(pTimePoint, pId, pInvolvedBoats, pPassId);
|
||||
this.upperFlag = pUpperFlag;
|
||||
this.lowerFlag = pLowerFlag;
|
||||
this.isDisplayed = pIsDisplayed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flags getUpperFlag() {
|
||||
return upperFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flags getLowerFlag() {
|
||||
return lowerFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDisplayed() {
|
||||
return isDisplayed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
return super.equals(object)
|
||||
&& object instanceof RaceCommitteeFlagEvent
|
||||
&& upperFlag.equals(((RaceCommitteeFlagEvent) object).getUpperFlag())
|
||||
&& lowerFlag.equals(((RaceCommitteeFlagEvent) object).getLowerFlag())
|
||||
&& isDisplayed == ((RaceCommitteeFlagEvent) object).isDisplayed();
|
||||
}
|
||||
|
||||
}
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
package com.sap.sailing.domain.racecommittee.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStartTimeEvent;
|
||||
|
||||
public class RaceCommitteeStartTimeEventImpl extends RaceCommitteeEventImpl
|
||||
implements RaceCommitteeStartTimeEvent {
|
||||
|
||||
private static final long serialVersionUID = 8185811395997196162L;
|
||||
private TimePoint startTime;
|
||||
|
||||
public RaceCommitteeStartTimeEventImpl(TimePoint pTimePoint, Serializable pId, List<Competitor> pInvolvedBoats, int pPassId, TimePoint pStartTime) {
|
||||
super(pTimePoint, pId, pInvolvedBoats, pPassId);
|
||||
this.startTime = pStartTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimePoint getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
return super.equals(object)
|
||||
&& object instanceof RaceCommitteeStartTimeEvent
|
||||
&& startTime.equals(((RaceCommitteeStartTimeEvent) object).getStartTime());
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.sap.sailing.domain.racecommittee;
|
||||
package com.sap.sailing.domain.racelog;
|
||||
|
||||
public enum Flags {
|
||||
NONE,
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.sap.sailing.domain.racelog;
|
||||
|
||||
import com.sap.sailing.domain.tracking.Track;
|
||||
|
||||
|
||||
public interface RaceLog extends Track<RaceLogEvent> {
|
||||
|
||||
void add(RaceLogEvent event);
|
||||
|
||||
void addListener(RaceLogListener newListener);
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.sap.sailing.domain.racelog;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public interface RaceLogCourseAreaChangedEvent extends RaceLogEvent {
|
||||
|
||||
Serializable getCourseAreaId();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.sap.sailing.domain.racelog;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.Timed;
|
||||
import com.sap.sailing.domain.common.WithID;
|
||||
|
||||
/**
|
||||
* Records an event that is sent by the race log via the Race Committee Cockpit App. The event is timed and may influence the state of a race depending on its context the the current
|
||||
* state of the RaceLog.
|
||||
* Subtypes may be flag events (AP, N, X, P, etc.) or operational race events
|
||||
*
|
||||
*/
|
||||
public interface RaceLogEvent extends Timed, WithID {
|
||||
List<Competitor> getInvolvedBoats();
|
||||
|
||||
int getPassId();
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.sap.sailing.domain.racelog;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.racelog.impl.RaceLogEventFactoryImpl;
|
||||
|
||||
public interface RaceLogEventFactory {
|
||||
RaceLogEventFactory INSTANCE = new RaceLogEventFactoryImpl();
|
||||
|
||||
RaceLogFlagEvent createFlagEvent(TimePoint timePoint, Serializable id, List<Competitor> involvedBoats, int passId, Flags upperFlag, Flags lowerFlag, boolean isDisplayed);
|
||||
RaceLogFlagEvent createFlagEvent(TimePoint timePoint, int passId, Flags upperFlag, Flags lowerFlag, boolean isDisplayed);
|
||||
|
||||
RaceLogStartTimeEvent createStartTimeEvent(TimePoint timePoint, Serializable id, List<Competitor> involvedBoats, int passId, TimePoint startTime);
|
||||
RaceLogStartTimeEvent createStartTimeEvent(TimePoint timePoint, int passId, TimePoint startTime);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.sap.sailing.domain.racelog;
|
||||
|
||||
public interface RaceLogFlagEvent extends RaceLogEvent {
|
||||
|
||||
Flags getUpperFlag();
|
||||
|
||||
Flags getLowerFlag();
|
||||
|
||||
boolean isDisplayed();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.sap.sailing.domain.racelog;
|
||||
|
||||
public interface RaceLogListener {
|
||||
void flagEventReceived(RaceLogFlagEvent flagEvent);
|
||||
|
||||
void startTimeEventReceived(RaceLogStartTimeEvent startTimeEvent);
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.sap.sailing.domain.racelog;
|
||||
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
|
||||
public interface RaceLogStartTimeEvent extends RaceLogEvent {
|
||||
|
||||
TimePoint getStartTime();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.sap.sailing.domain.racelog;
|
||||
|
||||
import com.sap.sailing.domain.tracking.TrackedRace;
|
||||
import com.sap.sailing.domain.tracking.TrackedRegatta;
|
||||
|
||||
|
||||
/**
|
||||
* Capsulating store interface providing a {@link RaceLog} for a given regatta / race combination.
|
||||
*
|
||||
*/
|
||||
public interface RaceLogStore {
|
||||
RaceLog getRaceLog(TrackedRegatta trackedRegatta, TrackedRace trackedRace);
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.sap.sailing.domain.racelog.impl;
|
||||
|
||||
import com.sap.sailing.domain.racelog.RaceLog;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
import com.sap.sailing.domain.tracking.TrackedRace;
|
||||
import com.sap.sailing.domain.tracking.TrackedRegatta;
|
||||
|
||||
/**
|
||||
* Since the RaceLogStore is part of the TrackedRace constructor and not all TrackedRace instances need a RaceLogStore (e.g. tests)
|
||||
* this dummy implementation is provided.
|
||||
*
|
||||
*/
|
||||
public class EmptyRaceLogStore implements RaceLogStore {
|
||||
public static EmptyRaceLogStore INSTANCE = new EmptyRaceLogStore();
|
||||
|
||||
@Override
|
||||
public RaceLog getRaceLog(TrackedRegatta trackedRegatta, TrackedRace trackedRace) {
|
||||
return new RaceLogImpl("Lock for " + trackedRace.toString());
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -1,19 +1,19 @@
|
||||
package com.sap.sailing.domain.racecommittee.impl;
|
||||
package com.sap.sailing.domain.racelog.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeCourseAreaChangedEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogCourseAreaChangedEvent;
|
||||
|
||||
public class RaceCommitteeCourseAreaChangeEventImpl extends RaceCommitteeEventImpl implements
|
||||
RaceCommitteeCourseAreaChangedEvent {
|
||||
public class RaceLogCourseAreaChangeEventImpl extends RaceLogEventImpl implements
|
||||
RaceLogCourseAreaChangedEvent {
|
||||
private static final long serialVersionUID = -3943108136024977860L;
|
||||
|
||||
private Serializable courseAreaId;
|
||||
|
||||
public RaceCommitteeCourseAreaChangeEventImpl(TimePoint pTimePoint,
|
||||
public RaceLogCourseAreaChangeEventImpl(TimePoint pTimePoint,
|
||||
Serializable pId, List<Competitor> pInvolvedBoats, int pPassId, Serializable courseAreaId) {
|
||||
super(pTimePoint, pId, pInvolvedBoats, pPassId);
|
||||
this.courseAreaId = courseAreaId;
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.sap.sailing.domain.racelog.impl;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
import com.sap.sailing.domain.base.Timed;
|
||||
|
||||
/**
|
||||
* This comparator compares two timed objects, in this case two {@link RaceLogEvent}s and is used for the race log. The event on top of the list shall be the latest
|
||||
*
|
||||
*/
|
||||
public class RaceLogEventComparator implements Comparator<Timed> {
|
||||
|
||||
public static final Comparator<Timed> INSTANCE = new RaceLogEventComparator();
|
||||
|
||||
@Override
|
||||
public int compare(Timed left, Timed right) {
|
||||
return left.getTimePoint().compareTo(right.getTimePoint());
|
||||
}
|
||||
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.sap.sailing.domain.racelog.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.racelog.Flags;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEventFactory;
|
||||
import com.sap.sailing.domain.racelog.RaceLogFlagEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStartTimeEvent;
|
||||
|
||||
public class RaceLogEventFactoryImpl implements RaceLogEventFactory {
|
||||
|
||||
@Override
|
||||
public RaceLogFlagEvent createFlagEvent(TimePoint timePoint,
|
||||
Serializable id, List<Competitor> involvedBoats, int passId,
|
||||
Flags upperFlag, Flags lowerFlag, boolean isDisplayed) {
|
||||
return new RaceLogFlagEventImpl(timePoint, id, involvedBoats, passId, upperFlag, lowerFlag, isDisplayed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogFlagEvent createFlagEvent(TimePoint timePoint,
|
||||
int passId, Flags upperFlag, Flags lowerFlag, boolean isDisplayed) {
|
||||
return createFlagEvent(timePoint, UUID.randomUUID(), new ArrayList<Competitor>(), passId, upperFlag, lowerFlag, isDisplayed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogStartTimeEvent createStartTimeEvent(
|
||||
TimePoint timePoint, Serializable id,
|
||||
List<Competitor> involvedBoats, int passId, TimePoint startTime) {
|
||||
return new RaceLogStartTimeEventImpl(timePoint, id, involvedBoats, passId, startTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceLogStartTimeEvent createStartTimeEvent(
|
||||
TimePoint timePoint, int passId, TimePoint startTime) {
|
||||
return createStartTimeEvent(timePoint, UUID.randomUUID(), new ArrayList<Competitor>(), passId, startTime);
|
||||
}
|
||||
|
||||
}
|
||||
+9
-9
@@ -1,13 +1,13 @@
|
||||
package com.sap.sailing.domain.racecommittee.impl;
|
||||
package com.sap.sailing.domain.racelog.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEvent;
|
||||
|
||||
public abstract class RaceCommitteeEventImpl implements RaceCommitteeEvent {
|
||||
public abstract class RaceLogEventImpl implements RaceLogEvent {
|
||||
|
||||
private static final long serialVersionUID = -5810258278984777732L;
|
||||
|
||||
@@ -16,7 +16,7 @@ public abstract class RaceCommitteeEventImpl implements RaceCommitteeEvent {
|
||||
private List<Competitor> involvedBoats;
|
||||
private int passId;
|
||||
|
||||
public RaceCommitteeEventImpl(TimePoint pTimePoint, Serializable pId, List<Competitor> pInvolvedBoats, int pPassId) {
|
||||
public RaceLogEventImpl(TimePoint pTimePoint, Serializable pId, List<Competitor> pInvolvedBoats, int pPassId) {
|
||||
this.timePoint = pTimePoint;
|
||||
this.id = pId;
|
||||
this.involvedBoats = pInvolvedBoats;
|
||||
@@ -45,11 +45,11 @@ public abstract class RaceCommitteeEventImpl implements RaceCommitteeEvent {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
return object instanceof RaceCommitteeEvent
|
||||
&& timePoint.equals(((RaceCommitteeEvent) object).getTimePoint())
|
||||
&& id.equals(((RaceCommitteeEvent) object).getId())
|
||||
&& involvedBoats.equals(((RaceCommitteeEvent) object).getInvolvedBoats())
|
||||
&& passId == ((RaceCommitteeEvent) object).getPassId();
|
||||
return object instanceof RaceLogEvent
|
||||
&& timePoint.equals(((RaceLogEvent) object).getTimePoint())
|
||||
&& id.equals(((RaceLogEvent) object).getId())
|
||||
&& involvedBoats.equals(((RaceLogEvent) object).getInvolvedBoats())
|
||||
&& passId == ((RaceLogEvent) object).getPassId();
|
||||
}
|
||||
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package com.sap.sailing.domain.racelog.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.racelog.Flags;
|
||||
import com.sap.sailing.domain.racelog.RaceLogFlagEvent;
|
||||
|
||||
public class RaceLogFlagEventImpl extends RaceLogEventImpl implements RaceLogFlagEvent {
|
||||
|
||||
private static final long serialVersionUID = 6333303528852541914L;
|
||||
private Flags upperFlag;
|
||||
private Flags lowerFlag;
|
||||
private boolean isDisplayed;
|
||||
|
||||
public RaceLogFlagEventImpl(TimePoint pTimePoint, Serializable pId, List<Competitor> pInvolvedBoats, int pPassId, Flags pUpperFlag, Flags pLowerFlag, boolean pIsDisplayed) {
|
||||
super(pTimePoint, pId, pInvolvedBoats, pPassId);
|
||||
this.upperFlag = pUpperFlag;
|
||||
this.lowerFlag = pLowerFlag;
|
||||
this.isDisplayed = pIsDisplayed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flags getUpperFlag() {
|
||||
return upperFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Flags getLowerFlag() {
|
||||
return lowerFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDisplayed() {
|
||||
return isDisplayed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
return super.equals(object)
|
||||
&& object instanceof RaceLogFlagEvent
|
||||
&& upperFlag.equals(((RaceLogFlagEvent) object).getUpperFlag())
|
||||
&& lowerFlag.equals(((RaceLogFlagEvent) object).getLowerFlag())
|
||||
&& isDisplayed == ((RaceLogFlagEvent) object).isDisplayed();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.sap.sailing.domain.racelog.impl;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.sap.sailing.domain.base.Timed;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLog;
|
||||
import com.sap.sailing.domain.racelog.RaceLogFlagEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogListener;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStartTimeEvent;
|
||||
import com.sap.sailing.domain.tracking.impl.TrackImpl;
|
||||
import com.sap.sailing.util.impl.ArrayListNavigableSet;
|
||||
|
||||
public class RaceLogImpl extends TrackImpl<RaceLogEvent> implements RaceLog {
|
||||
|
||||
private static final long serialVersionUID = -176745401321893502L;
|
||||
|
||||
private transient Set<RaceLogListener> listeners;
|
||||
|
||||
private final static Logger logger = Logger.getLogger(RaceLogImpl.class.getName());
|
||||
|
||||
public RaceLogImpl(String nameForReadWriteLock) {
|
||||
super(new ArrayListNavigableSet<Timed>(RaceLogEventComparator.INSTANCE), nameForReadWriteLock);
|
||||
listeners = new HashSet<RaceLogListener>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(RaceLogEvent event) {
|
||||
lockForWrite();
|
||||
try {
|
||||
getInternalRawFixes().add(event);
|
||||
} finally {
|
||||
unlockAfterWrite();
|
||||
}
|
||||
notifyListenersAboutReceive(event);
|
||||
}
|
||||
|
||||
private void notifyListenersAboutReceive(RaceLogEvent event) {
|
||||
if (event instanceof RaceLogFlagEvent) {
|
||||
notifiyListenersAboutReceivedFlagEvent((RaceLogFlagEvent) event);
|
||||
} else if (event instanceof RaceLogStartTimeEvent) {
|
||||
notifiyListenersAboutReceivedStartTimeEvent((RaceLogStartTimeEvent) event);
|
||||
}
|
||||
}
|
||||
|
||||
private void notifiyListenersAboutReceivedStartTimeEvent(RaceLogStartTimeEvent event) {
|
||||
synchronized (listeners) {
|
||||
for (RaceLogListener listener : listeners) {
|
||||
try {
|
||||
listener.startTimeEventReceived(event);
|
||||
} catch (Throwable t) {
|
||||
logger.log(Level.SEVERE, "RaceLogListener " + listener + " threw exception " + t.getMessage());
|
||||
logger.throwing(RaceLogImpl.class.getName(), "notifiyListenersAboutReceivedStartTimeEvent(RaceLogStartTimeEvent)", t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void notifiyListenersAboutReceivedFlagEvent(RaceLogFlagEvent event) {
|
||||
synchronized (listeners) {
|
||||
for (RaceLogListener listener : listeners) {
|
||||
try {
|
||||
listener.flagEventReceived(event);
|
||||
} catch (Throwable t) {
|
||||
logger.log(Level.SEVERE, "RaceLogListener " + listener + " threw exception " + t.getMessage());
|
||||
logger.throwing(RaceLogImpl.class.getName(), "notifiyListenersAboutReceivedFlagEvent(RaceLogFlagEvent)", t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(RaceLogListener newListener) {
|
||||
synchronized (listeners) {
|
||||
listeners.add(newListener);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.sap.sailing.domain.racelog.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStartTimeEvent;
|
||||
|
||||
public class RaceLogStartTimeEventImpl extends RaceLogEventImpl
|
||||
implements RaceLogStartTimeEvent {
|
||||
|
||||
private static final long serialVersionUID = 8185811395997196162L;
|
||||
private TimePoint startTime;
|
||||
|
||||
public RaceLogStartTimeEventImpl(TimePoint pTimePoint, Serializable pId, List<Competitor> pInvolvedBoats, int pPassId, TimePoint pStartTime) {
|
||||
super(pTimePoint, pId, pInvolvedBoats, pPassId);
|
||||
this.startTime = pStartTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TimePoint getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
return super.equals(object)
|
||||
&& object instanceof RaceLogStartTimeEvent
|
||||
&& startTime.equals(((RaceLogStartTimeEvent) object).getStartTime());
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -4,7 +4,7 @@ import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEvent;
|
||||
|
||||
public interface DynamicTrackedRace extends TrackedRace {
|
||||
void recordFix(Competitor competitor, GPSFixMoving fix);
|
||||
@@ -15,7 +15,7 @@ public interface DynamicTrackedRace extends TrackedRace {
|
||||
|
||||
void removeWind(Wind wind, WindSource windSource);
|
||||
|
||||
void recordRaceCommitteeEvent(RaceCommitteeEvent event);
|
||||
void recordRaceLogEvent(RaceLogEvent event);
|
||||
|
||||
/**
|
||||
* The raw, updating feed of a single competitor participating in this race
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
package com.sap.sailing.domain.tracking;
|
||||
|
||||
import com.sap.sailing.domain.base.RaceDefinition;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
|
||||
public interface DynamicTrackedRegatta extends TrackedRegatta {
|
||||
|
||||
@@ -20,6 +20,6 @@ public interface DynamicTrackedRegatta extends TrackedRegatta {
|
||||
*/
|
||||
DynamicTrackedRace createTrackedRace(RaceDefinition raceDefinition, WindStore windStore,
|
||||
long delayToLiveInMillis, long millisecondsOverWhichToAverageWind, long millisecondsOverWhichToAverageSpeed,
|
||||
DynamicRaceDefinitionSet raceDefinitionSetToUpdate, RaceCommitteeStore raceCommitteeStore);
|
||||
DynamicRaceDefinitionSet raceDefinitionSetToUpdate, RaceLogStore raceLogStore);
|
||||
|
||||
}
|
||||
+2
-2
@@ -7,7 +7,7 @@ import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.Waypoint;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEvent;
|
||||
|
||||
|
||||
public interface RaceChangeListener {
|
||||
@@ -36,7 +36,7 @@ public interface RaceChangeListener {
|
||||
void delayToLiveChanged(long delayToLiveInMillis);
|
||||
|
||||
void windSourcesToExcludeChanged(Iterable<? extends WindSource> windSourcesToExclude);
|
||||
void raceCommitteeEventReceived(RaceCommitteeEvent event);
|
||||
void raceLogEventReceived(RaceLogEvent event);
|
||||
|
||||
void statusChanged(TrackedRaceStatus newStatus);
|
||||
}
|
||||
@@ -23,8 +23,8 @@ import com.sap.sailing.domain.common.TrackedRaceStatusEnum;
|
||||
import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.common.WindSourceType;
|
||||
import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEventTrack;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.RaceLog;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
|
||||
/**
|
||||
* Live tracking data of a single race. The race follows a defined {@link Course} with a sequence of {@link Leg}s. The
|
||||
@@ -455,19 +455,19 @@ public interface TrackedRace extends Serializable {
|
||||
void waitUntilWindLoadingComplete() throws InterruptedException;
|
||||
|
||||
/**
|
||||
* Returns the race committee event track for this race or creates it if it did not exist yet
|
||||
* Returns the race log event track for this race or creates it if it did not exist yet
|
||||
*/
|
||||
RaceCommitteeEventTrack getRaceCommitteeEventTrack();
|
||||
RaceLog getRaceLog();
|
||||
|
||||
/**
|
||||
* When provided with a {@link RaceCommitteeStore} during construction, the tracked race will asynchronously load the race committee event
|
||||
* data for this tracked race from the race committee store in a background thread and update this tracked race with the results.
|
||||
* Clients that want to wait for the race committee event loading process to complete can do so by calling this method which will block
|
||||
* until the race committee event loading has completed.
|
||||
* When provided with a {@link RaceLogStore} during construction, the tracked race will asynchronously load the race log event
|
||||
* data for this tracked race from the race log store in a background thread and update this tracked race with the results.
|
||||
* Clients that want to wait for the race log event loading process to complete can do so by calling this method which will block
|
||||
* until the race log event loading has completed.
|
||||
*/
|
||||
void waitUntilRaceCommitteeEventLoadingComplete() throws InterruptedException;
|
||||
void waitUntilRaceLogLoadingComplete() throws InterruptedException;
|
||||
|
||||
RaceCommitteeStore getRaceCommitteeStore();
|
||||
RaceLogStore getRaceLogStore();
|
||||
|
||||
|
||||
TrackedRaceStatus getStatus();
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.base.RaceDefinition;
|
||||
import com.sap.sailing.domain.common.NoWindException;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
|
||||
/**
|
||||
* Manages a set of {@link TrackedRace} objects that belong to the same {@link Regatta} (regatta, sailing regatta for a
|
||||
@@ -42,7 +42,7 @@ public interface TrackedRegatta extends Serializable {
|
||||
*/
|
||||
DynamicTrackedRace createTrackedRace(RaceDefinition raceDefinition, WindStore windStore,
|
||||
long delayToLiveInMillis, long millisecondsOverWhichToAverageWind, long millisecondsOverWhichToAverageSpeed,
|
||||
DynamicRaceDefinitionSet raceDefinitionSetToUpdate, RaceCommitteeStore raceCommitteeStore);
|
||||
DynamicRaceDefinitionSet raceDefinitionSetToUpdate, RaceLogStore raceLogStore);
|
||||
|
||||
/**
|
||||
* Obtains the tracked race for <code>race</code>. Blocks until the tracked race has been created
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.Waypoint;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEvent;
|
||||
import com.sap.sailing.domain.tracking.GPSFix;
|
||||
import com.sap.sailing.domain.tracking.GPSFixMoving;
|
||||
import com.sap.sailing.domain.tracking.MarkPassing;
|
||||
@@ -61,7 +61,7 @@ public abstract class AbstractRaceChangeListener implements RaceChangeListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void raceCommitteeEventReceived(RaceCommitteeEvent event) {
|
||||
public void raceLogEventReceived(RaceLogEvent event) {
|
||||
}
|
||||
|
||||
}
|
||||
+11
-11
@@ -25,8 +25,8 @@ import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.common.WindSourceType;
|
||||
import com.sap.sailing.domain.common.impl.Util;
|
||||
import com.sap.sailing.domain.common.impl.WindSourceImpl;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEvent;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
import com.sap.sailing.domain.tracking.DynamicGPSFixTrack;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRace;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRegatta;
|
||||
@@ -58,9 +58,9 @@ public class DynamicTrackedRaceImpl extends TrackedRaceImpl implements
|
||||
|
||||
public DynamicTrackedRaceImpl(TrackedRegatta trackedRegatta, RaceDefinition race,
|
||||
WindStore windStore, long delayToLiveInMillis, long millisecondsOverWhichToAverageWind, long millisecondsOverWhichToAverageSpeed,
|
||||
long delayForCacheInvalidationOfWindEstimation, RaceCommitteeStore raceCommitteeStore) {
|
||||
long delayForCacheInvalidationOfWindEstimation, RaceLogStore raceLogStore) {
|
||||
super(trackedRegatta, race, windStore, delayToLiveInMillis, millisecondsOverWhichToAverageWind, millisecondsOverWhichToAverageSpeed,
|
||||
delayForCacheInvalidationOfWindEstimation, raceCommitteeStore);
|
||||
delayForCacheInvalidationOfWindEstimation, raceLogStore);
|
||||
this.raceIsKnownToStartUpwind = race.getBoatClass().typicallyStartsUpwind();
|
||||
if (!raceIsKnownToStartUpwind) {
|
||||
Set<WindSource> windSourcesToExclude = new HashSet<WindSource>();
|
||||
@@ -96,9 +96,9 @@ public class DynamicTrackedRaceImpl extends TrackedRaceImpl implements
|
||||
*/
|
||||
public DynamicTrackedRaceImpl(TrackedRegatta trackedRegatta, RaceDefinition race,
|
||||
WindStore windStore, long delayToLiveInMillis,
|
||||
long millisecondsOverWhichToAverageWind, long millisecondsOverWhichToAverageSpeed, RaceCommitteeStore raceCommitteeStore) {
|
||||
long millisecondsOverWhichToAverageWind, long millisecondsOverWhichToAverageSpeed, RaceLogStore raceLogStore) {
|
||||
this(trackedRegatta, race, windStore, delayToLiveInMillis, millisecondsOverWhichToAverageWind, millisecondsOverWhichToAverageSpeed,
|
||||
millisecondsOverWhichToAverageWind/2, raceCommitteeStore);
|
||||
millisecondsOverWhichToAverageWind/2, raceLogStore);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -639,24 +639,24 @@ public class DynamicTrackedRaceImpl extends TrackedRaceImpl implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordRaceCommitteeEvent(RaceCommitteeEvent event) {
|
||||
getRaceCommitteeEventTrack().add(event);
|
||||
public void recordRaceLogEvent(RaceLogEvent event) {
|
||||
getRaceLog().add(event);
|
||||
updated(/* time point */null); // TODO: updated has to be understood better, for now it shall have the same behaviour as in recordWind
|
||||
//TODO triggerRaceStateCalculation();
|
||||
notifyListeners(event);
|
||||
}
|
||||
|
||||
private void notifyListeners(RaceCommitteeEvent event) {
|
||||
private void notifyListeners(RaceLogEvent event) {
|
||||
RaceChangeListener[] listeners;
|
||||
synchronized (getListeners()) {
|
||||
listeners = getListeners().toArray(new RaceChangeListener[getListeners().size()]);
|
||||
}
|
||||
for (RaceChangeListener listener : listeners) {
|
||||
try {
|
||||
listener.raceCommitteeEventReceived(event);
|
||||
listener.raceLogEventReceived(event);
|
||||
} catch (Throwable t) {
|
||||
logger.log(Level.SEVERE, "RaceChangeListener " + listener + " threw exception " + t.getMessage());
|
||||
logger.throwing(DynamicTrackedRaceImpl.class.getName(), "notifyListeners(RaceCommitteeEvent)", t);
|
||||
logger.throwing(DynamicTrackedRaceImpl.class.getName(), "notifyListeners(RaceLogEvent)", t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -2,7 +2,7 @@ package com.sap.sailing.domain.tracking.impl;
|
||||
|
||||
import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.base.RaceDefinition;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
import com.sap.sailing.domain.tracking.DynamicRaceDefinitionSet;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRegatta;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRace;
|
||||
@@ -28,8 +28,8 @@ public class DynamicTrackedRegattaImpl extends TrackedRegattaImpl implements Dyn
|
||||
@Override
|
||||
public DynamicTrackedRace createTrackedRace(RaceDefinition raceDefinition, WindStore windStore,
|
||||
long delayToLiveInMillis, long millisecondsOverWhichToAverageWind, long millisecondsOverWhichToAverageSpeed,
|
||||
DynamicRaceDefinitionSet raceDefinitionSetToUpdate, RaceCommitteeStore raceCommitteeStore) {
|
||||
DynamicRaceDefinitionSet raceDefinitionSetToUpdate, RaceLogStore raceLogStore) {
|
||||
return (DynamicTrackedRace) super.createTrackedRace(raceDefinition, windStore, delayToLiveInMillis, millisecondsOverWhichToAverageWind,
|
||||
millisecondsOverWhichToAverageSpeed, raceDefinitionSetToUpdate, raceCommitteeStore);
|
||||
millisecondsOverWhichToAverageSpeed, raceDefinitionSetToUpdate, raceLogStore);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -29,7 +29,7 @@ import com.sap.sailing.domain.common.impl.DegreeBearingImpl;
|
||||
import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
import com.sap.sailing.domain.confidence.ConfidenceFactory;
|
||||
import com.sap.sailing.domain.confidence.Weigher;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEvent;
|
||||
import com.sap.sailing.domain.tracking.GPSFix;
|
||||
import com.sap.sailing.domain.tracking.GPSFixMoving;
|
||||
import com.sap.sailing.domain.tracking.MarkPassing;
|
||||
@@ -480,7 +480,7 @@ public class TrackBasedEstimationWindTrackImpl extends VirtualWindTrackImpl impl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void raceCommitteeEventReceived(RaceCommitteeEvent event) {
|
||||
public void raceLogEventReceived(RaceLogEvent event) {
|
||||
}
|
||||
|
||||
private void invalidateForNewWind(Wind wind) {
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.common.WindSourceType;
|
||||
import com.sap.sailing.domain.common.impl.Util;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEvent;
|
||||
import com.sap.sailing.domain.tracking.GPSFix;
|
||||
import com.sap.sailing.domain.tracking.GPSFixMoving;
|
||||
import com.sap.sailing.domain.tracking.MarkPassing;
|
||||
@@ -247,7 +247,7 @@ public class TrackedLegImpl implements TrackedLeg, RaceChangeListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void raceCommitteeEventReceived(RaceCommitteeEvent event) {
|
||||
public void raceLogEventReceived(RaceLogEvent event) {
|
||||
clearCaches();
|
||||
}
|
||||
|
||||
|
||||
+24
-24
@@ -69,9 +69,9 @@ import com.sap.sailing.domain.confidence.HasConfidence;
|
||||
import com.sap.sailing.domain.confidence.Weigher;
|
||||
import com.sap.sailing.domain.confidence.impl.HyperbolicTimeDifferenceWeigher;
|
||||
import com.sap.sailing.domain.confidence.impl.PositionAndTimePointWeigher;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEventTrack;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racecommittee.impl.EmptyRaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.RaceLog;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
import com.sap.sailing.domain.racelog.impl.EmptyRaceLogStore;
|
||||
import com.sap.sailing.domain.tracking.GPSFix;
|
||||
import com.sap.sailing.domain.tracking.GPSFixMoving;
|
||||
import com.sap.sailing.domain.tracking.GPSFixTrack;
|
||||
@@ -248,21 +248,21 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
|
||||
*/
|
||||
private final NamedReentrantReadWriteLock serializationLock;
|
||||
|
||||
private transient RaceCommitteeEventTrack raceCommitteeEventTrack;
|
||||
private transient RaceLog raceLog;
|
||||
|
||||
private transient RaceCommitteeStore raceCommitteeStore;
|
||||
private transient RaceLogStore raceLogStore;
|
||||
|
||||
/**
|
||||
* The constructor loads race committee events from the {@link #raceCommitteeStore} asynchronously. When completed, this flag is set to
|
||||
* The constructor loads race log events from the {@link #raceLogStore} asynchronously. When completed, this flag is set to
|
||||
* <code>true</code>, and all threads currently waiting on this object are notified.
|
||||
*/
|
||||
private boolean raceCommitteeLoadingCompleted;
|
||||
private boolean raceLogLoadingCompleted;
|
||||
|
||||
private final Map<Iterable<MarkPassing>, NamedReentrantReadWriteLock> locksForMarkPassings;
|
||||
|
||||
public TrackedRaceImpl(final TrackedRegatta trackedRegatta, RaceDefinition race, final WindStore windStore,
|
||||
long delayToLiveInMillis, final long millisecondsOverWhichToAverageWind, long millisecondsOverWhichToAverageSpeed,
|
||||
long delayForWindEstimationCacheInvalidation, final RaceCommitteeStore raceCommitteeStore) {
|
||||
long delayForWindEstimationCacheInvalidation, final RaceLogStore raceLogStore) {
|
||||
super();
|
||||
locksForMarkPassings = new IdentityHashMap<Iterable<MarkPassing>, NamedReentrantReadWriteLock>();
|
||||
this.status = new TrackedRaceStatusImpl(TrackedRaceStatusEnum.PREPARED, 0.0);
|
||||
@@ -272,7 +272,7 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
|
||||
this.updateCount = 0;
|
||||
this.race = race;
|
||||
this.windStore = windStore;
|
||||
this.raceCommitteeStore = raceCommitteeStore;
|
||||
this.raceLogStore = raceLogStore;
|
||||
this.windSourcesToExclude = new HashSet<WindSource>();
|
||||
this.directionFromStartToNextMarkCache = new HashMap<TimePoint, Future<Wind>>();
|
||||
this.millisecondsOverWhichToAverageSpeed = millisecondsOverWhichToAverageSpeed;
|
||||
@@ -340,20 +340,20 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
|
||||
}
|
||||
}.start();
|
||||
|
||||
new Thread("Race committee event loader for tracked race " + getRace().getName()) {
|
||||
new Thread("Race log event loader for tracked race " + getRace().getName()) {
|
||||
@Override
|
||||
public void run() {
|
||||
// When this tracked race is to be serialized, wait for the loading of the according race committee track to complete.
|
||||
// When this tracked race is to be serialized, wait for the loading of the according race log to complete.
|
||||
// It seems sufficiently unlikely that serialization is requested after the constructor succeeds and
|
||||
// before this thread obtains the lock.
|
||||
LockUtil.lockForRead(serializationLock);
|
||||
try {
|
||||
raceCommitteeEventTrack = raceCommitteeStore.getRaceCommitteeEventTrack(trackedRegatta, TrackedRaceImpl.this);
|
||||
raceLog = raceLogStore.getRaceLog(trackedRegatta, TrackedRaceImpl.this);
|
||||
} finally {
|
||||
LockUtil.unlockAfterRead(serializationLock);
|
||||
}
|
||||
synchronized (TrackedRaceImpl.this) {
|
||||
raceCommitteeLoadingCompleted = true;
|
||||
raceLogLoadingCompleted = true;
|
||||
TrackedRaceImpl.this.notifyAll();
|
||||
}
|
||||
}
|
||||
@@ -386,15 +386,15 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
|
||||
/**
|
||||
* Deserialization has to be maintained in lock-step with {@link #writeObject(ObjectOutputStream) serialization}.
|
||||
* When de-serializing, a possibly remote {@link #windStore} is ignored because it is transient. Instead, an
|
||||
* {@link EmptyWindStore} is used for the de-serialized instance. Same counts for the {@link #raceCommitteeStore}, which is then initialized
|
||||
* with a {@link EmptyRaceCommitteeStore}.
|
||||
* {@link EmptyWindStore} is used for the de-serialized instance. Same counts for the {@link #raceLogStore}, which is then initialized
|
||||
* with a {@link EmptyRaceLogStore}.
|
||||
*/
|
||||
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
|
||||
ois.defaultReadObject();
|
||||
markPassingsTimes = new ArrayList<Pair<Waypoint, Pair<TimePoint, TimePoint>>>();
|
||||
cacheInvalidationTimerLock = new Object();
|
||||
windStore = EmptyWindStore.INSTANCE;
|
||||
raceCommitteeStore = EmptyRaceCommitteeStore.INSTANCE;
|
||||
raceLogStore = EmptyRaceLogStore.INSTANCE;
|
||||
competitorRankings = new HashMap<TimePoint, List<Competitor>>();
|
||||
competitorRankingsLocks = new HashMap<TimePoint, NamedReentrantReadWriteLock>();
|
||||
directionFromStartToNextMarkCache = new HashMap<TimePoint, Future<Wind>>();
|
||||
@@ -410,8 +410,8 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void waitUntilRaceCommitteeEventLoadingComplete() throws InterruptedException {
|
||||
while (!raceCommitteeLoadingCompleted) {
|
||||
public synchronized void waitUntilRaceLogLoadingComplete() throws InterruptedException {
|
||||
while (!raceLogLoadingCompleted) {
|
||||
wait();
|
||||
}
|
||||
}
|
||||
@@ -451,8 +451,8 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceCommitteeStore getRaceCommitteeStore() {
|
||||
return raceCommitteeStore;
|
||||
public RaceLogStore getRaceLogStore() {
|
||||
return raceLogStore;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2256,15 +2256,15 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
|
||||
|
||||
|
||||
@Override
|
||||
public RaceCommitteeEventTrack getRaceCommitteeEventTrack() {
|
||||
if (raceCommitteeEventTrack == null) {
|
||||
public RaceLog getRaceLog() {
|
||||
if (raceLog == null) {
|
||||
try {
|
||||
waitUntilRaceCommitteeEventLoadingComplete();
|
||||
waitUntilRaceLogLoadingComplete();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return raceCommitteeEventTrack;
|
||||
return raceLog;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
-3
@@ -18,7 +18,7 @@ import com.sap.sailing.domain.base.RaceDefinition;
|
||||
import com.sap.sailing.domain.base.Regatta;
|
||||
import com.sap.sailing.domain.common.NoWindException;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStore;
|
||||
import com.sap.sailing.domain.tracking.DynamicRaceDefinitionSet;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRace;
|
||||
import com.sap.sailing.domain.tracking.RaceListener;
|
||||
@@ -170,10 +170,10 @@ public class TrackedRegattaImpl implements TrackedRegatta {
|
||||
@Override
|
||||
public DynamicTrackedRace createTrackedRace(RaceDefinition raceDefinition, WindStore windStore, long delayToLiveInMillis,
|
||||
long millisecondsOverWhichToAverageWind, long millisecondsOverWhichToAverageSpeed,
|
||||
DynamicRaceDefinitionSet raceDefinitionSetToUpdate, RaceCommitteeStore raceCommitteeStore) {
|
||||
DynamicRaceDefinitionSet raceDefinitionSetToUpdate, RaceLogStore raceLogStore) {
|
||||
logger.log(Level.INFO, "Creating DynamicTrackedRaceImpl for RaceDefinition " + raceDefinition.getName());
|
||||
DynamicTrackedRaceImpl result = new DynamicTrackedRaceImpl(this, raceDefinition,
|
||||
windStore, delayToLiveInMillis, millisecondsOverWhichToAverageWind, millisecondsOverWhichToAverageSpeed, raceCommitteeStore);
|
||||
windStore, delayToLiveInMillis, millisecondsOverWhichToAverageWind, millisecondsOverWhichToAverageSpeed, raceLogStore);
|
||||
addTrackedRace(result);
|
||||
if (raceDefinitionSetToUpdate != null) {
|
||||
raceDefinitionSetToUpdate.addRaceDefinition(raceDefinition);
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@ import com.sap.sailing.domain.common.impl.Util.Pair;
|
||||
import com.sap.sailing.domain.leaderboard.Leaderboard;
|
||||
import com.sap.sailing.domain.leaderboard.ScoreCorrection;
|
||||
import com.sap.sailing.domain.leaderboard.ScoreCorrectionListener;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEvent;
|
||||
import com.sap.sailing.domain.leaderboard.ThresholdBasedResultDiscardingRule;
|
||||
import com.sap.sailing.domain.tracking.GPSFix;
|
||||
import com.sap.sailing.domain.tracking.GPSFixMoving;
|
||||
@@ -161,7 +161,7 @@ public class LeaderboardDTOCache {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void raceCommitteeEventReceived(RaceCommitteeEvent event) {
|
||||
public void raceLogEventReceived(RaceLogEvent event) {
|
||||
removeFromCache(leaderboard);
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -108,9 +108,9 @@ import com.sap.sailing.domain.leaderboard.RegattaLeaderboard;
|
||||
import com.sap.sailing.domain.persistence.DomainObjectFactory;
|
||||
import com.sap.sailing.domain.persistence.MongoFactory;
|
||||
import com.sap.sailing.domain.persistence.MongoObjectFactory;
|
||||
import com.sap.sailing.domain.persistence.MongoRaceCommitteeStoreFactory;
|
||||
import com.sap.sailing.domain.persistence.MongoRaceLogStoreFactory;
|
||||
import com.sap.sailing.domain.persistence.MongoWindStoreFactory;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEvent;
|
||||
import com.sap.sailing.domain.swisstimingadapter.SwissTimingArchiveConfiguration;
|
||||
import com.sap.sailing.domain.swisstimingadapter.SwissTimingConfiguration;
|
||||
import com.sap.sailing.domain.swisstimingadapter.SwissTimingFactory;
|
||||
@@ -814,7 +814,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
}
|
||||
|
||||
@Override
|
||||
public void raceCommitteeEventReceived(RaceCommitteeEvent event) {
|
||||
public void raceLogEventReceived(RaceLogEvent event) {
|
||||
invalidateCacheAndRemoveThisListenerFromTrackedRace();
|
||||
}
|
||||
}
|
||||
@@ -1146,7 +1146,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
new MillisecondsTimePoint(rr.trackingEndTime),
|
||||
MongoWindStoreFactory.INSTANCE.getMongoWindStore(mongoObjectFactory, domainObjectFactory),
|
||||
RaceTracker.TIMEOUT_FOR_RECEIVING_RACE_DEFINITION_IN_MILLISECONDS, simulateWithStartTimeNow,
|
||||
MongoRaceCommitteeStoreFactory.INSTANCE.getMongoRaceCommitteeStore(mongoObjectFactory, domainObjectFactory));
|
||||
MongoRaceLogStoreFactory.INSTANCE.getMongoRaceLogStore(mongoObjectFactory, domainObjectFactory));
|
||||
if (trackWind) {
|
||||
new Thread("Wind tracking starter for race " + rr.regattaName + "/" + rr.name) {
|
||||
public void run() {
|
||||
@@ -2380,7 +2380,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
canSendRequests,
|
||||
MongoWindStoreFactory.INSTANCE.getMongoWindStore(mongoObjectFactory, domainObjectFactory),
|
||||
RaceTracker.TIMEOUT_FOR_RECEIVING_RACE_DEFINITION_IN_MILLISECONDS,
|
||||
MongoRaceCommitteeStoreFactory.INSTANCE.getMongoRaceCommitteeStore(mongoObjectFactory, domainObjectFactory));
|
||||
MongoRaceLogStoreFactory.INSTANCE.getMongoRaceLogStore(mongoObjectFactory, domainObjectFactory));
|
||||
if (trackWind) {
|
||||
new Thread("Wind tracking starter for race " + rr.ID + "/" + rr.description) {
|
||||
public void run() {
|
||||
@@ -2827,7 +2827,7 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
|
||||
|
||||
@Override
|
||||
public EventDTO createEvent(String eventName, String venue, String publicationUrl, boolean isPublic) {
|
||||
return convertToEventDTO(getService().apply(new CreateEvent(eventName, venue, publicationUrl, isPublic, new ArrayList<String>())));
|
||||
return convertToEventDTO(getService().apply(new CreateEvent(eventName, venue, publicationUrl, isPublic, UUID.randomUUID(), new ArrayList<String>())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+16
-16
@@ -17,14 +17,14 @@ import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.persistence.MongoFactory;
|
||||
import com.sap.sailing.domain.persistence.impl.DomainObjectFactoryImpl;
|
||||
import com.sap.sailing.domain.persistence.impl.MongoObjectFactoryImpl;
|
||||
import com.sap.sailing.domain.racecommittee.Flags;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEventFactory;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeFlagEvent;
|
||||
import com.sap.sailing.domain.racelog.Flags;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEventFactory;
|
||||
import com.sap.sailing.domain.racelog.RaceLogFlagEvent;
|
||||
|
||||
public class TestStoringAndRetrievingRaceCommitteeEventData extends AbstractMongoDBTest {
|
||||
private static final String RACECOMMITTEE_TEST_COLLECTION = "racecommittee_test_collection";
|
||||
public class TestStoringAndRetrievingRaceLogEventData extends AbstractMongoDBTest {
|
||||
private static final String RACELOG_TEST_COLLECTION = "racelog_test_collection";
|
||||
|
||||
public TestStoringAndRetrievingRaceCommitteeEventData() throws UnknownHostException, MongoException {
|
||||
public TestStoringAndRetrievingRaceLogEventData() throws UnknownHostException, MongoException {
|
||||
super();
|
||||
}
|
||||
|
||||
@@ -32,12 +32,12 @@ public class TestStoringAndRetrievingRaceCommitteeEventData extends AbstractMong
|
||||
@Override
|
||||
public void dropTestDB() throws UnknownHostException, MongoException, InterruptedException {
|
||||
super.dropTestDB();
|
||||
db.getCollection(RACECOMMITTEE_TEST_COLLECTION).drop();
|
||||
db.getCollection(RACELOG_TEST_COLLECTION).drop();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDBConnection() throws UnknownHostException, MongoException {
|
||||
DBCollection coll = db.getCollection(RACECOMMITTEE_TEST_COLLECTION);
|
||||
DBCollection coll = db.getCollection(RACELOG_TEST_COLLECTION);
|
||||
assertNotNull(coll);
|
||||
BasicDBObject doc = new BasicDBObject();
|
||||
doc.put("upperflag", "AP");
|
||||
@@ -48,7 +48,7 @@ public class TestStoringAndRetrievingRaceCommitteeEventData extends AbstractMong
|
||||
@Test
|
||||
public void testDBRead() throws UnknownHostException, MongoException, InterruptedException {
|
||||
{
|
||||
DBCollection coll = db.getCollection(RACECOMMITTEE_TEST_COLLECTION);
|
||||
DBCollection coll = db.getCollection(RACELOG_TEST_COLLECTION);
|
||||
assertNotNull(coll);
|
||||
BasicDBObject doc = new BasicDBObject();
|
||||
doc.put("upperflag", "AP");
|
||||
@@ -57,7 +57,7 @@ public class TestStoringAndRetrievingRaceCommitteeEventData extends AbstractMong
|
||||
}
|
||||
|
||||
{
|
||||
DBCollection coll = db.getCollection(RACECOMMITTEE_TEST_COLLECTION);
|
||||
DBCollection coll = db.getCollection(RACELOG_TEST_COLLECTION);
|
||||
assertNotNull(coll);
|
||||
DBObject object = coll.findOne();
|
||||
assertEquals("AP", object.get("upperflag"));
|
||||
@@ -66,21 +66,21 @@ public class TestStoringAndRetrievingRaceCommitteeEventData extends AbstractMong
|
||||
}
|
||||
|
||||
@Test
|
||||
public void storeWindObject() throws UnknownHostException, MongoException, InterruptedException {
|
||||
public void storeRaceLogObject() throws UnknownHostException, MongoException, InterruptedException {
|
||||
TimePoint now = MillisecondsTimePoint.now();
|
||||
RaceCommitteeFlagEvent rcEvent = RaceCommitteeEventFactory.INSTANCE.createFlagEvent(now, 0, Flags.AP, Flags.ALPHA, true);
|
||||
RaceLogFlagEvent rcEvent = RaceLogEventFactory.INSTANCE.createFlagEvent(now, 0, Flags.AP, Flags.ALPHA, true);
|
||||
{
|
||||
DBObject rcEventForMongo = ((MongoObjectFactoryImpl) MongoFactory.INSTANCE.getDefaultMongoObjectFactory())
|
||||
.storeRaceCommitteeFlagEvent(rcEvent);
|
||||
DBCollection coll = db.getCollection(RACECOMMITTEE_TEST_COLLECTION);
|
||||
.storeRaceLogFlagEvent(rcEvent);
|
||||
DBCollection coll = db.getCollection(RACELOG_TEST_COLLECTION);
|
||||
coll.insert(rcEventForMongo);
|
||||
}
|
||||
|
||||
{
|
||||
DBCollection coll = db.getCollection(RACECOMMITTEE_TEST_COLLECTION);
|
||||
DBCollection coll = db.getCollection(RACELOG_TEST_COLLECTION);
|
||||
assertNotNull(coll);
|
||||
DBObject object = coll.findOne();
|
||||
RaceCommitteeFlagEvent readRcEvent = (RaceCommitteeFlagEvent) ((DomainObjectFactoryImpl) MongoFactory.INSTANCE.getDefaultDomainObjectFactory()).loadRaceCommitteeEvent(object);
|
||||
RaceLogFlagEvent readRcEvent = (RaceLogFlagEvent) ((DomainObjectFactoryImpl) MongoFactory.INSTANCE.getDefaultDomainObjectFactory()).loadRaceLogEvent(object);
|
||||
assertEquals(rcEvent.getTimePoint(), readRcEvent.getTimePoint());
|
||||
assertEquals(rcEvent.getId(), readRcEvent.getId());
|
||||
assertEquals(rcEvent.getPassId(), readRcEvent.getPassId());
|
||||
+16
-16
@@ -19,11 +19,11 @@ import com.sap.sailing.domain.base.impl.MillisecondsTimePoint;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.persistence.impl.DomainObjectFactoryImpl;
|
||||
import com.sap.sailing.domain.persistence.impl.MongoObjectFactoryImpl;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEvent;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEventFactory;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEventTrack;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStartTimeEvent;
|
||||
import com.sap.sailing.domain.racecommittee.impl.EmptyRaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.RaceLog;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEventFactory;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStartTimeEvent;
|
||||
import com.sap.sailing.domain.racelog.impl.EmptyRaceLogStore;
|
||||
import com.sap.sailing.domain.test.AbstractTracTracLiveTest;
|
||||
import com.sap.sailing.domain.tracking.DynamicRaceDefinitionSet;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRace;
|
||||
@@ -35,14 +35,14 @@ import com.sap.sailing.domain.tractracadapter.ReceiverType;
|
||||
import com.sap.sailing.mongodb.MongoDBConfiguration;
|
||||
import com.sap.sailing.server.impl.RacingEventServiceImpl;
|
||||
|
||||
public class TestStoringAndRetrievingRaceCommitteeEventTracksTest extends AbstractTracTracLiveTest {
|
||||
public class TestStoringAndRetrievingRaceLogsTest extends AbstractTracTracLiveTest {
|
||||
|
||||
private Mongo mongo;
|
||||
private DB db;
|
||||
|
||||
private final MongoDBConfiguration dbConfiguration;
|
||||
|
||||
public TestStoringAndRetrievingRaceCommitteeEventTracksTest() throws URISyntaxException, MalformedURLException {
|
||||
public TestStoringAndRetrievingRaceLogsTest() throws URISyntaxException, MalformedURLException {
|
||||
super();
|
||||
dbConfiguration = MongoDBConfiguration.getDefaultTestConfiguration();
|
||||
}
|
||||
@@ -62,12 +62,12 @@ public class TestStoringAndRetrievingRaceCommitteeEventTracksTest extends Abstra
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStoreAFewRCEventEntries() throws UnknownHostException, MongoException, InterruptedException {
|
||||
public void testStoreAFewRaceLogEntries() throws UnknownHostException, MongoException, InterruptedException {
|
||||
DomainFactory domainFactory = DomainFactory.INSTANCE;
|
||||
Regatta domainEvent = domainFactory.getOrCreateDefaultRegatta(getTracTracEvent(), /* trackedRegattaRegistry */ null);
|
||||
DynamicTrackedRegatta trackedRegatta = new RacingEventServiceImpl().getOrCreateTrackedRegatta(domainEvent);
|
||||
Iterable<Receiver> typeControllers = domainFactory.getUpdateReceivers(trackedRegatta, getTracTracEvent(),
|
||||
EmptyWindStore.INSTANCE, EmptyRaceCommitteeStore.INSTANCE,
|
||||
EmptyWindStore.INSTANCE, EmptyRaceLogStore.INSTANCE,
|
||||
/* startOfTracking */null, /* endOfTracking */null, /* delayToLiveInMillis */
|
||||
0l, /* simulator */ null, new DynamicRaceDefinitionSet() {
|
||||
@Override
|
||||
@@ -81,18 +81,18 @@ public class TestStoringAndRetrievingRaceCommitteeEventTracksTest extends Abstra
|
||||
@Override
|
||||
public void addRaceDefinition(RaceDefinition race) {
|
||||
}
|
||||
}, EmptyRaceCommitteeStore.INSTANCE);
|
||||
}, EmptyRaceLogStore.INSTANCE);
|
||||
|
||||
Mongo myFirstMongo = newMongo();
|
||||
DB firstDatabase = myFirstMongo.getDB(dbConfiguration.getDatabaseName());
|
||||
new MongoObjectFactoryImpl(firstDatabase).addRaceCommitteeEventTrackDumper(trackedRegatta, trackedRace);
|
||||
RaceCommitteeEventTrack raceCommitteeEventTrack = trackedRace.getRaceCommitteeEventTrack();
|
||||
new MongoObjectFactoryImpl(firstDatabase).addRaceLogDumper(trackedRegatta, trackedRace);
|
||||
RaceLog raceLog = trackedRace.getRaceLog();
|
||||
|
||||
TimePoint timePoint = MillisecondsTimePoint.now();
|
||||
TimePoint timePointStartTime = new MillisecondsTimePoint(timePoint.asMillis() + 60000);
|
||||
TimePoint initialTimePointStartTime = timePointStartTime;
|
||||
for (int passId = 0; passId < 100; passId++) {
|
||||
raceCommitteeEventTrack.add(RaceCommitteeEventFactory.INSTANCE.createStartTimeEvent(timePoint, passId, timePointStartTime));
|
||||
raceLog.add(RaceLogEventFactory.INSTANCE.createStartTimeEvent(timePoint, passId, timePointStartTime));
|
||||
timePoint = new MillisecondsTimePoint(timePoint.asMillis() + 100);
|
||||
timePointStartTime = new MillisecondsTimePoint(timePointStartTime.asMillis() + 100);
|
||||
}
|
||||
@@ -101,14 +101,14 @@ public class TestStoringAndRetrievingRaceCommitteeEventTracksTest extends Abstra
|
||||
|
||||
Mongo mySecondMongo = newMongo();
|
||||
DB secondDatabase = mySecondMongo.getDB(dbConfiguration.getDatabaseName());
|
||||
RaceCommitteeEventTrack result = new DomainObjectFactoryImpl(secondDatabase).loadRaceCommitteeEventTrack(domainEvent, race);
|
||||
RaceLog result = new DomainObjectFactoryImpl(secondDatabase).loadRaceLog(domainEvent, race);
|
||||
int resultingPassId = 0;
|
||||
timePointStartTime = initialTimePointStartTime;
|
||||
|
||||
result.lockForRead();
|
||||
try {
|
||||
for (RaceCommitteeEvent event : result.getRawFixes()) {
|
||||
RaceCommitteeStartTimeEvent startTimeEvent = (RaceCommitteeStartTimeEvent) event;
|
||||
for (RaceLogEvent event : result.getRawFixes()) {
|
||||
RaceLogStartTimeEvent startTimeEvent = (RaceLogStartTimeEvent) event;
|
||||
|
||||
assertEquals(resultingPassId, startTimeEvent.getPassId());
|
||||
assertEquals(timePointStartTime, startTimeEvent.getStartTime());
|
||||
+3
-3
@@ -27,7 +27,7 @@ import com.sap.sailing.domain.common.impl.DegreePosition;
|
||||
import com.sap.sailing.domain.common.impl.WindSourceImpl;
|
||||
import com.sap.sailing.domain.persistence.impl.DomainObjectFactoryImpl;
|
||||
import com.sap.sailing.domain.persistence.impl.MongoObjectFactoryImpl;
|
||||
import com.sap.sailing.domain.racecommittee.impl.EmptyRaceCommitteeStore;
|
||||
import com.sap.sailing.domain.racelog.impl.EmptyRaceLogStore;
|
||||
import com.sap.sailing.domain.test.AbstractTracTracLiveTest;
|
||||
import com.sap.sailing.domain.tracking.DynamicRaceDefinitionSet;
|
||||
import com.sap.sailing.domain.tracking.DynamicTrackedRegatta;
|
||||
@@ -74,7 +74,7 @@ public class TestStoringAndRetrievingWindTracksTest extends AbstractTracTracLive
|
||||
Regatta domainEvent = domainFactory.getOrCreateDefaultRegatta(getTracTracEvent(), /* trackedRegattaRegistry */ null);
|
||||
DynamicTrackedRegatta trackedRegatta = new RacingEventServiceImpl().getOrCreateTrackedRegatta(domainEvent);
|
||||
Iterable<Receiver> typeControllers = domainFactory.getUpdateReceivers(trackedRegatta, getTracTracEvent(),
|
||||
EmptyWindStore.INSTANCE, EmptyRaceCommitteeStore.INSTANCE,
|
||||
EmptyWindStore.INSTANCE, EmptyRaceLogStore.INSTANCE,
|
||||
/* startOfTracking */null, /* endOfTracking */null, /* delayToLiveInMillis */
|
||||
0l, /* simulator */ null, new DynamicRaceDefinitionSet() {
|
||||
@Override
|
||||
@@ -88,7 +88,7 @@ public class TestStoringAndRetrievingWindTracksTest extends AbstractTracTracLive
|
||||
@Override
|
||||
public void addRaceDefinition(RaceDefinition race) {
|
||||
}
|
||||
}, EmptyRaceCommitteeStore.INSTANCE);
|
||||
}, EmptyRaceLogStore.INSTANCE);
|
||||
WindSource windSource = new WindSourceImpl(WindSourceType.WEB);
|
||||
Mongo myFirstMongo = newMongo();
|
||||
DB firstDatabase = myFirstMongo.getDB(dbConfiguration.getDatabaseName());
|
||||
|
||||
+62
-62
@@ -1,62 +1,62 @@
|
||||
package com.sap.sailing.server.gateway.serialization.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEvent;
|
||||
import com.sap.sailing.server.gateway.serialization.JsonSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.BaseRaceCommitteeEventSerializer;
|
||||
|
||||
public abstract class BaseRaceCommitteEventTest<FlagType extends RaceCommitteeEvent> {
|
||||
|
||||
protected final UUID expectedId = UUID.randomUUID();
|
||||
protected final long expectedTimestamp = 1337l;
|
||||
protected final int expectedPassId = 42;
|
||||
|
||||
protected JsonSerializer<RaceCommitteeEvent> serializer;
|
||||
protected FlagType event;
|
||||
|
||||
protected abstract FlagType createMockEvent();
|
||||
|
||||
protected abstract JsonSerializer<RaceCommitteeEvent> createSerializer();
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
serializer = createSerializer();
|
||||
event = createMockEvent();
|
||||
|
||||
TimePoint timePoint = mock(TimePoint.class);
|
||||
when(timePoint.asMillis()).thenReturn(expectedTimestamp);
|
||||
|
||||
when(event.getId()).thenReturn(expectedId);
|
||||
when(event.getTimePoint()).thenReturn(timePoint);
|
||||
when(event.getPassId()).thenReturn(expectedPassId);
|
||||
when(event.getInvolvedBoats()).thenReturn(
|
||||
Collections.<Competitor> emptyList());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSerializeBaseAttributes() {
|
||||
JSONObject json = serializer.serialize(event);
|
||||
|
||||
assertEquals(
|
||||
expectedId,
|
||||
UUID.fromString(json.get(
|
||||
BaseRaceCommitteeEventSerializer.FIELD_ID).toString()));
|
||||
assertEquals(expectedTimestamp,
|
||||
json.get(BaseRaceCommitteeEventSerializer.FIELD_TIMESTAMP));
|
||||
assertEquals(expectedPassId,
|
||||
json.get(BaseRaceCommitteeEventSerializer.FIELD_PASS_ID));
|
||||
}
|
||||
|
||||
}
|
||||
package com.sap.sailing.server.gateway.serialization.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEvent;
|
||||
import com.sap.sailing.server.gateway.serialization.JsonSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.BaseRaceLogEventSerializer;
|
||||
|
||||
public abstract class BaseRaceLogEventTest<FlagType extends RaceLogEvent> {
|
||||
|
||||
protected final UUID expectedId = UUID.randomUUID();
|
||||
protected final long expectedTimestamp = 1337l;
|
||||
protected final int expectedPassId = 42;
|
||||
|
||||
protected JsonSerializer<RaceLogEvent> serializer;
|
||||
protected FlagType event;
|
||||
|
||||
protected abstract FlagType createMockEvent();
|
||||
|
||||
protected abstract JsonSerializer<RaceLogEvent> createSerializer();
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
serializer = createSerializer();
|
||||
event = createMockEvent();
|
||||
|
||||
TimePoint timePoint = mock(TimePoint.class);
|
||||
when(timePoint.asMillis()).thenReturn(expectedTimestamp);
|
||||
|
||||
when(event.getId()).thenReturn(expectedId);
|
||||
when(event.getTimePoint()).thenReturn(timePoint);
|
||||
when(event.getPassId()).thenReturn(expectedPassId);
|
||||
when(event.getInvolvedBoats()).thenReturn(
|
||||
Collections.<Competitor> emptyList());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSerializeBaseAttributes() {
|
||||
JSONObject json = serializer.serialize(event);
|
||||
|
||||
assertEquals(
|
||||
expectedId,
|
||||
UUID.fromString(json.get(
|
||||
BaseRaceLogEventSerializer.FIELD_ID).toString()));
|
||||
assertEquals(expectedTimestamp,
|
||||
json.get(BaseRaceLogEventSerializer.FIELD_TIMESTAMP));
|
||||
assertEquals(expectedPassId,
|
||||
json.get(BaseRaceLogEventSerializer.FIELD_PASS_ID));
|
||||
}
|
||||
|
||||
}
|
||||
+9
-9
@@ -6,16 +6,16 @@ import static org.mockito.Mockito.mock;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEvent;
|
||||
import com.sap.sailing.server.gateway.serialization.JsonSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.BaseRaceCommitteeEventSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.RaceCommitteeFlagEventSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.BaseRaceLogEventSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.RaceLogFlagEventSerializer;
|
||||
|
||||
public class RaceCommitteeEventTest extends BaseRaceCommitteEventTest<RaceCommitteeEvent> {
|
||||
public class RaceLogEventTest extends BaseRaceLogEventTest<RaceLogEvent> {
|
||||
|
||||
protected final String expectedClassValue = "AllYourBaseAreBelongToUs";
|
||||
|
||||
private class TestRaceCommitteeEventSerializer extends BaseRaceCommitteeEventSerializer {
|
||||
private class TestRaceCommitteeEventSerializer extends BaseRaceLogEventSerializer {
|
||||
@SuppressWarnings("unchecked")
|
||||
public TestRaceCommitteeEventSerializer() {
|
||||
super(mock(JsonSerializer.class));
|
||||
@@ -28,12 +28,12 @@ public class RaceCommitteeEventTest extends BaseRaceCommitteEventTest<RaceCommit
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RaceCommitteeEvent createMockEvent() {
|
||||
return mock(RaceCommitteeEvent.class);
|
||||
protected RaceLogEvent createMockEvent() {
|
||||
return mock(RaceLogEvent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JsonSerializer<RaceCommitteeEvent> createSerializer() {
|
||||
protected JsonSerializer<RaceLogEvent> createSerializer() {
|
||||
return new TestRaceCommitteeEventSerializer();
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class RaceCommitteeEventTest extends BaseRaceCommitteEventTest<RaceCommit
|
||||
|
||||
assertEquals(
|
||||
expectedClassValue,
|
||||
json.get(RaceCommitteeFlagEventSerializer.FIELD_CLASS));
|
||||
json.get(RaceLogFlagEventSerializer.FIELD_CLASS));
|
||||
}
|
||||
|
||||
}
|
||||
+14
-14
@@ -8,13 +8,13 @@ import org.json.simple.JSONObject;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.domain.racecommittee.Flags;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEvent;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeFlagEvent;
|
||||
import com.sap.sailing.domain.racelog.Flags;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogFlagEvent;
|
||||
import com.sap.sailing.server.gateway.serialization.JsonSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.RaceCommitteeFlagEventSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.RaceLogFlagEventSerializer;
|
||||
|
||||
public class RaceCommitteeFlagEventSerializerTest extends BaseRaceCommitteEventTest<RaceCommitteeFlagEvent> {
|
||||
public class RaceLogFlagEventSerializerTest extends BaseRaceLogEventTest<RaceLogFlagEvent> {
|
||||
|
||||
|
||||
private Flags expectedUpperFlag = Flags.FOXTROTT;
|
||||
@@ -22,8 +22,8 @@ public class RaceCommitteeFlagEventSerializerTest extends BaseRaceCommitteEventT
|
||||
private boolean expectedDisplayed = true;
|
||||
|
||||
@Override
|
||||
protected RaceCommitteeFlagEvent createMockEvent() {
|
||||
RaceCommitteeFlagEvent event = mock(RaceCommitteeFlagEvent.class);
|
||||
protected RaceLogFlagEvent createMockEvent() {
|
||||
RaceLogFlagEvent event = mock(RaceLogFlagEvent.class);
|
||||
|
||||
when(event.getUpperFlag()).thenReturn(expectedUpperFlag);
|
||||
when(event.getLowerFlag()).thenReturn(expectedLowerFlag);
|
||||
@@ -34,8 +34,8 @@ public class RaceCommitteeFlagEventSerializerTest extends BaseRaceCommitteEventT
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected JsonSerializer<RaceCommitteeEvent> createSerializer() {
|
||||
return new RaceCommitteeFlagEventSerializer(mock(JsonSerializer.class));
|
||||
protected JsonSerializer<RaceLogEvent> createSerializer() {
|
||||
return new RaceLogFlagEventSerializer(mock(JsonSerializer.class));
|
||||
}
|
||||
|
||||
@Before
|
||||
@@ -49,13 +49,13 @@ public class RaceCommitteeFlagEventSerializerTest extends BaseRaceCommitteEventT
|
||||
|
||||
assertEquals(
|
||||
expectedUpperFlag,
|
||||
json.get(RaceCommitteeFlagEventSerializer.FIELD_UPPER_FLAG));
|
||||
json.get(RaceLogFlagEventSerializer.FIELD_UPPER_FLAG));
|
||||
assertEquals(
|
||||
expectedLowerFlag,
|
||||
json.get(RaceCommitteeFlagEventSerializer.FIELD_LOWER_FLAG));
|
||||
json.get(RaceLogFlagEventSerializer.FIELD_LOWER_FLAG));
|
||||
assertEquals(
|
||||
expectedDisplayed,
|
||||
json.get(RaceCommitteeFlagEventSerializer.FIELD_DISPLAYED));
|
||||
json.get(RaceLogFlagEventSerializer.FIELD_DISPLAYED));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -63,8 +63,8 @@ public class RaceCommitteeFlagEventSerializerTest extends BaseRaceCommitteEventT
|
||||
JSONObject json = serializer.serialize(event);
|
||||
|
||||
assertEquals(
|
||||
RaceCommitteeFlagEventSerializer.VALUE_CLASS,
|
||||
json.get(RaceCommitteeFlagEventSerializer.FIELD_CLASS));
|
||||
RaceLogFlagEventSerializer.VALUE_CLASS,
|
||||
json.get(RaceLogFlagEventSerializer.FIELD_CLASS));
|
||||
}
|
||||
|
||||
}
|
||||
+11
-11
@@ -8,22 +8,22 @@ import org.json.simple.JSONObject;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEvent;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeStartTimeEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogStartTimeEvent;
|
||||
import com.sap.sailing.server.gateway.serialization.JsonSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.RaceCommitteeStartTimeEventSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.RaceLogStartTimeEventSerializer;
|
||||
|
||||
public class RaceCommitteeStartTimeEventSerializerTest extends BaseRaceCommitteEventTest<RaceCommitteeStartTimeEvent> {
|
||||
public class RaceLogStartTimeEventSerializerTest extends BaseRaceLogEventTest<RaceLogStartTimeEvent> {
|
||||
|
||||
private final long expectedStartTimeTimestamp = 2013;
|
||||
|
||||
@Override
|
||||
protected RaceCommitteeStartTimeEvent createMockEvent() {
|
||||
protected RaceLogStartTimeEvent createMockEvent() {
|
||||
|
||||
TimePoint startTime = mock(TimePoint.class);
|
||||
when(startTime.asMillis()).thenReturn(expectedStartTimeTimestamp);
|
||||
|
||||
RaceCommitteeStartTimeEvent event = mock(RaceCommitteeStartTimeEvent.class);
|
||||
RaceLogStartTimeEvent event = mock(RaceLogStartTimeEvent.class);
|
||||
when(event.getStartTime()).thenReturn(startTime);
|
||||
|
||||
return event;
|
||||
@@ -31,8 +31,8 @@ public class RaceCommitteeStartTimeEventSerializerTest extends BaseRaceCommitteE
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected JsonSerializer<RaceCommitteeEvent> createSerializer() {
|
||||
return new RaceCommitteeStartTimeEventSerializer(mock(JsonSerializer.class));
|
||||
protected JsonSerializer<RaceLogEvent> createSerializer() {
|
||||
return new RaceLogStartTimeEventSerializer(mock(JsonSerializer.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -41,7 +41,7 @@ public class RaceCommitteeStartTimeEventSerializerTest extends BaseRaceCommitteE
|
||||
|
||||
assertEquals(
|
||||
expectedStartTimeTimestamp,
|
||||
json.get(RaceCommitteeStartTimeEventSerializer.FIELD_START_TIME));
|
||||
json.get(RaceLogStartTimeEventSerializer.FIELD_START_TIME));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -49,8 +49,8 @@ public class RaceCommitteeStartTimeEventSerializerTest extends BaseRaceCommitteE
|
||||
JSONObject json = serializer.serialize(event);
|
||||
|
||||
assertEquals(
|
||||
RaceCommitteeStartTimeEventSerializer.VALUE_CLASS,
|
||||
json.get(RaceCommitteeStartTimeEventSerializer.FIELD_CLASS));
|
||||
RaceLogStartTimeEventSerializer.VALUE_CLASS,
|
||||
json.get(RaceLogStartTimeEventSerializer.FIELD_CLASS));
|
||||
}
|
||||
|
||||
}
|
||||
+8
-8
@@ -6,24 +6,24 @@ import org.json.simple.JSONObject;
|
||||
|
||||
import com.sap.sailing.domain.base.impl.MillisecondsTimePoint;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEvent;
|
||||
import com.sap.sailing.domain.racelog.RaceLogEvent;
|
||||
import com.sap.sailing.server.gateway.deserialization.JsonDeserializationException;
|
||||
import com.sap.sailing.server.gateway.deserialization.JsonDeserializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.BaseRaceCommitteeEventSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.BaseRaceLogEventSerializer;
|
||||
|
||||
/// TODO deserialize involved boats
|
||||
public abstract class BaseRaceCommitteeEventDeserializer implements JsonDeserializer<RaceCommitteeEvent> {
|
||||
public abstract class BaseRaceLogEventDeserializer implements JsonDeserializer<RaceLogEvent> {
|
||||
|
||||
protected abstract RaceCommitteeEvent deserialize(JSONObject object, Serializable id, TimePoint timePoint, int passId)
|
||||
protected abstract RaceLogEvent deserialize(JSONObject object, Serializable id, TimePoint timePoint, int passId)
|
||||
throws JsonDeserializationException;
|
||||
|
||||
@Override
|
||||
public RaceCommitteeEvent deserialize(JSONObject object)
|
||||
public RaceLogEvent deserialize(JSONObject object)
|
||||
throws JsonDeserializationException {
|
||||
// Factory handles class field and subclassing...
|
||||
String id = object.get(BaseRaceCommitteeEventSerializer.FIELD_ID).toString();
|
||||
long timeStamp = (Long) object.get(BaseRaceCommitteeEventSerializer.FIELD_TIMESTAMP);
|
||||
int passId = (Integer) object.get(BaseRaceCommitteeEventSerializer.FIELD_PASS_ID);
|
||||
String id = object.get(BaseRaceLogEventSerializer.FIELD_ID).toString();
|
||||
long timeStamp = (Long) object.get(BaseRaceLogEventSerializer.FIELD_TIMESTAMP);
|
||||
int passId = (Integer) object.get(BaseRaceLogEventSerializer.FIELD_PASS_ID);
|
||||
|
||||
return deserialize(object, Helpers.tryUuidConversion(id), new MillisecondsTimePoint(timeStamp), passId);
|
||||
}
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
package com.sap.sailing.server.gateway.deserialization.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEvent;
|
||||
import com.sap.sailing.domain.racecommittee.impl.RaceCommitteeCourseAreaChangeEventImpl;
|
||||
import com.sap.sailing.server.gateway.deserialization.JsonDeserializationException;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.RaceCommitteeCourseAreaChangedEventSerializer;
|
||||
|
||||
public class RaceCommitteeCourseAreaChangedEventDeserializer extends
|
||||
BaseRaceCommitteeEventDeserializer {
|
||||
|
||||
@Override
|
||||
protected RaceCommitteeEvent deserialize(JSONObject object, Serializable id,
|
||||
TimePoint timePoint, int passId) throws JsonDeserializationException {
|
||||
|
||||
String courseAreaId = object.get(RaceCommitteeCourseAreaChangedEventSerializer.FIELD_COURSE_AREA_ID).toString();
|
||||
UUID courseAreaUuid = null;
|
||||
try {
|
||||
courseAreaUuid = UUID.fromString(courseAreaId);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
throw new JsonDeserializationException(
|
||||
String.format("Field %s with %s couldn't be parsed as UUID.", RaceCommitteeCourseAreaChangedEventSerializer.FIELD_COURSE_AREA_ID, id),
|
||||
iae);
|
||||
}
|
||||
|
||||
return new RaceCommitteeCourseAreaChangeEventImpl(timePoint, id, Collections.<Competitor>emptyList(), passId, courseAreaUuid);
|
||||
}
|
||||
|
||||
}
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
package com.sap.sailing.server.gateway.deserialization.impl;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEvent;
|
||||
import com.sap.sailing.server.gateway.deserialization.JsonDeserializationException;
|
||||
import com.sap.sailing.server.gateway.deserialization.JsonDeserializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.BaseRaceCommitteeEventSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.RaceCommitteeFlagEventSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.RaceCommitteeStartTimeEventSerializer;
|
||||
|
||||
public class RaceCommitteeEventDeserializer implements JsonDeserializer<RaceCommitteeEvent> {
|
||||
|
||||
protected JsonDeserializer<RaceCommitteeEvent> flagEventDeserializer;
|
||||
protected JsonDeserializer<RaceCommitteeEvent> startTimeEventDeserializer;
|
||||
|
||||
public RaceCommitteeEventDeserializer() {
|
||||
flagEventDeserializer = new RaceCommitteeFlagEventDeserializer();
|
||||
startTimeEventDeserializer = new RaceCommitteeStartTimeEventDeserializer();
|
||||
}
|
||||
|
||||
protected JsonDeserializer<RaceCommitteeEvent> getDeserializer(
|
||||
JSONObject object) throws JsonDeserializationException {
|
||||
Object type = object.get(BaseRaceCommitteeEventSerializer.FIELD_CLASS);
|
||||
|
||||
if (type.equals(RaceCommitteeFlagEventSerializer.VALUE_CLASS)) {
|
||||
return flagEventDeserializer;
|
||||
} else if (type.equals(RaceCommitteeStartTimeEventSerializer.VALUE_CLASS)) {
|
||||
return startTimeEventDeserializer;
|
||||
}
|
||||
|
||||
throw new JsonDeserializationException(String.format(
|
||||
"There is no deserializer defined for event type %s.", type));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RaceCommitteeEvent deserialize(JSONObject object)
|
||||
throws JsonDeserializationException {
|
||||
return getDeserializer(object).deserialize(object);
|
||||
}
|
||||
}
|
||||
-34
@@ -1,34 +0,0 @@
|
||||
package com.sap.sailing.server.gateway.deserialization.impl;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.common.TimePoint;
|
||||
import com.sap.sailing.domain.racecommittee.Flags;
|
||||
import com.sap.sailing.domain.racecommittee.RaceCommitteeEvent;
|
||||
import com.sap.sailing.domain.racecommittee.impl.RaceCommitteeFlagEventImpl;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.RaceCommitteeFlagEventSerializer;
|
||||
|
||||
public class RaceCommitteeFlagEventDeserializer extends
|
||||
BaseRaceCommitteeEventDeserializer {
|
||||
|
||||
@Override
|
||||
protected RaceCommitteeEvent deserialize(JSONObject object, Serializable id,
|
||||
TimePoint timePoint, int passId) {
|
||||
|
||||
Flags upperFlag = Flags.valueOf(object.get(
|
||||
RaceCommitteeFlagEventSerializer.FIELD_UPPER_FLAG).toString());
|
||||
Flags lowerFlag = Flags.valueOf(object.get(
|
||||
RaceCommitteeFlagEventSerializer.FIELD_LOWER_FLAG).toString());
|
||||
boolean isDisplayed = (Boolean) object
|
||||
.get(RaceCommitteeFlagEventSerializer.FIELD_DISPLAYED);
|
||||
|
||||
return new RaceCommitteeFlagEventImpl(timePoint, id,
|
||||
Collections.<Competitor>emptyList(), passId, upperFlag,
|
||||
lowerFlag, isDisplayed);
|
||||
}
|
||||
|
||||
}
|
||||
Loaded 100 of 126 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user