Bug 4158: Implemented clearing of RaceLogs and RegattaLogs on clearState

This commit is contained in:
Steffen Schaefer committed 2017-05-31 10:15:26 +02:00
1 parent 69efe204d1
commit a499f075f1
10 files changed
+50

No files matched your search

@@ -144,8 +144,12 @@ public interface MongoObjectFactory {
void removeRaceLog(RaceLogIdentifier identifier);
void removeAllRaceLogs();
void removeRegattaLog(RegattaLikeIdentifier identifier);
void removeAllRegattaLogs();
void storeResultUrl(String resultProviderName, URL url);
void removeResultUrl(String resultProviderName, URL url);
@@ -1356,6 +1356,11 @@ public class MongoObjectFactoryImpl implements MongoObjectFactory {
getRaceLogCollection().remove(query);
}
@Override
public void removeAllRaceLogs() {
getRaceLogCollection().drop();;
}
@Override
public void removeRegattaLog(RegattaLikeIdentifier identifier) {
DBObject query = new BasicDBObject();
@@ -1363,6 +1368,11 @@ public class MongoObjectFactoryImpl implements MongoObjectFactory {
getRegattaLogCollection().remove(query);
}
@Override
public void removeAllRegattaLogs() {
getRegattaLogCollection().drop();
}
@Override
public void storeResultUrl(String resultProviderName, URL url) {
DBCollection resultUrlsCollection = database.getCollection(CollectionNames.RESULT_URLS.name());
@@ -67,4 +67,10 @@ public class MongoRaceLogStoreImpl implements RaceLogStore {
raceLogCache.put(identifier, raceLog);
}
@Override
public void clear() {
mongoObjectFactory.removeAllRaceLogs();
raceLogCache.clear();
}
}
@@ -49,4 +49,10 @@ public class MongoRegattaLogStoreImpl implements RegattaLogStore {
addListener(identifier, regattaLog);
regattaLogCache.put(identifier, regattaLog);
}
@Override
public void clear() {
mongoObjectFactory.removeAllRegattaLogs();
regattaLogCache.clear();
}
}
@@ -43,6 +43,10 @@ public class RegattaLogAttachOnTrackedRaceTest {
@Override
public void addImportedRegattaLog(RegattaLog regattaLog, RegattaLikeIdentifier identifier) {
}
@Override
public void clear() {
}
}
private class MyMockedTrackedRace extends MockedTrackedRace {
@@ -20,4 +20,9 @@ public interface RaceLogStore {
*/
void addImportedRaceLog(RaceLog raceLog, RaceLogIdentifier identifier);
/**
* For Testing purposes only! Deletes all stored RaceLogs.
*/
void clear();
}
@@ -27,4 +27,8 @@ public enum EmptyRaceLogStore implements RaceLogStore {
@Override
public void addImportedRaceLog(RaceLog raceLog, RaceLogIdentifier identifier) {
}
@Override
public void clear() {
}
}
@@ -17,4 +17,9 @@ public interface RegattaLogStore {
* Adds the mongo listener to the regatta log and adds regatta log to cache.
*/
void addImportedRegattaLog(RegattaLog regattaLog, RegattaLikeIdentifier identifier);
/**
* For Testing purposes only! Deletes all stored RegattaLogs.
*/
void clear();
}
@@ -22,4 +22,8 @@ public enum EmptyRegattaLogStore implements RegattaLogStore {
@Override
public void addImportedRegattaLog(RegattaLog regattaLog, RegattaLikeIdentifier identifier) {
}
@Override
public void clear() {
}
}
@@ -733,6 +733,8 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
// TODO clear user store? See bug 2430.
this.competitorStore.clear();
this.windStore.clear();
getRaceLogStore().clear();
getRegattaLogStore().clear();
}
@Override