mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-20 04:35:32 +00:00
bug6215: created local polar_data files for test cases, using new serialization format
This commit is contained in:
+3
-2
@@ -19,6 +19,7 @@ import com.sap.sailing.domain.base.impl.DomainFactoryImpl;
|
||||
import com.sap.sailing.domain.common.LegType;
|
||||
import com.sap.sailing.domain.common.polars.NotEnoughDataHasBeenAddedException;
|
||||
import com.sap.sailing.polars.impl.PolarDataServiceImpl;
|
||||
import com.sap.sailing.polars.jaxrs.client.FileBasedPolarDataClient;
|
||||
|
||||
public class PolarDataResourceTest {
|
||||
private static final Logger logger = Logger.getLogger(PolarDataResourceTest.class.getName());
|
||||
@@ -35,7 +36,7 @@ public class PolarDataResourceTest {
|
||||
public void setUp() throws IOException, ParseException, ClassNotFoundException, InterruptedException {
|
||||
polarService = new PolarDataServiceImpl();
|
||||
domainFactory = new DomainFactoryImpl(/* raceLogResolver */ null);
|
||||
final PolarDataClientMock client = new PolarDataClientMock(new File("resources/polar_data"), polarService, domainFactory);
|
||||
final FileBasedPolarDataClient client = new FileBasedPolarDataClient(new File("resources/polar_data"), polarService, domainFactory);
|
||||
client.updatePolarDataRegressions();
|
||||
// ensure that setting the domain factory has worked
|
||||
polarService.runWithDomainFactory(domainFactory -> {
|
||||
@@ -48,7 +49,7 @@ public class PolarDataResourceTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test to check if client importing data correctly. Using {@link PolarDataClientMock} which use {@link File}
|
||||
* Test to check if client importing data correctly. Using {@link FileBasedPolarDataClient} which use {@link File}
|
||||
* polar_data.json as source
|
||||
*
|
||||
* @throws NotEnoughDataHasBeenAddedException
|
||||
|
||||
+3
-5
@@ -1,4 +1,4 @@
|
||||
package com.sap.sailing.polars.jaxrs.api.test;
|
||||
package com.sap.sailing.polars.jaxrs.client;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -10,13 +10,12 @@ import org.json.simple.parser.ParseException;
|
||||
|
||||
import com.sap.sailing.domain.base.DomainFactory;
|
||||
import com.sap.sailing.polars.ReplicablePolarService;
|
||||
import com.sap.sailing.polars.jaxrs.client.PolarDataClient;
|
||||
|
||||
public class PolarDataClientMock extends PolarDataClient {
|
||||
public class FileBasedPolarDataClient extends PolarDataClient {
|
||||
|
||||
private final File file;
|
||||
|
||||
public PolarDataClientMock(File file, ReplicablePolarService polarService, DomainFactory domainFactory) {
|
||||
public FileBasedPolarDataClient(File file, ReplicablePolarService polarService, DomainFactory domainFactory) {
|
||||
super(null, polarService, Optional.empty());
|
||||
polarService.registerDomainFactory(domainFactory);
|
||||
this.file = file;
|
||||
@@ -26,5 +25,4 @@ public class PolarDataClientMock extends PolarDataClient {
|
||||
protected InputStream getContentFromResponse() throws IOException, ParseException {
|
||||
return new FileInputStream(file);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -console 12001 -clean"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dfile.encoding=cp1252 -Dexpedition.udp.port=5010 -Xmx6000m -XX:ThreadPriorityPolicy=2 -XX:+UseG1GC -Djetty.home=${project_loc:com.sap.sailing.server}/../target/configuration/jetty -Djava.util.logging.config.file=${project_loc:com.sap.sailing.server}/../target/configuration/logging_debug.properties -Dkiwo.results=${project_loc:com.sap.sailing.kiworesultimport.test}/resources -Dpersistentcompetitors.clear=false -Dpolardata.source.url=https://www.sapsailing.com -Dwindestimation.source.url=https://www.sapsailing.com -Drestore.tracked.races=true -Dorg.eclipse.jetty.server.Request.maxFormContentSize=50000000 -DAnniversaryRaceDeterminator.enabled=true -Djava.naming.factory.url.pkgs=org.eclipse.jetty.jndi -Djava.naming.factory.initial=org.eclipse.jetty.jndi.InitialContextFactory -Dorg.eclipse.jetty.annotations.maxWait=120 -Dchargebee.site=${CHARGEBEE_SITE} -Dchargebee.apikey=${CHARGEBEE_API_KEY} -Dmanage2sail.accesstoken=${MANAGE2SAIL_ACCESS_TOKEN} -Dsubscriptions.disableMailVerificationRequirement=true -Dgoogle.maps.authenticationparams=${GOOGLE_MAPS_AUTHENTICATION_PARAMS} -Dgwt.rpc.version=9 -Dwindestimation.source.bearertoken=${WIND_ESTIMATION_MODEL_BEARER_TOKEN} -Dpolardata.source.bearertoken=${POLAR_DATA_BEARER_TOKEN} -Dcom.sap.sse.branding=SAP -Digtimi.riot.port=6000 -Digtimi.base.url=http://127.0.0.1:8888 -Dsap.aicore.credentials='${SAP_AICORE_CREDENTIALS}' -Dsap.sailing.aiagent.modelname=gpt-4o -Dgeonames.org.usernames="${GEONAMES_ORG_USERNAMES}""/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dfile.encoding=cp1252 -Dexpedition.udp.port=5010 -Xmx12g -XX:ThreadPriorityPolicy=2 -XX:+UseG1GC -Djetty.home=${project_loc:com.sap.sailing.server}/../target/configuration/jetty -Djava.util.logging.config.file=${project_loc:com.sap.sailing.server}/../target/configuration/logging_debug.properties -Dkiwo.results=${project_loc:com.sap.sailing.kiworesultimport.test}/resources -Dpersistentcompetitors.clear=false -Dpolardata.source.url=https://www.sapsailing.com -Dwindestimation.source.url=https://www.sapsailing.com -Drestore.tracked.races=true -Dorg.eclipse.jetty.server.Request.maxFormContentSize=50000000 -DAnniversaryRaceDeterminator.enabled=true -Djava.naming.factory.url.pkgs=org.eclipse.jetty.jndi -Djava.naming.factory.initial=org.eclipse.jetty.jndi.InitialContextFactory -Dorg.eclipse.jetty.annotations.maxWait=120 -Dchargebee.site=${CHARGEBEE_SITE} -Dchargebee.apikey=${CHARGEBEE_API_KEY} -Dmanage2sail.accesstoken=${MANAGE2SAIL_ACCESS_TOKEN} -Dsubscriptions.disableMailVerificationRequirement=true -Dgoogle.maps.authenticationparams=${GOOGLE_MAPS_AUTHENTICATION_PARAMS} -Dgwt.rpc.version=9 -Dwindestimation.source.bearertoken=${WIND_ESTIMATION_MODEL_BEARER_TOKEN} -Dpolardata.source.bearertoken=${POLAR_DATA_BEARER_TOKEN} -Dcom.sap.sse.branding=SAP -Digtimi.riot.port=6000 -Digtimi.base.url=http://127.0.0.1:8888 -Dsap.aicore.credentials='${SAP_AICORE_CREDENTIALS}' -Dsap.sailing.aiagent.modelname=gpt-4o -Dgeonames.org.usernames="${GEONAMES_ORG_USERNAMES}""/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc}"/>
|
||||
<stringAttribute key="pde.version" value="3.3"/>
|
||||
<stringAttribute key="profilingTraceType-ALLOCATION_TRACE" value="KEY_APPLICATION_FILTER%CTX_KEY%*%CTX_ENTRY%INCREASE_COUNT%CTX_KEY%8192%CTX_ENTRY%KEY_MIN_SIZE%CTX_KEY%32%CTX_ENTRY%KEY_MAX_SIZE%CTX_KEY%65536%CTX_ENTRY%KEY_INC_LINE_NRS%CTX_KEY%true%CTX_ENTRY%KEY_SESSION_FILTER%CTX_KEY%*%CTX_ENTRY%KEY_ENABLEMENT%CTX_KEY%false%CTX_ENTRY%CLASS_FILTER%CTX_KEY%*%CTX_ENTRY%KEY_USER_FILTER%CTX_KEY%*%CTX_ENTRY%KEY_REQUEST_FILTER%CTX_KEY%*%CTX_ENTRY%KEY_TENANT_FILTER%CTX_KEY%*%CTX_ENTRY%KEY_ADAPTIVE%CTX_KEY%false%CTX_ENTRY%"/>
|
||||
|
||||
Binary file not shown.
+30
@@ -0,0 +1,30 @@
|
||||
package com.sap.sailing.windestimation.integration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
import org.json.simple.parser.ParseException;
|
||||
|
||||
import com.sap.sailing.domain.base.DomainFactory;
|
||||
import com.sap.sailing.domain.polars.PolarDataService;
|
||||
import com.sap.sailing.domain.test.OnlineTracTracBasedTest;
|
||||
import com.sap.sailing.polars.impl.PolarDataServiceImpl;
|
||||
import com.sap.sailing.polars.jaxrs.client.FileBasedPolarDataClient;
|
||||
|
||||
public abstract class AbstractTestWithLocal505PolarData extends OnlineTracTracBasedTest {
|
||||
protected AbstractTestWithLocal505PolarData() throws MalformedURLException, URISyntaxException {
|
||||
super();
|
||||
}
|
||||
|
||||
protected PolarDataService createPolarDataService() throws ClassNotFoundException, IOException, ParseException, InterruptedException {
|
||||
final PolarDataServiceImpl polarDataService = new PolarDataServiceImpl();
|
||||
final com.sap.sailing.domain.tractracadapter.DomainFactory domainFactoryImpl = getDomainFactory();
|
||||
final DomainFactory baseDomainFactory = domainFactoryImpl.getBaseDomainFactory();
|
||||
final FileBasedPolarDataClient client = new FileBasedPolarDataClient(new File("resources/polar_data"), polarDataService, baseDomainFactory);
|
||||
client.updatePolarDataRegressions();
|
||||
getTrackedRace().setPolarDataService(polarDataService);
|
||||
return polarDataService;
|
||||
}
|
||||
}
|
||||
+7
-26
@@ -45,7 +45,7 @@ import com.sap.sailing.domain.tractracadapter.ReceiverType;
|
||||
import com.sap.sailing.domain.windestimation.IncrementalWindEstimation;
|
||||
import com.sap.sailing.domain.windestimation.TimePointAndPositionWithToleranceComparator;
|
||||
import com.sap.sailing.polars.impl.PolarDataServiceImpl;
|
||||
import com.sap.sailing.polars.jaxrs.client.PolarDataClient;
|
||||
import com.sap.sailing.polars.jaxrs.client.FileBasedPolarDataClient;
|
||||
import com.sap.sailing.windestimation.ManeuverBasedWindEstimationComponentImpl;
|
||||
import com.sap.sailing.windestimation.aggregator.ManeuverClassificationsAggregatorFactory;
|
||||
import com.sap.sailing.windestimation.data.CompetitorTrackWithEstimationData;
|
||||
@@ -79,7 +79,7 @@ import com.sap.sse.testutils.MeasurementXMLFile;
|
||||
* @author Vladislav Chumak (D069712)
|
||||
*
|
||||
*/
|
||||
public class IncrementalMstHmmWindEstimationForTrackedRaceTest extends OnlineTracTracBasedTest {
|
||||
public class IncrementalMstHmmWindEstimationForTrackedRaceTest extends AbstractTestWithLocal505PolarData {
|
||||
private static final Logger logger = Logger.getLogger(IncrementalMstHmmWindEstimationForTrackedRaceTest.class.getName());
|
||||
|
||||
|
||||
@@ -131,30 +131,11 @@ public class IncrementalMstHmmWindEstimationForTrackedRaceTest extends OnlineTra
|
||||
new URL("file:///" + new File("resources/event_20110609_KielerWoch-505_Race_2.txt").getCanonicalPath()),
|
||||
/* liveUri */ null, /* storedUri */ storedUri,
|
||||
new ReceiverType[] { ReceiverType.MARKPASSINGS, ReceiverType.RACECOURSE, ReceiverType.RAWPOSITIONS, ReceiverType.MARKPOSITIONS });
|
||||
String polarDataBearerToken = System.getProperty("polardata.source.bearertoken");
|
||||
if (polarDataBearerToken == null) {
|
||||
logger.info("Couldn't find polardata.source.bearertoken system property, trying environment variable POLAR_DATA_BEARER_TOKEN");
|
||||
polarDataBearerToken = System.getenv("POLAR_DATA_BEARER_TOKEN");
|
||||
if (polarDataBearerToken == null) {
|
||||
logger.warning("Couldn't find POLAR_DATA_BEARER_TOKEN environment variable either, polar data service will not be available");
|
||||
} else {
|
||||
logger.info("Found POLAR_DATA_BEARER_TOKEN environment variable, length "+polarDataBearerToken.length()
|
||||
+"; polar data service will be available");
|
||||
}
|
||||
} else {
|
||||
logger.info("Found polardata.source.bearertoken system property, polar data service will be available");
|
||||
}
|
||||
final Optional<String> polardataBearerTokenOptional = Optional.ofNullable(polarDataBearerToken);
|
||||
if (polardataBearerTokenOptional.isPresent()) {
|
||||
polarDataService = new PolarDataServiceImpl();
|
||||
final com.sap.sailing.domain.tractracadapter.DomainFactory domainFactoryImpl = getDomainFactory();
|
||||
final DomainFactory baseDomainFactory = domainFactoryImpl.getBaseDomainFactory();
|
||||
polarDataService.registerDomainFactory(baseDomainFactory);
|
||||
new PolarDataClient(Optional.ofNullable(System.getenv("POLAR_DATA_BASE_URL")).orElse("https://sapsailing.com"), polarDataService, polardataBearerTokenOptional)
|
||||
.updatePolarDataRegressions();
|
||||
} else {
|
||||
polarDataService = new PolarDataServiceImpl();
|
||||
}
|
||||
polarDataService = new PolarDataServiceImpl();
|
||||
final com.sap.sailing.domain.tractracadapter.DomainFactory domainFactoryImpl = getDomainFactory();
|
||||
final DomainFactory baseDomainFactory = domainFactoryImpl.getBaseDomainFactory();
|
||||
final FileBasedPolarDataClient client = new FileBasedPolarDataClient(new File("resources/polar_data"), polarDataService, baseDomainFactory);
|
||||
client.updatePolarDataRegressions();
|
||||
getTrackedRace().setPolarDataService(polarDataService);
|
||||
final GregorianCalendar cal = new GregorianCalendar(2011, 05, 23, 13, 40);
|
||||
cal.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
|
||||
+3
-35
@@ -13,29 +13,24 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.TimeZone;
|
||||
import java.util.TreeSet;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.json.simple.parser.ParseException;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.DomainFactory;
|
||||
import com.sap.sailing.domain.maneuverdetection.TrackTimeInfo;
|
||||
import com.sap.sailing.domain.maneuverdetection.impl.IncrementalManeuverDetectorImpl;
|
||||
import com.sap.sailing.domain.maneuverdetection.impl.ManeuverDetectorWithEstimationDataSupportDecoratorImpl;
|
||||
import com.sap.sailing.domain.polars.PolarDataService;
|
||||
import com.sap.sailing.domain.test.OnlineTracTracBasedTest;
|
||||
import com.sap.sailing.domain.tracking.CompleteManeuverCurve;
|
||||
import com.sap.sailing.domain.tracking.impl.DynamicTrackedRaceImpl;
|
||||
import com.sap.sailing.domain.tractracadapter.ReceiverType;
|
||||
import com.sap.sailing.domain.windestimation.TimePointAndPositionWithToleranceComparator;
|
||||
import com.sap.sailing.polars.ReplicablePolarService;
|
||||
import com.sap.sailing.polars.impl.PolarDataServiceImpl;
|
||||
import com.sap.sailing.polars.jaxrs.client.PolarDataClient;
|
||||
import com.sap.sailing.windestimation.aggregator.msthmm.DistanceAndDurationAwareWindTransitionProbabilitiesCalculator;
|
||||
import com.sap.sailing.windestimation.aggregator.msthmm.MstGraphLevel;
|
||||
import com.sap.sailing.windestimation.aggregator.msthmm.MstManeuverGraphGenerator.MstManeuverGraphComponents;
|
||||
@@ -55,9 +50,7 @@ import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
* @author Vladislav Chumak (D069712)
|
||||
*
|
||||
*/
|
||||
public class IncrementalMstManeuverGraphGeneratorTest extends OnlineTracTracBasedTest {
|
||||
private static final Logger logger = Logger.getLogger(IncrementalMstManeuverGraphGeneratorTest.class.getName());
|
||||
|
||||
public class IncrementalMstManeuverGraphGeneratorTest extends AbstractTestWithLocal505PolarData {
|
||||
protected final SimpleDateFormat dateFormat;
|
||||
private ClassPathReadOnlyModelStoreImpl modelStore;
|
||||
|
||||
@@ -94,32 +87,7 @@ public class IncrementalMstManeuverGraphGeneratorTest extends OnlineTracTracBase
|
||||
assertTrue(gaussianBasedTwdTransitionDistributionCache.isReady() && maneuverClassifiersCache.isReady(),
|
||||
"Wind estimation models are empty");
|
||||
final DynamicTrackedRaceImpl trackedRace = getTrackedRace();
|
||||
final ReplicablePolarService polarDataService;
|
||||
String polarDataBearerToken = System.getProperty("polardata.source.bearertoken");
|
||||
if (polarDataBearerToken == null) {
|
||||
logger.info("Couldn't find polardata.source.bearertoken system property, trying environment variable POLAR_DATA_BEARER_TOKEN");
|
||||
polarDataBearerToken = System.getenv("POLAR_DATA_BEARER_TOKEN");
|
||||
if (polarDataBearerToken == null) {
|
||||
logger.warning("Couldn't find POLAR_DATA_BEARER_TOKEN environment variable either, polar data service will not be available");
|
||||
} else {
|
||||
logger.info("Found POLAR_DATA_BEARER_TOKEN environment variable, length "+polarDataBearerToken.length()
|
||||
+"; polar data service will be available");
|
||||
}
|
||||
} else {
|
||||
logger.info("Found polardata.source.bearertoken system property, polar data service will be available");
|
||||
}
|
||||
final Optional<String> polardataBearerTokenOptional = Optional.ofNullable(polarDataBearerToken);
|
||||
if (polardataBearerTokenOptional.isPresent()) {
|
||||
polarDataService = new PolarDataServiceImpl();
|
||||
final com.sap.sailing.domain.tractracadapter.DomainFactory domainFactoryImpl = getDomainFactory();
|
||||
final DomainFactory baseDomainFactory = domainFactoryImpl.getBaseDomainFactory();
|
||||
polarDataService.registerDomainFactory(baseDomainFactory);
|
||||
new PolarDataClient(
|
||||
Optional.ofNullable(System.getenv("POLAR_DATA_BASE_URL")).orElse("https://sapsailing.com"),
|
||||
polarDataService, polardataBearerTokenOptional).updatePolarDataRegressions();
|
||||
} else {
|
||||
polarDataService = null;
|
||||
}
|
||||
final PolarDataService polarDataService = createPolarDataService();
|
||||
final IncrementalMstManeuverGraphGenerator generator = new IncrementalMstManeuverGraphGenerator(
|
||||
new CompleteManeuverCurveToManeuverForEstimationConverter(trackedRace, polarDataService),
|
||||
transitionProbabilitiesCalculator, maneuverClassifiersCache);
|
||||
|
||||
Reference in New Issue
Block a user