mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-06 20:33:54 +00:00
added a main routine that allows us to download and store to file a specific combination of event/race
This commit is contained in:
1 parent
36613799b6
commit
126beecff2
6 files changed
+30
-19
No files matched your search
-2
@@ -1,6 +1,5 @@
|
||||
package com.sap.sailing.domain.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
@@ -64,7 +63,6 @@ public abstract class AbstractTracTracLiveTest extends StoredTrackBasedTest impl
|
||||
// Read event data from configuration file
|
||||
event = KeyValue.setup(paramUrl);
|
||||
assertNotNull(event);
|
||||
assertEquals(getExpectedEventName(), event.getName());
|
||||
// Initialize data controller using live and stored data sources
|
||||
controller = new DataController(liveUri, storedUri, this);
|
||||
// Start live and stored data streams
|
||||
|
||||
+13
-6
@@ -50,8 +50,8 @@ public class FetchTracksAndStoreLocallyTest extends KielWeek2011BasedTest {
|
||||
* into {@link #firstTracked} and {@link #firstData}. All events are converted into {@link GPSFixMovingImpl}
|
||||
* objects and appended to the {@link DynamicTrackedRace}s.
|
||||
*/
|
||||
private void setUp(String raceId) throws MalformedURLException, IOException, InterruptedException, URISyntaxException {
|
||||
super.setUpWithoutLaunchingController(raceId);
|
||||
private void setUp(String eventName, String raceId) throws MalformedURLException, IOException, InterruptedException, URISyntaxException {
|
||||
super.setUpWithoutLaunchingController(eventName, raceId);
|
||||
final RaceChangeListener<Competitor> positionListener = new RaceChangeListener<Competitor>() {
|
||||
@Override
|
||||
public void gpsFixReceived(GPSFix fix, Competitor competitor) {
|
||||
@@ -150,21 +150,28 @@ public class FetchTracksAndStoreLocallyTest extends KielWeek2011BasedTest {
|
||||
"bc78290c-9f55-11e0-85be-406186cbf87c", "d62d4288-9f55-11e0-85be-406186cbf87c",
|
||||
"972c4d74-9f53-11e0-85be-406186cbf87c", "c3ab8bcc-a17d-11e0-aeec-406186cbf87c" }) {
|
||||
System.out.println("Loading and storing race "+raceId);
|
||||
storeRace(raceId);
|
||||
storeRace("event_20110609_KielerWoch", raceId);
|
||||
}
|
||||
}
|
||||
|
||||
@Ignore
|
||||
public void store505Race2() throws InterruptedException, FileNotFoundException, IOException, URISyntaxException {
|
||||
storeRace("357c700a-9d9a-11e0-85be-406186cbf87c");
|
||||
storeRace("event_20110609_KielerWoch", "357c700a-9d9a-11e0-85be-406186cbf87c");
|
||||
}
|
||||
|
||||
private void storeRace(String raceId) throws MalformedURLException, IOException, InterruptedException,
|
||||
private void storeRace(String eventName, String raceId) throws MalformedURLException, IOException, InterruptedException,
|
||||
URISyntaxException, FileNotFoundException {
|
||||
setUp(raceId);
|
||||
setUp(eventName, raceId);
|
||||
storeTracks();
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws URISyntaxException, FileNotFoundException, IOException, InterruptedException {
|
||||
FetchTracksAndStoreLocallyTest thiz = new FetchTracksAndStoreLocallyTest();
|
||||
for (int i=1; i<args.length; i++) {
|
||||
thiz.storeRace(args[0], args[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void storeTracks() throws FileNotFoundException, IOException {
|
||||
for (Map.Entry<Competitor, DynamicTrack<Competitor, GPSFixMoving>> competitorAndTrack : tracks.entrySet()) {
|
||||
Competitor competitor = competitorAndTrack.getKey();
|
||||
|
||||
+12
-6
@@ -1,5 +1,6 @@
|
||||
package com.sap.sailing.domain.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
@@ -37,8 +38,8 @@ import com.tractrac.clientmodule.Race;
|
||||
|
||||
/**
|
||||
* Connects to the Kieler Woche 2011 TracTrac data of the 505 Race 2. Subclasses should implement a @Before method which
|
||||
* calls {@link #setUp(String, ReceiverType[])} with a useful set of receiver types and the race they want to observe /
|
||||
* load, or they should call {@link #setUp(String, ReceiverType[])} at the beginning of each respective test in case
|
||||
* calls {@link #setUp(String, String, ReceiverType[])} with a useful set of receiver types and the race they want to observe /
|
||||
* load, or they should call {@link #setUp(String, String, ReceiverType[])} at the beginning of each respective test in case
|
||||
* they want to select/load different races for different tests. When all stored data has been received, the
|
||||
* {@link #getSemaphor() semaphor} is notified. Therefore, a typical pattern for subclasses should be to invoke
|
||||
* {@link #setUp(ReceiverType[])}, then wait on the semaphor before starting with test processing.
|
||||
@@ -73,8 +74,10 @@ public abstract class KielWeek2011BasedTest extends AbstractTracTracLiveTest {
|
||||
// to select a race
|
||||
}
|
||||
|
||||
protected void setUp(String raceId, ReceiverType... receiverTypes) throws MalformedURLException, IOException, InterruptedException, URISyntaxException {
|
||||
setUpWithoutLaunchingController(raceId);
|
||||
protected void setUp(String eventName, String raceId, ReceiverType... receiverTypes) throws MalformedURLException,
|
||||
IOException, InterruptedException, URISyntaxException {
|
||||
setUpWithoutLaunchingController(eventName, raceId);
|
||||
assertEquals(getExpectedEventName(), getEvent().getName());
|
||||
completeSetupLaunchingControllerAndWaitForRaceDefinition(receiverTypes);
|
||||
}
|
||||
|
||||
@@ -111,11 +114,14 @@ public abstract class KielWeek2011BasedTest extends AbstractTracTracLiveTest {
|
||||
}
|
||||
|
||||
|
||||
protected void setUpWithoutLaunchingController(String raceId) throws FileNotFoundException, MalformedURLException,
|
||||
protected void setUpWithoutLaunchingController(String eventName, String raceId) throws FileNotFoundException, MalformedURLException,
|
||||
URISyntaxException {
|
||||
super.setUp(new URL("http://germanmaster.traclive.dk/events/event_20110609_KielerWoch/clientparams.php?event=event_20110609_KielerWoch&race="+raceId),
|
||||
super.setUp(new URL("http://germanmaster.traclive.dk/events/"+eventName+"/clientparams.php?event="+eventName+"&race="+raceId),
|
||||
tractracTunnel ? new URI("tcp://"+tractracTunnelHost+":4412") : new URI("tcp://germanmaster.traclive.dk:4400"),
|
||||
tractracTunnel ? new URI("tcp://"+tractracTunnelHost+":4413") : new URI("tcp://germanmaster.traclive.dk:4401"));
|
||||
if (domainFactory == null) {
|
||||
domainFactory = new DomainFactoryImpl();
|
||||
}
|
||||
domainEvent = domainFactory.getOrCreateEvent(getEvent());
|
||||
trackedEvent = domainFactory.getOrCreateTrackedEvent(domainEvent);
|
||||
}
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ public class LeaderboardForKielWeekTest extends KielWeek2011BasedTest {
|
||||
|
||||
private void loadRace(String raceId) throws MalformedURLException, IOException, InterruptedException,
|
||||
URISyntaxException {
|
||||
setUp(raceId, ReceiverType.RACECOURSE, ReceiverType.RACESTARTFINISH, ReceiverType.MARKPASSINGS);
|
||||
setUp("event_20110609_KielerWoch", raceId, ReceiverType.RACECOURSE, ReceiverType.RACESTARTFINISH, ReceiverType.MARKPASSINGS);
|
||||
getTrackedRace().setWindSource(WindSource.WEB);
|
||||
getTrackedRace().recordWind(new WindImpl(/* position */ null, MillisecondsTimePoint.now(),
|
||||
new KnotSpeedWithBearingImpl(12, new DegreeBearingImpl(70))), WindSource.WEB);
|
||||
|
||||
+2
-2
@@ -36,8 +36,8 @@ public class ManeuverDetectionOnKielerWoche505Race2DataTest extends KielWeek2011
|
||||
@Before
|
||||
public void setUp() throws MalformedURLException, IOException, InterruptedException, URISyntaxException {
|
||||
super.setUp();
|
||||
super.setUp(/* raceId */ "357c700a-9d9a-11e0-85be-406186cbf87c",
|
||||
new ReceiverType[] { ReceiverType.MARKPASSINGS, ReceiverType.RACECOURSE, ReceiverType.RAWPOSITIONS });
|
||||
super.setUp("event_20110609_KielerWoch",
|
||||
/* raceId */ "357c700a-9d9a-11e0-85be-406186cbf87c", new ReceiverType[] { ReceiverType.MARKPASSINGS, ReceiverType.RACECOURSE, ReceiverType.RAWPOSITIONS });
|
||||
KielWeek2011BasedTest.fixApproximateMarkPositionsForWindReadOut(getTrackedRace());
|
||||
getTrackedRace().setWindSource(WindSource.WEB);
|
||||
getTrackedRace().recordWind(new WindImpl(/* position */ null, MillisecondsTimePoint.now(),
|
||||
|
||||
+2
-2
@@ -30,8 +30,8 @@ public class WindEstimationOnKielerWoche505Race2DataTest extends KielWeek2011Bas
|
||||
@Before
|
||||
public void setUp() throws MalformedURLException, IOException, InterruptedException, URISyntaxException {
|
||||
super.setUp();
|
||||
super.setUp(/* raceId */ "357c700a-9d9a-11e0-85be-406186cbf87c",
|
||||
new ReceiverType[] { ReceiverType.MARKPASSINGS, ReceiverType.RACECOURSE, ReceiverType.RAWPOSITIONS });
|
||||
super.setUp("event_20110609_KielerWoch",
|
||||
/* raceId */ "357c700a-9d9a-11e0-85be-406186cbf87c", new ReceiverType[] { ReceiverType.MARKPASSINGS, ReceiverType.RACECOURSE, ReceiverType.RAWPOSITIONS });
|
||||
KielWeek2011BasedTest.fixApproximateMarkPositionsForWindReadOut(getTrackedRace());
|
||||
getTrackedRace().setWindSource(WindSource.WEB);
|
||||
getTrackedRace().recordWind(new WindImpl(/* position */ null, MillisecondsTimePoint.now(),
|
||||
|
||||
Reference in new issue
Block a user