fixed leaderboard MongoDB test which was using the wrong fleet for a lookup in the loaded results

This commit is contained in:
Axel Uhl committed 2012-05-21 16:58:49 +02:00
1 parent af7e3bae9e
commit fe061a04cd
4 files changed
+72 -5

No files matched your search

@@ -1,5 +1,28 @@
package com.sap.sailing.domain.persistence.impl;
/**
* Defines literals providing the names for MongoDB collections. The literal documentation described the semantics
* of the collection identified by that literal.
*
* @author Axel Uhl (D043530)
*
*/
public enum CollectionNames {
WIND_TRACKS, LEADERBOARDS, LEADERBOARD_GROUPS;
/**
* Stores the wind fixes recorded from persistent wind sources.
*/
WIND_TRACKS,
/**
* The collection identified by this
*/
LEADERBOARDS,
LEADERBOARD_GROUPS,
EVENTS,
REGATTAS,
BOAT_CLASSES;
}
@@ -4,7 +4,7 @@ import com.sap.sailing.domain.common.Named;
/**
* An event is a group of {@link Regatta regattas} carried out at a common venue within a common time frame. For
* example, Kiel Week is an event, and the International German Championship held, e.g., in Travemünde, is an event,
* example, Kiel Week 2011 is an event, and the International German Championship 2011 held, e.g., in Travemünde, is an event,
* too.
*
* @author Axel Uhl (D043530)
@@ -12,4 +12,8 @@ import com.sap.sailing.domain.common.Named;
*/
public interface Event extends Named {
Iterable<Regatta> getRegattas();
void addRegatta(Regatta regatta);
void removeRegatta(Regatta regatta);
}
@@ -0,0 +1,36 @@
package com.sap.sailing.domain.base.impl;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import com.sap.sailing.domain.base.Event;
import com.sap.sailing.domain.base.Regatta;
import com.sap.sailing.domain.common.impl.NamedImpl;
public class EventImpl extends NamedImpl implements Event {
private static final long serialVersionUID = 855135446595485715L;
private final Set<Regatta> regattas;
public EventImpl(String name) {
super(name);
this.regattas = new HashSet<Regatta>();
}
@Override
public Iterable<Regatta> getRegattas() {
return Collections.unmodifiableSet(regattas);
}
@Override
public void addRegatta(Regatta regatta) {
regattas.add(regatta);
}
@Override
public void removeRegatta(Regatta regatta) {
regattas.remove(regatta);
}
}
@@ -158,11 +158,15 @@ public class TestStoringAndRetrievingLeaderboardGroups extends AbstractMongoDBTe
//Check if the leaderboard updated correctly
final Leaderboard loadedLeaderboard = domainObjectFactory.loadLeaderboard(leaderboard.getName());
Assert.assertEquals(race.getRaceIdentifier(fleet), loadedLeaderboard.getRaceColumnByName(columnName).getRaceIdentifier(fleet));
final RaceColumn loadedRaceColumnByName = loadedLeaderboard.getRaceColumnByName(columnName);
Fleet loadedFleet = loadedRaceColumnByName.getFleetByName(fleet.getName());
Assert.assertEquals(race.getRaceIdentifier(fleet), loadedRaceColumnByName.getRaceIdentifier(loadedFleet));
//Check if the group received the changes
// Check if the group received the changes
loadedGroup = domainObjectFactory.loadLeaderboardGroup(groupName);
RaceIdentifier loadedIdentifier = loadedGroup.getLeaderboards().iterator().next().getRaceColumnByName(columnName).getRaceIdentifier(fleet);
final RaceColumn loadedRaceColumnFromGroupByName = loadedGroup.getLeaderboards().iterator().next().getRaceColumnByName(columnName);
Fleet loadedGroupFleet = loadedRaceColumnFromGroupByName.getFleetByName(fleet.getName());
RaceIdentifier loadedIdentifier = loadedRaceColumnFromGroupByName.getRaceIdentifier(loadedGroupFleet);
Assert.assertEquals(race.getRaceIdentifier(fleet), loadedIdentifier);
}