mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-17 01:31:01 +00:00
encapsulate getRaceHandle(); reformat some files to default-formatter;
This commit is contained in:
1 parent
fb3b69a4dd
commit
263bd46825
11 files changed
+332
-312
No files matched your search
+5
-5
@@ -4,7 +4,7 @@ import junit.framework.Assert;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.simulator.impl.SerializationUtils;
|
||||
import com.sap.sailing.simulator.impl.SimulatorUtils;
|
||||
|
||||
public class SerializationUtilsTest {
|
||||
|
||||
@@ -13,19 +13,19 @@ public class SerializationUtilsTest {
|
||||
|
||||
Assert.assertEquals(
|
||||
"d1f521fa-ec52-11e0-a523-406186cbf87c",
|
||||
SerializationUtils
|
||||
SimulatorUtils
|
||||
.getRaceID("http://germanmaster.traclive.dk/events/event_20110929_Internatio/clientparams.php?event=event_20110929_Internatio&race=d1f521fa-ec52-11e0-a523-406186cbf87c"));
|
||||
Assert.assertEquals(
|
||||
"eb06795a-ec52-11e0-a523-406186cbf87c",
|
||||
SerializationUtils
|
||||
SimulatorUtils
|
||||
.getRaceID("http://germanmaster.traclive.dk/events/event_20110929_Internatio/clientparams.php?event=event_20110929_Internatio&race=eb06795a-ec52-11e0-a523-406186cbf87c"));
|
||||
Assert.assertEquals(
|
||||
"6bb0829e-ec44-11e0-a523-406186cbf87c",
|
||||
SerializationUtils
|
||||
SimulatorUtils
|
||||
.getRaceID("http://germanmaster.traclive.dk/events/event_20110929_Internatio/clientparams.php?event=event_20110929_Internatio&race=6bb0829e-ec44-11e0-a523-406186cbf87c"));
|
||||
Assert.assertEquals(
|
||||
"0b5969cc-b789-11e1-a845-406186cbf87c",
|
||||
SerializationUtils
|
||||
SimulatorUtils
|
||||
.getRaceID("http://germanmaster.traclive.dk/events/event_20120615_KielerWoch/clientparams.php?event=event_20120615_KielerWoch&race=0b5969cc-b789-11e1-a845-406186cbf87c"));
|
||||
|
||||
}
|
||||
|
||||
+27
-25
@@ -13,29 +13,31 @@ import com.sap.sailing.simulator.test.util.TracTracReaderFromFiles;
|
||||
|
||||
public class TestTracTracReader {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
File dir = new File("C:\\Users\\i059829\\workspace\\sapsailingcapture\\java\\com.sap.sailing.simulator.test");
|
||||
String[] flist = dir.list(new FilenameFilter() {
|
||||
public boolean accept(File dir, String filename)
|
||||
{ return filename.endsWith(".data"); }} );
|
||||
|
||||
//System.out.println(flist[1]);
|
||||
TracTracReader ttreader = new TracTracReaderFromFiles(flist);
|
||||
|
||||
List<TrackedRace> lst = ttreader.read();
|
||||
|
||||
for( TrackedRace r : lst ) {
|
||||
RegattaAndRaceIdentifier id = r.getRaceIdentifier();
|
||||
System.out.println(id.getRegattaName() + " / " + id.getRaceName());
|
||||
for(Competitor c : r.getRace().getCompetitors()) {
|
||||
r.getTrack(c).lockForRead();
|
||||
for( GPSFixMoving gpsFix : r.getTrack(c).getFixes() ) {
|
||||
System.out.println(gpsFix.getTimePoint().asMillis());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
File dir = new File("C:\\Users\\i059829\\workspace\\sapsailingcapture\\java\\com.sap.sailing.simulator.test");
|
||||
String[] flist = dir.list(new FilenameFilter() {
|
||||
public boolean accept(File dir, String filename) {
|
||||
return filename.endsWith(".data");
|
||||
}
|
||||
});
|
||||
|
||||
// System.out.println(flist[1]);
|
||||
TracTracReader ttreader = new TracTracReaderFromFiles(flist);
|
||||
|
||||
List<TrackedRace> lst = ttreader.read();
|
||||
|
||||
for (TrackedRace r : lst) {
|
||||
RegattaAndRaceIdentifier id = r.getRaceIdentifier();
|
||||
System.out.println(id.getRegattaName() + " / " + id.getRaceName());
|
||||
for (Competitor c : r.getRace().getCompetitors()) {
|
||||
r.getTrack(c).lockForRead();
|
||||
for (GPSFixMoving gpsFix : r.getTrack(c).getFixes()) {
|
||||
System.out.println(gpsFix.getTimePoint().asMillis());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+9
-12
@@ -3,16 +3,13 @@ package com.sap.sailing.simulator.test;
|
||||
import com.sap.sailing.simulator.test.util.TracTracWriter;
|
||||
|
||||
public class TestTracTracWriter {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
String[] sources = {
|
||||
"http://germanmaster.traclive.dk/events/event_20110929_Internatio/clientparams.php?event=event_20110929_Internatio&race=5b7a34f6-ec44-11e0-a523-406186cbf87c",
|
||||
|
||||
};
|
||||
TracTracWriter ttWriter = new TracTracWriter(sources);
|
||||
ttWriter.write();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
String[] sources = { "http://germanmaster.traclive.dk/events/event_20110929_Internatio/clientparams.php?event=event_20110929_Internatio&race=5b7a34f6-ec44-11e0-a523-406186cbf87c", };
|
||||
TracTracWriter ttWriter = new TracTracWriter(sources);
|
||||
ttWriter.write();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+54
-64
@@ -15,83 +15,73 @@ import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.RaceDefinition;
|
||||
import com.sap.sailing.domain.common.RaceIdentifier;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.RegattaNameAndRaceName;
|
||||
import com.sap.sailing.domain.tracking.GPSFixMoving;
|
||||
import com.sap.sailing.domain.tracking.GPSFixTrack;
|
||||
import com.sap.sailing.domain.tracking.RacesHandle;
|
||||
import com.sap.sailing.domain.tracking.TrackedRace;
|
||||
import com.sap.sailing.domain.tracking.impl.EmptyWindStore;
|
||||
import com.sap.sailing.server.impl.RacingEventServiceImpl;
|
||||
import com.sap.sailing.simulator.impl.SimulatorUtils;
|
||||
|
||||
@SuppressWarnings("restriction")
|
||||
public class TestRacingEventPersistence {
|
||||
|
||||
RacingEventServiceImpl service;
|
||||
private RacesHandle raceHandle;
|
||||
String paramURLStr = "http://germanmaster.traclive.dk/events/event_20110929_Internatio/clientparams.php?event=event_20110929_Internatio&race=d1f521fa-ec52-11e0-a523-406186cbf87c";
|
||||
//proxy
|
||||
String liveURIStr = "tcp://10.18.22.156:1520";
|
||||
String storedURIStr = "tcp://10.18.22.156:1521";
|
||||
//non-proxy
|
||||
//String liveURIStr = "tcp://germanmaster.traclive.dk:4400";
|
||||
//String storedURIStr = "tcp://germanmaster.traclive.dk:4401";
|
||||
|
||||
//@Before
|
||||
//public void setUp() throws Exception {
|
||||
//service = new RacingEventServiceImpl();
|
||||
//}
|
||||
RacingEventServiceImpl service;
|
||||
private RacesHandle raceHandle;
|
||||
String paramURLStr = "http://germanmaster.traclive.dk/events/event_20110929_Internatio/clientparams.php?event=event_20110929_Internatio&race=d1f521fa-ec52-11e0-a523-406186cbf87c";
|
||||
// proxy
|
||||
String liveURIStr = "tcp://10.18.22.156:1520";
|
||||
String storedURIStr = "tcp://10.18.22.156:1521";
|
||||
|
||||
// non-proxy
|
||||
// String liveURIStr = "tcp://germanmaster.traclive.dk:4400";
|
||||
// String storedURIStr = "tcp://germanmaster.traclive.dk:4401";
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
|
||||
@Test
|
||||
public void test() throws Exception {
|
||||
|
||||
System.setProperty("mongo.port", "10200");
|
||||
System.setProperty("http.proxyHost", "proxy.wdf.sap.corp");
|
||||
System.setProperty("http.proxyPort", "8080");
|
||||
|
||||
service = new RacingEventServiceImpl();
|
||||
URL paramURL = new URL(paramURLStr);
|
||||
URI liveURI = new URI(liveURIStr);
|
||||
URI storedURI = new URI(storedURIStr);
|
||||
|
||||
//TODO: Fix raceHandle
|
||||
/*
|
||||
raceHandle = service.addTracTracRace(paramURL, liveURI, storedURI, EmptyWindStore.INSTANCE, 60000, this);
|
||||
|
||||
synchronized (this) {
|
||||
this.wait();
|
||||
|
||||
}*/
|
||||
|
||||
System.out.println("Done synchronizing");
|
||||
|
||||
String regatta = raceHandle.getRegatta().getName();
|
||||
Set<RaceDefinition> races = raceHandle.getRaces();
|
||||
|
||||
|
||||
service = new RacingEventServiceImpl();
|
||||
URL paramURL = new URL(paramURLStr);
|
||||
URI liveURI = new URI(liveURIStr);
|
||||
URI storedURI = new URI(storedURIStr);
|
||||
|
||||
raceHandle = SimulatorUtils.loadRace(service, paramURL, liveURI, storedURI, null, EmptyWindStore.INSTANCE,
|
||||
60000);
|
||||
|
||||
System.out.println("Done loading race.");
|
||||
|
||||
String regatta = raceHandle.getRegatta().getName();
|
||||
Set<RaceDefinition> races = raceHandle.getRaces();
|
||||
|
||||
List<TrackedRace> racesList = new ArrayList<TrackedRace>();
|
||||
|
||||
for (RaceDefinition r : races) {
|
||||
RaceIdentifier raceIdentifier = new RegattaNameAndRaceName(regatta, r.getName());
|
||||
//TODO: Fix raceHandle
|
||||
/*
|
||||
TrackedRace tr = service.getExistingTrackedRace(raceIdentifier);
|
||||
|
||||
for (RaceDefinition r : races) {
|
||||
RegattaAndRaceIdentifier raceIdentifier = new RegattaNameAndRaceName(regatta, r.getName());
|
||||
TrackedRace tr = service.getExistingTrackedRace(raceIdentifier);
|
||||
racesList.add(tr);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
FileOutputStream f_os = new FileOutputStream(regatta + ".data");
|
||||
ObjectOutputStream os = new ObjectOutputStream(f_os);
|
||||
os.writeObject(racesList);
|
||||
os.close();
|
||||
|
||||
List<TrackedRace> retrievedRacesList = null;
|
||||
FileInputStream f_in = new FileInputStream(regatta + ".data");
|
||||
ObjectInputStream obj_in = new ObjectInputStream (f_in);
|
||||
retrievedRacesList = (ArrayList<TrackedRace>) obj_in.readObject();
|
||||
obj_in.close();
|
||||
|
||||
for( TrackedRace r : retrievedRacesList) {
|
||||
System.out.println(r.getRaceIdentifier().getRegattaName());
|
||||
Iterable<Competitor> competitors = r.getRace().getCompetitors();
|
||||
os.writeObject(racesList);
|
||||
os.close();
|
||||
|
||||
List<TrackedRace> retrievedRacesList = null;
|
||||
FileInputStream f_in = new FileInputStream(regatta + ".data");
|
||||
ObjectInputStream obj_in = new ObjectInputStream(f_in);
|
||||
retrievedRacesList = (ArrayList<TrackedRace>) obj_in.readObject();
|
||||
obj_in.close();
|
||||
|
||||
for (TrackedRace r : retrievedRacesList) {
|
||||
System.out.println(r.getRaceIdentifier().getRegattaName());
|
||||
Iterable<Competitor> competitors = r.getRace().getCompetitors();
|
||||
System.out.println("" + competitors);
|
||||
Iterator<Competitor> comIter = competitors.iterator();
|
||||
while (comIter.hasNext()) {
|
||||
@@ -102,11 +92,11 @@ public class TestRacingEventPersistence {
|
||||
track.lockForRead();
|
||||
fixes = track.getFixes();
|
||||
GPSFixMoving fix = fixes.iterator().next();
|
||||
System.out.println("" + com.getName() + ", First GPS-Fix: " + fix.getPosition().getLatDeg() + ", " + fix.getPosition().getLngDeg());
|
||||
System.out.println("" + com.getName() + ", First GPS-Fix: " + fix.getPosition().getLatDeg() + ", "
|
||||
+ fix.getPosition().getLngDeg());
|
||||
track.unlockAfterRead();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+34
-33
@@ -10,7 +10,7 @@ import java.util.logging.Logger;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.RaceDefinition;
|
||||
import com.sap.sailing.domain.common.RaceIdentifier;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.RegattaNameAndRaceName;
|
||||
import com.sap.sailing.domain.tracking.GPSFixMoving;
|
||||
import com.sap.sailing.domain.tracking.GPSFixTrack;
|
||||
@@ -18,7 +18,9 @@ import com.sap.sailing.domain.tracking.RacesHandle;
|
||||
import com.sap.sailing.domain.tracking.TrackedRace;
|
||||
import com.sap.sailing.domain.tracking.impl.EmptyWindStore;
|
||||
import com.sap.sailing.server.impl.RacingEventServiceImpl;
|
||||
import com.sap.sailing.simulator.impl.SimulatorUtils;
|
||||
|
||||
@SuppressWarnings("restriction")
|
||||
public class RaceDataAccessTest {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(RaceDataAccessTest.class.getName());
|
||||
@@ -31,7 +33,8 @@ public class RaceDataAccessTest {
|
||||
private static RacesHandle raceHandle;
|
||||
public boolean storedend = false;
|
||||
|
||||
public static void main(String[] args) throws Exception, InterruptedException, MalformedURLException, URISyntaxException {
|
||||
public static void main(String[] args) throws Exception, InterruptedException, MalformedURLException,
|
||||
URISyntaxException {
|
||||
|
||||
// JSON URL: http://germanmaster.traclive.dk/events/event_20110929_Internatio/jsonservice.php
|
||||
|
||||
@@ -44,7 +47,8 @@ public class RaceDataAccessTest {
|
||||
// URL("http://germanmaster.traclive.dk/events/event_20110929_Internatio/clientparams.php?event=event_20110929_Internatio&race=be8a79a8-ec52-11e0-a523-406186cbf87c");
|
||||
|
||||
// 49er Race4
|
||||
// paramUrl = new URL("http://germanmaster.traclive.dk/events/event_20110929_Internatio/clientparams.php?event=event_20110929_Internatio&race=d1f521fa-ec52-11e0-a523-406186cbf87c");
|
||||
// paramUrl = new
|
||||
// URL("http://germanmaster.traclive.dk/events/event_20110929_Internatio/clientparams.php?event=event_20110929_Internatio&race=d1f521fa-ec52-11e0-a523-406186cbf87c");
|
||||
|
||||
// 49er Race5
|
||||
// paramUrl = new
|
||||
@@ -69,41 +73,38 @@ public class RaceDataAccessTest {
|
||||
//
|
||||
// Kieler Woche 2012, JSON: http://germanmaster.traclive.dk/events/event_20120615_KielerWoch/jsonservice.php
|
||||
//
|
||||
// 49er
|
||||
paramUrl = new URL("http://germanmaster.traclive.dk/events/event_20120615_KielerWoch/clientparams.php?event=event_20120615_KielerWoch&race=0b5969cc-b789-11e1-a845-406186cbf87c");
|
||||
|
||||
// 49er
|
||||
paramUrl = new URL(
|
||||
"http://germanmaster.traclive.dk/events/event_20120615_KielerWoch/clientparams.php?event=event_20120615_KielerWoch&race=0b5969cc-b789-11e1-a845-406186cbf87c");
|
||||
|
||||
System.setProperty("mongo.port", "10200");
|
||||
System.setProperty("http.proxyHost", "proxy.wdf.sap.corp");
|
||||
System.setProperty("http.proxyPort", "8080");
|
||||
// paramUrl = new URL("http://germanmaster.traclive.dk/events/event_20120615_KielerWoch/clientparams.php?event=event_20120615_KielerWoch&race=0b5969cc-b789-11e1-a845-406186cbf87c");
|
||||
paramUrl = new URL("http://germanmaster.traclive.dk/events/event_20110929_Internatio/clientparams.php?event=event_20110929_Internatio&race=d1f521fa-ec52-11e0-a523-406186cbf87c");
|
||||
//old
|
||||
//liveUri = new URI("tcp://10.18.206.73:1520");
|
||||
//proxy
|
||||
// paramUrl = new
|
||||
// URL("http://germanmaster.traclive.dk/events/event_20120615_KielerWoch/clientparams.php?event=event_20120615_KielerWoch&race=0b5969cc-b789-11e1-a845-406186cbf87c");
|
||||
paramUrl = new URL(
|
||||
"http://germanmaster.traclive.dk/events/event_20110929_Internatio/clientparams.php?event=event_20110929_Internatio&race=d1f521fa-ec52-11e0-a523-406186cbf87c");
|
||||
// old
|
||||
// liveUri = new URI("tcp://10.18.206.73:1520");
|
||||
// proxy
|
||||
liveUri = new URI("tcp://10.18.22.156:1520");
|
||||
//non-proxy
|
||||
//liveUri = new URI("tcp://germanmaster.traclive.dk:4400");
|
||||
|
||||
//old
|
||||
//storedUri = new URI("tcp://10.18.206.73:1521");
|
||||
//proxy
|
||||
// non-proxy
|
||||
// liveUri = new URI("tcp://germanmaster.traclive.dk:4400");
|
||||
|
||||
// old
|
||||
// storedUri = new URI("tcp://10.18.206.73:1521");
|
||||
// proxy
|
||||
storedUri = new URI("tcp://10.18.22.156:1521");
|
||||
//non-proxy
|
||||
//storedUri = new URI("tcp://germanmaster.traclive.dk:4401");
|
||||
|
||||
// non-proxy
|
||||
// storedUri = new URI("tcp://germanmaster.traclive.dk:4401");
|
||||
|
||||
service = new RacingEventServiceImpl();
|
||||
logger.info("Calling service.addTracTracRace");
|
||||
Object obj = new Object();
|
||||
//TODO: Fix raceHandle
|
||||
/*
|
||||
raceHandle = service.addTracTracRace(paramUrl, liveUri, storedUri, EmptyWindStore.INSTANCE, 60000, obj);
|
||||
|
||||
raceHandle = SimulatorUtils.loadRace(service, paramUrl, liveUri, storedUri, null, EmptyWindStore.INSTANCE,
|
||||
60000);
|
||||
logger.info("Calling raceHandle.getRaces(): " + raceHandle);
|
||||
|
||||
synchronized (obj) {
|
||||
obj.wait();
|
||||
}
|
||||
*/
|
||||
|
||||
Set<RaceDefinition> races = raceHandle.getRaces(); // wait for RaceDefinition to be completely wired in Regatta
|
||||
logger.info("Obtained races: " + races.size());
|
||||
|
||||
@@ -114,9 +115,8 @@ public class RaceDataAccessTest {
|
||||
RaceDefinition race = racIter.next();
|
||||
System.out.println("Race: \"" + race.getName() + "\", \"" + regatta + "\"");
|
||||
|
||||
RaceIdentifier raceIdentifier = new RegattaNameAndRaceName(regatta, race.getName());
|
||||
//TODO: fix getTrackedRace
|
||||
TrackedRace tr = null; //service.getExistingTrackedRace(raceIdentifier);
|
||||
RegattaAndRaceIdentifier raceIdentifier = new RegattaNameAndRaceName(regatta, race.getName());
|
||||
TrackedRace tr = service.getExistingTrackedRace(raceIdentifier);
|
||||
|
||||
System.out.println("Competitors:");
|
||||
Iterable<Competitor> competitors = tr.getRace().getCompetitors();
|
||||
@@ -131,7 +131,8 @@ public class RaceDataAccessTest {
|
||||
track.lockForRead();
|
||||
fixes = track.getFixes();
|
||||
GPSFixMoving fix = fixes.iterator().next();
|
||||
System.out.println("" + com.getName() + ", First GPS-Fix: " + fix.getPosition().getLatDeg() + ", " + fix.getPosition().getLngDeg());
|
||||
System.out.println("" + com.getName() + ", First GPS-Fix: " + fix.getPosition().getLatDeg() + ", "
|
||||
+ fix.getPosition().getLngDeg());
|
||||
track.unlockAfterRead();
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,5 +5,5 @@ import java.util.List;
|
||||
import com.sap.sailing.domain.tracking.TrackedRace;
|
||||
|
||||
public interface TracTracReader {
|
||||
public List<TrackedRace> read() throws Exception;
|
||||
public List<TrackedRace> read() throws Exception;
|
||||
}
|
||||
+23
-23
@@ -8,28 +8,28 @@ import java.util.List;
|
||||
import com.sap.sailing.domain.tracking.TrackedRace;
|
||||
|
||||
public class TracTracReaderFromFiles implements TracTracReader {
|
||||
|
||||
String[] dataFiles;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<TrackedRace> read() throws Exception {
|
||||
|
||||
List<TrackedRace> lst = new ArrayList<TrackedRace>();
|
||||
|
||||
for( String f : dataFiles) {
|
||||
List<TrackedRace> retrievedRacesList = null;
|
||||
FileInputStream f_in = new FileInputStream(f);
|
||||
ObjectInputStream obj_in = new ObjectInputStream (f_in);
|
||||
retrievedRacesList = (ArrayList<TrackedRace>) obj_in.readObject();
|
||||
obj_in.close();
|
||||
lst.addAll(retrievedRacesList);
|
||||
}
|
||||
|
||||
return lst;
|
||||
}
|
||||
|
||||
public TracTracReaderFromFiles( String[] dataFiles ) {
|
||||
this.dataFiles = dataFiles;
|
||||
}
|
||||
|
||||
String[] dataFiles;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<TrackedRace> read() throws Exception {
|
||||
|
||||
List<TrackedRace> lst = new ArrayList<TrackedRace>();
|
||||
|
||||
for (String f : dataFiles) {
|
||||
List<TrackedRace> retrievedRacesList = null;
|
||||
FileInputStream f_in = new FileInputStream(f);
|
||||
ObjectInputStream obj_in = new ObjectInputStream(f_in);
|
||||
retrievedRacesList = (ArrayList<TrackedRace>) obj_in.readObject();
|
||||
obj_in.close();
|
||||
lst.addAll(retrievedRacesList);
|
||||
}
|
||||
|
||||
return lst;
|
||||
}
|
||||
|
||||
public TracTracReaderFromFiles(String[] dataFiles) {
|
||||
this.dataFiles = dataFiles;
|
||||
}
|
||||
|
||||
}
|
||||
+59
-60
@@ -7,79 +7,78 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.sap.sailing.domain.base.RaceDefinition;
|
||||
import com.sap.sailing.domain.common.RaceIdentifier;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.RegattaNameAndRaceName;
|
||||
import com.sap.sailing.domain.tracking.RacesHandle;
|
||||
import com.sap.sailing.domain.tracking.TrackedRace;
|
||||
import com.sap.sailing.domain.tracking.impl.EmptyWindStore;
|
||||
import com.sap.sailing.server.impl.RacingEventServiceImpl;
|
||||
import com.sap.sailing.simulator.impl.SimulatorUtils;
|
||||
|
||||
@SuppressWarnings("restriction")
|
||||
public class TracTracReaderFromURLs implements TracTracReader {
|
||||
|
||||
public void setMongoPortStr(String mongoPortStr) {
|
||||
this.mongoPortStr = mongoPortStr;
|
||||
}
|
||||
public void setMongoPortStr(String mongoPortStr) {
|
||||
this.mongoPortStr = mongoPortStr;
|
||||
}
|
||||
|
||||
public void setProxyHostStr(String proxyHostStr) {
|
||||
this.proxyHostStr = proxyHostStr;
|
||||
}
|
||||
public void setProxyHostStr(String proxyHostStr) {
|
||||
this.proxyHostStr = proxyHostStr;
|
||||
}
|
||||
|
||||
public void setProxyPortStr(String proxyPortStr) {
|
||||
this.proxyPortStr = proxyPortStr;
|
||||
}
|
||||
public void setProxyPortStr(String proxyPortStr) {
|
||||
this.proxyPortStr = proxyPortStr;
|
||||
}
|
||||
|
||||
public void setLiveURIStr(String liveURIStr) {
|
||||
this.liveURIStr = liveURIStr;
|
||||
}
|
||||
public void setLiveURIStr(String liveURIStr) {
|
||||
this.liveURIStr = liveURIStr;
|
||||
}
|
||||
|
||||
public void setStoredUriStr(String storedUriStr) {
|
||||
this.storedURIStr = storedUriStr;
|
||||
}
|
||||
public void setStoredUriStr(String storedUriStr) {
|
||||
this.storedURIStr = storedUriStr;
|
||||
}
|
||||
|
||||
private String mongoPortStr = "10200";
|
||||
private String proxyHostStr = "proxy.wdf.sap.corp";
|
||||
private String proxyPortStr = "8080";
|
||||
private String liveURIStr = "tcp://10.18.22.156:1520";
|
||||
private String storedURIStr = "tcp://10.18.22.156:1521";
|
||||
|
||||
private String[] tracTracParamURLs;
|
||||
|
||||
public TracTracReaderFromURLs(String[] tracTracParamURLs) {
|
||||
super();
|
||||
this.tracTracParamURLs = tracTracParamURLs;
|
||||
}
|
||||
private String mongoPortStr = "10200";
|
||||
private String proxyHostStr = "proxy.wdf.sap.corp";
|
||||
private String proxyPortStr = "8080";
|
||||
private String liveURIStr = "tcp://10.18.22.156:1520";
|
||||
private String storedURIStr = "tcp://10.18.22.156:1521";
|
||||
|
||||
@Override
|
||||
public List<TrackedRace> read() throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
System.setProperty("mongo.port", mongoPortStr);
|
||||
System.setProperty("http.proxyHost", proxyHostStr);
|
||||
System.setProperty("http.proxyPort", proxyPortStr);
|
||||
RacingEventServiceImpl service = new RacingEventServiceImpl();
|
||||
URI liveURI = new URI(liveURIStr);
|
||||
URI storedURI = new URI(storedURIStr);
|
||||
|
||||
List<TrackedRace> racesList = new ArrayList<TrackedRace>();
|
||||
|
||||
for( String paramURLStr : tracTracParamURLs ) {
|
||||
URL paramURL = new URL(paramURLStr);
|
||||
//TODO: fix getTrackedRace
|
||||
RacesHandle raceHandle = null; //service.addTracTracRace(paramURL, liveURI, storedURI, EmptyWindStore.INSTANCE, 60000, this);
|
||||
synchronized (this) {
|
||||
this.wait();
|
||||
}
|
||||
String regatta = raceHandle.getRegatta().getName();
|
||||
Set<RaceDefinition> races = raceHandle.getRaces();
|
||||
|
||||
for (RaceDefinition r : races) {
|
||||
RaceIdentifier raceIdentifier = new RegattaNameAndRaceName(regatta, r.getName());
|
||||
//TODO: fix getTrackedRace
|
||||
TrackedRace tr = null; //service.getExistingTrackedRace(raceIdentifier);
|
||||
racesList.add(tr);
|
||||
}
|
||||
}
|
||||
|
||||
return racesList;
|
||||
}
|
||||
private String[] tracTracParamURLs;
|
||||
|
||||
public TracTracReaderFromURLs(String[] tracTracParamURLs) {
|
||||
super();
|
||||
this.tracTracParamURLs = tracTracParamURLs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TrackedRace> read() throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
System.setProperty("mongo.port", mongoPortStr);
|
||||
System.setProperty("http.proxyHost", proxyHostStr);
|
||||
System.setProperty("http.proxyPort", proxyPortStr);
|
||||
RacingEventServiceImpl service = new RacingEventServiceImpl();
|
||||
URI liveURI = new URI(liveURIStr);
|
||||
URI storedURI = new URI(storedURIStr);
|
||||
|
||||
List<TrackedRace> racesList = new ArrayList<TrackedRace>();
|
||||
|
||||
for (String paramURLStr : tracTracParamURLs) {
|
||||
URL paramURL = new URL(paramURLStr);
|
||||
RacesHandle raceHandle = SimulatorUtils.loadRace(service, paramURL, liveURI, storedURI, null,
|
||||
EmptyWindStore.INSTANCE, 60000);
|
||||
|
||||
String regatta = raceHandle.getRegatta().getName();
|
||||
Set<RaceDefinition> races = raceHandle.getRaces();
|
||||
|
||||
for (RaceDefinition r : races) {
|
||||
RegattaAndRaceIdentifier raceIdentifier = new RegattaNameAndRaceName(regatta, r.getName());
|
||||
TrackedRace tr = service.getExistingTrackedRace(raceIdentifier);
|
||||
racesList.add(tr);
|
||||
}
|
||||
}
|
||||
|
||||
return racesList;
|
||||
}
|
||||
|
||||
}
|
||||
+49
-51
@@ -9,63 +9,61 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.sap.sailing.domain.base.RaceDefinition;
|
||||
import com.sap.sailing.domain.common.RaceIdentifier;
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.RegattaNameAndRaceName;
|
||||
import com.sap.sailing.domain.tracking.RacesHandle;
|
||||
import com.sap.sailing.domain.tracking.TrackedRace;
|
||||
import com.sap.sailing.domain.tracking.impl.EmptyWindStore;
|
||||
import com.sap.sailing.server.impl.RacingEventServiceImpl;
|
||||
import com.sap.sailing.simulator.impl.SimulatorUtils;
|
||||
|
||||
@SuppressWarnings("restriction")
|
||||
public class TracTracWriter {
|
||||
|
||||
private String[] sources;
|
||||
//Map<String, String> systemProperties;
|
||||
|
||||
public TracTracWriter(String[] sources) {
|
||||
|
||||
this.sources = sources;
|
||||
|
||||
}
|
||||
|
||||
public void write() throws Exception {
|
||||
|
||||
System.setProperty("mongo.port", "10200");
|
||||
System.setProperty("http.proxyHost", "proxy.wdf.sap.corp");
|
||||
System.setProperty("http.proxyPort", "8080");
|
||||
RacingEventServiceImpl service = new RacingEventServiceImpl();
|
||||
URI liveURI = new URI("tcp://10.18.22.156:1520");
|
||||
URI storedURI = new URI("tcp://10.18.22.156:1521");
|
||||
|
||||
for( String paramURLStr : sources ) {
|
||||
URL paramURL = new URL(paramURLStr);
|
||||
//TODO: fix getTrackedRace
|
||||
RacesHandle raceHandle = null; //service.addTracTracRace(paramURL, liveURI, storedURI, EmptyWindStore.INSTANCE, 60000, this);
|
||||
synchronized (this) {
|
||||
this.wait();
|
||||
}
|
||||
|
||||
String regatta = raceHandle.getRegatta().getName();
|
||||
Set<RaceDefinition> races = raceHandle.getRaces();
|
||||
|
||||
List<TrackedRace> racesList = new ArrayList<TrackedRace>();
|
||||
|
||||
for (RaceDefinition r : races) {
|
||||
RaceIdentifier raceIdentifier = new RegattaNameAndRaceName(regatta, r.getName());
|
||||
//TODO: fix getTrackedRace
|
||||
TrackedRace tr = null; //service.getExistingTrackedRace(raceIdentifier);
|
||||
racesList.add(tr);
|
||||
}
|
||||
System.out.println("start writing");
|
||||
//TODO: naming convention
|
||||
FileOutputStream f_os = new FileOutputStream(regatta + "race name" +".data");
|
||||
ObjectOutputStream os = new ObjectOutputStream(f_os);
|
||||
os.writeObject(racesList);
|
||||
os.close();
|
||||
System.out.println("done writing");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private String[] sources;
|
||||
|
||||
// Map<String, String> systemProperties;
|
||||
|
||||
public TracTracWriter(String[] sources) {
|
||||
|
||||
this.sources = sources;
|
||||
|
||||
}
|
||||
|
||||
public void write() throws Exception {
|
||||
|
||||
RacingEventServiceImpl service = new RacingEventServiceImpl();
|
||||
|
||||
System.setProperty("mongo.port", "10200");
|
||||
System.setProperty("http.proxyHost", "proxy.wdf.sap.corp");
|
||||
System.setProperty("http.proxyPort", "8080");
|
||||
URI liveURI = new URI("tcp://10.18.22.156:1520");
|
||||
URI storedURI = new URI("tcp://10.18.22.156:1521");
|
||||
|
||||
for (String paramURLStr : sources) {
|
||||
URL paramURL = new URL(paramURLStr);
|
||||
RacesHandle raceHandle = SimulatorUtils.loadRace(service, paramURL, liveURI, storedURI, null,
|
||||
EmptyWindStore.INSTANCE, 60000);
|
||||
String regatta = raceHandle.getRegatta().getName();
|
||||
Set<RaceDefinition> races = raceHandle.getRaces();
|
||||
|
||||
List<TrackedRace> racesList = new ArrayList<TrackedRace>();
|
||||
|
||||
for (RaceDefinition r : races) {
|
||||
RegattaAndRaceIdentifier raceIdentifier = new RegattaNameAndRaceName(regatta, r.getName());
|
||||
TrackedRace tr = service.getExistingTrackedRace(raceIdentifier);
|
||||
racesList.add(tr);
|
||||
}
|
||||
System.out.println("start writing");
|
||||
// TODO: naming convention
|
||||
FileOutputStream f_os = new FileOutputStream(regatta + "race name" + ".data");
|
||||
ObjectOutputStream os = new ObjectOutputStream(f_os);
|
||||
os.writeObject(racesList);
|
||||
os.close();
|
||||
System.out.println("done writing");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user