mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-04 11:23:50 +00:00
same Mongo connection pattern also for WindTracks tests
This commit is contained in:
1 parent
d77d6ced2c
commit
49073eb0ea
2 files changed
+9
-5
No files matched your search
+2
-3
@@ -95,11 +95,10 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LinkedHashMap<Leg, TrackedLeg> trackedLegsMap = new LinkedHashMap<Leg, TrackedLeg>();
|
trackedLegs = new LinkedHashMap<Leg, TrackedLeg>();
|
||||||
for (Leg leg : race.getCourse().getLegs()) {
|
for (Leg leg : race.getCourse().getLegs()) {
|
||||||
trackedLegsMap.put(leg, createTrackedLeg(race, leg));
|
trackedLegs.put(leg, createTrackedLeg(race, leg));
|
||||||
}
|
}
|
||||||
trackedLegs = trackedLegsMap;
|
|
||||||
markPassingsForCompetitor = new HashMap<Competitor, NavigableSet<MarkPassing>>();
|
markPassingsForCompetitor = new HashMap<Competitor, NavigableSet<MarkPassing>>();
|
||||||
tracks = new HashMap<Competitor, GPSFixTrack<Competitor, GPSFixMoving>>();
|
tracks = new HashMap<Competitor, GPSFixTrack<Competitor, GPSFixMoving>>();
|
||||||
for (Competitor competitor : race.getCompetitors()) {
|
for (Competitor competitor : race.getCompetitors()) {
|
||||||
|
|||||||
+7
-2
@@ -34,6 +34,7 @@ import com.sap.sailing.domain.tractracadapter.Receiver;
|
|||||||
import com.sap.sailing.domain.tractracadapter.ReceiverType;
|
import com.sap.sailing.domain.tractracadapter.ReceiverType;
|
||||||
import com.sap.sailing.mongodb.DomainObjectFactory;
|
import com.sap.sailing.mongodb.DomainObjectFactory;
|
||||||
import com.sap.sailing.mongodb.MongoObjectFactory;
|
import com.sap.sailing.mongodb.MongoObjectFactory;
|
||||||
|
import com.sap.sailing.mongodb.impl.MongoWindStoreFactoryImpl;
|
||||||
|
|
||||||
public class TestStoringAndRetrievingWindTracks extends AbstractTracTracLiveTest implements MongoDBTest {
|
public class TestStoringAndRetrievingWindTracks extends AbstractTracTracLiveTest implements MongoDBTest {
|
||||||
|
|
||||||
@@ -44,9 +45,13 @@ public class TestStoringAndRetrievingWindTracks extends AbstractTracTracLiveTest
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Mongo newMongo() throws UnknownHostException, MongoException {
|
||||||
|
return new Mongo("127.0.0.1", ((MongoWindStoreFactoryImpl) MongoWindStoreFactoryImpl.getDefaultInstance()).getDefaultPort());
|
||||||
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void dropTestDB() throws UnknownHostException, MongoException {
|
public void dropTestDB() throws UnknownHostException, MongoException {
|
||||||
mongo = new Mongo();
|
mongo = newMongo();
|
||||||
assertNotNull(mongo);
|
assertNotNull(mongo);
|
||||||
mongo.dropDatabase(WIND_TEST_DB);
|
mongo.dropDatabase(WIND_TEST_DB);
|
||||||
db = mongo.getDB(WIND_TEST_DB);
|
db = mongo.getDB(WIND_TEST_DB);
|
||||||
@@ -75,7 +80,7 @@ public class TestStoringAndRetrievingWindTracks extends AbstractTracTracLiveTest
|
|||||||
}
|
}
|
||||||
Thread.sleep(1000); // give MongoDB some time to make written data available to other connections
|
Thread.sleep(1000); // give MongoDB some time to make written data available to other connections
|
||||||
|
|
||||||
Mongo myMongo = new Mongo();
|
Mongo myMongo = newMongo();
|
||||||
DB database = myMongo.getDB(WIND_TEST_DB);
|
DB database = myMongo.getDB(WIND_TEST_DB);
|
||||||
WindTrack result = DomainObjectFactory.INSTANCE.loadWindTrack(domainEvent, race, windSource, /* millisecondsOverWhichToAverage */
|
WindTrack result = DomainObjectFactory.INSTANCE.loadWindTrack(domainEvent, race, windSource, /* millisecondsOverWhichToAverage */
|
||||||
30000, database);
|
30000, database);
|
||||||
|
|||||||
Reference in new issue
Block a user