From a318945be78aecf43853bbe16d78e30b6c46c0bf Mon Sep 17 00:00:00 2001 From: D049941 Date: Sun, 22 Dec 2013 20:24:12 +0100 Subject: [PATCH] Method clearState implemented and launch-configurations added, which use the database for tests (winddbTest). The launch-configurations also include the gateway bundle for the test support and have to be used for the local execution of UI-tests. --- ...ailingServer (No Proxy, winddbTest).launch | 36 +++++++++++++++++++ .../SailingServer (Proxy, winddbTest).launch | 31 ++++++++++++++++ .../server/impl/RacingEventServiceImpl.java | 34 +++++++++++++++--- 3 files changed, 97 insertions(+), 4 deletions(-) create mode 100644 java/com.sap.sailing.server/SailingServer (No Proxy, winddbTest).launch create mode 100644 java/com.sap.sailing.server/SailingServer (Proxy, winddbTest).launch diff --git a/java/com.sap.sailing.server/SailingServer (No Proxy, winddbTest).launch b/java/com.sap.sailing.server/SailingServer (No Proxy, winddbTest).launch new file mode 100644 index 00000000000..8d403b8ce00 --- /dev/null +++ b/java/com.sap.sailing.server/SailingServer (No Proxy, winddbTest).launch @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/com.sap.sailing.server/SailingServer (Proxy, winddbTest).launch b/java/com.sap.sailing.server/SailingServer (Proxy, winddbTest).launch new file mode 100644 index 00000000000..90f315132bb --- /dev/null +++ b/java/com.sap.sailing.server/SailingServer (Proxy, winddbTest).launch @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/com.sap.sailing.server/src/com/sap/sailing/server/impl/RacingEventServiceImpl.java b/java/com.sap.sailing.server/src/com/sap/sailing/server/impl/RacingEventServiceImpl.java index 4b10b9946f1..f218166998c 100755 --- a/java/com.sap.sailing.server/src/com/sap/sailing/server/impl/RacingEventServiceImpl.java +++ b/java/com.sap.sailing.server/src/com/sap/sailing/server/impl/RacingEventServiceImpl.java @@ -283,6 +283,10 @@ public class RacingEventServiceImpl implements RacingEventServiceWithTestSupport this.baseDomainFactory = baseDomainFactory; this.domainObjectFactory = domainObjectFactory; this.mongoObjectFactory = mongoObjectFactory; + this.mediaDB = mediaDb; + this.competitorStore = competitorStore; + this.windStore = windStore; + regattasByName = new ConcurrentHashMap(); eventsById = new ConcurrentHashMap(); regattaTrackingCache = new ConcurrentHashMap(); @@ -295,7 +299,6 @@ public class RacingEventServiceImpl implements RacingEventServiceWithTestSupport persistentRegattasForRaceIDs = new ConcurrentHashMap(); this.raceLogReplicator = new RaceLogReplicator(this); this.raceLogScoringReplicator = new RaceLogScoringReplicator(this); - this.mediaDB = mediaDb; this.mediaLibrary = new MediaLibrary(); if (windStore == null) { try { @@ -304,14 +307,12 @@ public class RacingEventServiceImpl implements RacingEventServiceWithTestSupport throw new RuntimeException(e); } } - this.windStore = windStore; this.configurationMap = new DeviceConfigurationMapImpl(); // Add one default leaderboard that aggregates all races currently tracked by this service. // This is more for debugging purposes than for anything else. addFlexibleLeaderboard(LeaderboardNameConstants.DEFAULT_LEADERBOARD_NAME, null, new int[] { 5, 8 }, getBaseDomainFactory().createScoringScheme(ScoringSchemeType.LOW_POINT), null); - this.competitorStore = competitorStore; loadStoredEvents(); loadStoredRegattas(); loadRaceIDToRegattaAssociations(); @@ -322,8 +323,33 @@ public class RacingEventServiceImpl implements RacingEventServiceWithTestSupport @Override public void clearState() throws Exception { - // TODO [D049941]: Auto-generated method stub + for(String leaderboardGroupName : this.leaderboardGroupsByName.keySet()) { + removeLeaderboardGroup(leaderboardGroupName); + } + for(String leaderboardName : this.leaderboardsByName.keySet()) { + removeLeaderboard(leaderboardName); + } + + for(Regatta regatta : this.regattasByName.values()) { + stopTracking(regatta); + removeRegatta(regatta); + } + + for(Event event : this.eventsById.values()) { + removeEvent(event.getId()); + } + + for(MediaTrack mediaTrack : this.mediaLibrary.allTracks()) { + mediaTrackDeleted(mediaTrack); + } + + this.competitorStore.clear(); + + // Add one default leaderboard that aggregates all races currently tracked by this service. + // This is more for debugging purposes than for anything else. + addFlexibleLeaderboard(LeaderboardNameConstants.DEFAULT_LEADERBOARD_NAME, null, new int[] { 5, 8 }, + getBaseDomainFactory().createScoringScheme(ScoringSchemeType.LOW_POINT), null); } @Override