mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-20 03:00:00 +00:00
added failing test case for bug 3347
This commit is contained in:
1 parent
7760dea4c2
commit
7d3a9d8f9f
2 files changed
+39
-1
No files matched your search
+37
@@ -0,0 +1,37 @@
|
||||
package com.sap.sailinig.domain.based.impl;
|
||||
|
||||
import static org.junit.Assert.assertSame;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.domain.base.BoatClass;
|
||||
import com.sap.sailing.domain.base.SharedDomainFactory;
|
||||
import com.sap.sailing.domain.base.impl.SharedDomainFactoryImpl;
|
||||
import com.sap.sailing.domain.common.BoatClassMasterdata;
|
||||
|
||||
/**
|
||||
* Tests creation and caching of boat classes. See also bug 3347
|
||||
* (http://bugzilla.sapsailing.com/bugzilla/show_bug.cgi?id=3347).
|
||||
*
|
||||
* @author Axel Uhl (d043530)
|
||||
*
|
||||
*/
|
||||
public class BoatClassCacheTest {
|
||||
private SharedDomainFactory sharedDomainFactory;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
sharedDomainFactory = new SharedDomainFactoryImpl(/* raceLogResolver */ null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQueryingBoatClassByAlternativeNameFirstThenCanonicalizedAlternativeName() {
|
||||
final BoatClassMasterdata laserMasterData = BoatClassMasterdata.LASER_INT;
|
||||
final String laserAlternativeName = laserMasterData.getAlternativeNames()[0];
|
||||
final String unifiedAlternativeName = BoatClassMasterdata.unifyBoatClassName(laserAlternativeName);
|
||||
final BoatClass laserByDisplayName = sharedDomainFactory.getOrCreateBoatClass(laserMasterData.getDisplayName());
|
||||
final BoatClass laserByUnifiedAlternativeName = sharedDomainFactory.getOrCreateBoatClass(unifiedAlternativeName);
|
||||
assertSame(laserByDisplayName, laserByUnifiedAlternativeName);
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -111,7 +111,6 @@ public class SharedDomainFactoryImpl implements SharedDomainFactory {
|
||||
|
||||
/**
|
||||
* Uses a transient competitor store
|
||||
* @param raceLogResolver TODO
|
||||
*/
|
||||
public SharedDomainFactoryImpl(RaceLogResolver raceLogResolver) {
|
||||
this(new TransientCompetitorStoreImpl(), raceLogResolver);
|
||||
@@ -128,6 +127,7 @@ public class SharedDomainFactoryImpl implements SharedDomainFactory {
|
||||
boatClassCache = new HashMap<String, BoatClass>();
|
||||
this.competitorStore = competitorStore;
|
||||
waypointCache = new ConcurrentHashMap<Serializable, WeakWaypointReference>();
|
||||
// FIXME ass also bug 3347: mapping to lower case should rather work through a common unification / canonicalization of boat class names
|
||||
mayStartWithNoUpwindLeg = new HashSet<String>(Arrays.asList(new String[] { "extreme40", "ess", "ess40" }));
|
||||
courseAreaCache = new HashMap<Serializable, CourseArea>();
|
||||
configurationMatcherCache = new HashMap<Serializable, DeviceConfigurationMatcher>();
|
||||
@@ -310,6 +310,7 @@ public class SharedDomainFactoryImpl implements SharedDomainFactory {
|
||||
|
||||
@Override
|
||||
public BoatClass getOrCreateBoatClass(String name) {
|
||||
// FIXME ass also bug 3347: mapping to lower case should rather work through a common unification / canonicalization of boat class names
|
||||
return getOrCreateBoatClass(name, name == null || /* typicallyStartsUpwind */!mayStartWithNoUpwindLeg.contains(name.toLowerCase()));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user