diff --git a/java/com.amazon.aws.aws-java-api/createLocalAwsApiP2Repository.sh b/java/com.amazon.aws.aws-java-api/createLocalAwsApiP2Repository.sh index 24eba4dcc3d..78f7383efc1 100755 --- a/java/com.amazon.aws.aws-java-api/createLocalAwsApiP2Repository.sh +++ b/java/com.amazon.aws.aws-java-api/createLocalAwsApiP2Repository.sh @@ -88,7 +88,7 @@ echo "Building the wrapper bundle..." cd .. echo "NOT USING ${extra} arguments for Maven to avoid using local target definition already for building local repo" echo "In folder $(pwd) using: mvn clean install" -mvn --batch-mode clean install +JAVA_HOME=${JAVA8_HOME} mvn --batch-mode clean install mkdir -p ${UPDATE_SITE_PROJECT}/plugins/aws-sdk rm -rf ${UPDATE_SITE_PROJECT}/plugins/aws-sdk/* # Note: the JAR ends up in target/ because the SDK project does not use any parent pom, so @@ -128,7 +128,7 @@ echo "Patching update site's site.xml..." sed -i -e 's/com.amazon.aws.aws-java-api\(\.source\)\?_\([0-9.]*\)\.jar/com.amazon.aws.aws-java-api\1_'${VERSION}'.jar/' -e '/feature url=/s/version="[0-9.]*"/version="'${VERSION}'"/' ${SITE_XML} echo "Building update site..." echo "In folder $(pwd) using: mvn ${extra} clean install" -mvn ${extra} clean install +JAVA_HOME=${JAVA8_HOME} mvn ${extra} clean install echo "Patching SDK version ${VERSION} in target platform definition ${TARGET_DEFINITION}..." sed -i -e 's///' ${TARGET_DEFINITION} echo "You may test your target platform locally by creating race-analysis-p2-local.target by running the script createLocalTargetDef.sh." diff --git a/java/com.sap.sailing.domain.persistence/src/com/sap/sailing/domain/persistence/racelog/tracking/impl/MongoSensorFixStoreImpl.java b/java/com.sap.sailing.domain.persistence/src/com/sap/sailing/domain/persistence/racelog/tracking/impl/MongoSensorFixStoreImpl.java index d5df4a7a074..67ca0615752 100644 --- a/java/com.sap.sailing.domain.persistence/src/com/sap/sailing/domain/persistence/racelog/tracking/impl/MongoSensorFixStoreImpl.java +++ b/java/com.sap.sailing.domain.persistence/src/com/sap/sailing/domain/persistence/racelog/tracking/impl/MongoSensorFixStoreImpl.java @@ -132,7 +132,8 @@ public class MongoSensorFixStoreImpl extends MongoFixHandler implements MongoSen public void loadFixes(Consumer consumer, DeviceIdentifier device, TimePoint from, TimePoint to, boolean inclusive, BooleanSupplier isPreemptiveStopped, Consumer progressConsumer) throws NoCorrespondingServiceRegisteredException, TransformationException { - loadFixes(consumer, device, from, to, inclusive, isPreemptiveStopped, progressConsumer, true, false); + loadFixes(consumer, device, from, to, inclusive, isPreemptiveStopped, progressConsumer, + /* ascending */ true, /* only one result */ false); } private boolean loadFixes(Consumer consumer, DeviceIdentifier device, TimePoint from, diff --git a/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/CourseChangeBasedTrackApproximationTest.java b/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/CourseChangeBasedTrackApproximationTest.java index fa9521ad0d0..516ff257b1e 100755 --- a/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/CourseChangeBasedTrackApproximationTest.java +++ b/java/com.sap.sailing.domain.test/src/com/sap/sailing/domain/test/CourseChangeBasedTrackApproximationTest.java @@ -4,6 +4,8 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; +import java.util.NoSuchElementException; + import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -40,6 +42,61 @@ public class CourseChangeBasedTrackApproximationTest { approximation = new CourseChangeBasedTrackApproximation(track, competitor.getBoat().getBoatClass(), /* logFixes */ false); } + /** + * Whitebox test for {@link FixWindow} and its queue: add a few fixes to the queue, then add a few significantly + * newer fixes to the queue that cause the older fixes to get added to the {@link FixWindow} one after the other. + * Then, add a fix immediately before the last that causes a direction change that exceeds the threshold and thus + * produces a maneuver candidate letting only the newest fix in FixWindow. Then, add another fix to the queue, + * causing the queue's oldest fix to get moved to the {@link FixWindow}, unless when trimming the + * {@link FixWindow} the queue would have been trimmed with it. If not, a {@link NoSuchElementException} + * would be thrown. + */ + @Test + public void testForcingFixOlderThanFixWindowIntoQueue() { + final GPSFixMoving fix1 = fix(10000l, 49, 8, 5, 4); + final double lastCOG = 30; + final GPSFixMoving fix2 = travel(fix1, 4000l, 5, lastCOG); + final GPSFixMoving fix3 = travel(fix2, 4000l, 5, lastCOG); + track.add(fix1); + track.add(fix2); + track.add(fix3); + // now add five newer fixes, forcing the five older fixes to advance into the FixWindow: + final GPSFixMoving fix6 = travel(fix1, track.getMillisecondsOverWhichToAverageSpeed()+1, 5, lastCOG); + final GPSFixMoving fix7 = travel(fix6, 4000l, 5, lastCOG); + final GPSFixMoving fix8 = travel(fix7, 4000l, 5, lastCOG); + track.add(fix6); + track.add(fix7); + track.add(fix8); + // we expect no maneuver to have been recognized yet + Iterable candidates = approximation.approximate(fix1.getTimePoint(), fix2.getTimePoint()); + assertTrue(Util.isEmpty(candidates)); + // now add a fix that, when added to FixWindow, will trigger a maneuver candidate emission + // because COG 0deg to COG 16deg is more than the 15deg threshold + // FIXME bug6222: the fix recognized as "maneuver fix" (the one with the greatest course change) must be after the early fix that remains in the queue! + // FIXME bug6222: This is only possible if the greatest change is not at the fix added late from the queue but from a later FixWindow fix + final GPSFixMoving fix1_5 = travel(fix1, 500l, 5, 8); + track.add(fix1_5); + // now add a fix to the queue that is later than the FixWindow's start (assumed to be at fix1) + // and before the FixWindow's end (assumed to be fix5 at the moment); the fix won't be added until + // a fix that is at least track.getMillisecondsOverWhichToAverageSpeed() newer is added to the queue: + final GPSFixMoving fix1_75 = travel(fix1_5, 250l, 5, 9); + track.add(fix1_75); + // force fix4_5 to get moved to FixWindow: + final GPSFixMoving fix9 = travel(fix8, 1000l, 5, lastCOG); + track.add(fix9); // expected to trigger moving oldest queued fix2_5 to get added to the FixWindow + // we expect one maneuver candidate to have been recognized now + Iterable candidates2 = approximation.approximate(fix1.getTimePoint(), fix3.getTimePoint()); + assertEquals(1, Util.size(candidates2)); + assertEquals(fix2.getTimePoint(), candidates2.iterator().next().getTimePoint()); + // and this should have spanned fix1..fix5 with the greatest course change on fix5, so that gets + // emitted as the maneuver candidate, and all fixes from FixWindow's head up to and including fix5 + // are expected to get removed from FixWindow + // Now add an ever newer fix to the queue, forcing fix3_5 to get added if it hasn't been cleaned up + // by the FixWindow trimming: + final GPSFixMoving fix10 = travel(fix9, 4000l, 5, 2); + track.add(fix10); + } + @Test public void simpleTackRecognition() { final GPSFixMoving start = fix(10000l, 0, 0, 5, 0); diff --git a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/impl/CourseChangeBasedTrackApproximation.java b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/impl/CourseChangeBasedTrackApproximation.java index d797a6d1dfe..8c1d9c0f65b 100755 --- a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/impl/CourseChangeBasedTrackApproximation.java +++ b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/impl/CourseChangeBasedTrackApproximation.java @@ -173,7 +173,7 @@ public class CourseChangeBasedTrackApproximation implements Serializable, GPSTra *

* * This method queues the new fix and only adds it to the window when it is "old enough" to not be influenced - * anymore by newer fixes that may still arrive. The influence is measured by half the + * anymore by newer fixes that may still arrive. The influence is measured by the * {@link GPSFixTrack#getMillisecondsOverWhichToAverageSpeed()} interval. This way, approximation results * are more stable but have a delay with regards to the newest fixes known by the track.

* @@ -280,6 +280,12 @@ public class CourseChangeBasedTrackApproximation implements Serializable, GPSTra courseChangeBetweenFixesInWindow.add(new ScalableDouble(courseChangeBetweenPreviousAndNextInDegrees)); } else { courseChangeBetweenFixesInWindow.add(insertPosition-1, new ScalableDouble(courseChangeBetweenPreviousAndNextInDegrees)); + if (courseChangeBetweenFixesInWindow.size() > insertPosition) { // the node just added isn't the last one; update the next node! + courseChangeBetweenFixesInWindow.remove(insertPosition); + final SpeedWithBearing nextNextSpeed = this.speedForFixesInWindow.get(insertPosition+1); + final double courseChangeBetweenNextAndNextNextInDegrees = nextSpeed.getBearing().getDifferenceTo(nextNextSpeed.getBearing()).getDegrees(); + courseChangeBetweenFixesInWindow.add(insertPosition, new ScalableDouble(courseChangeBetweenNextAndNextNextInDegrees)); + } } if (windowDuration.compareTo(getMaximumWindowLength()) > 0) { result = tryToExtractManeuverCandidate(); @@ -360,15 +366,35 @@ public class CourseChangeBasedTrackApproximation implements Serializable, GPSTra */ private void removeFirst(int howManyElementsToRemove) { assert !window.isEmpty(); + final int oldSize = window.size(); for (int i=0; i= maximumCourseChangeToPort ? 1 : -1); if (absoluteCourseChangeInDegrees > maximumAbsoluteCourseChangeInCorrectDirection) { maximumAbsoluteCourseChangeInCorrectDirection = absoluteCourseChangeInDegrees; - indexOfMaximumAbsoluteCourseChangeInCorrectDirection = i; + indexOfMaximumAbsoluteCourseChangeInCorrectDirection = i+1; // the course change is to the next fix in window } i++; } @@ -414,6 +440,7 @@ public class CourseChangeBasedTrackApproximation implements Serializable, GPSTra } else { result = null; } + assert indexOfMaximumAbsoluteCourseChangeInCorrectDirection < window.size(); return result == null ? null : new Pair<>(result, indexOfMaximumAbsoluteCourseChangeInCorrectDirection); } diff --git a/java/com.sap.sailing.targetplatform.base/features/target-base/feature.xml b/java/com.sap.sailing.targetplatform.base/features/target-base/feature.xml index 6b6964b31ed..da1890f4ba6 100755 --- a/java/com.sap.sailing.targetplatform.base/features/target-base/feature.xml +++ b/java/com.sap.sailing.targetplatform.base/features/target-base/feature.xml @@ -282,28 +282,28 @@ id="org.eclipse.jetty.apache-jsp" download-size="0" install-size="0" - version="9.4.57.v20241219" + version="9.4.58.v20250814" unpack="false"/> - - - + + + diff --git a/java/com.sap.sailing.targetplatform/scripts/createAndUploadJettyP2Repository.sh b/java/com.sap.sailing.targetplatform/scripts/createAndUploadJettyP2Repository.sh index a15563c99ae..54586f416ce 100755 --- a/java/com.sap.sailing.targetplatform/scripts/createAndUploadJettyP2Repository.sh +++ b/java/com.sap.sailing.targetplatform/scripts/createAndUploadJettyP2Repository.sh @@ -1,4 +1,6 @@ #!/bin/bash +# Fetches the latest Jetty 9.4 version from the official Jetty p2 repository, uploads it to sapsailing.com and updates all references in the workspace. +# Specific components such as apache-jsp and jetty-osgi-boot-jsp are updated to the new version, too, but not from the p2 repo but directly from Maven Central, as the p2 repo does not contain the source bundles. VERSION=$( curl https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/ | grep "/jetty/updates/jetty-bundles-9.x" | sed -e 's/^.*> \?\(9\.4\.[0-9]*\.v[0-9]*\)<.*$/\1/' ) echo "Found version ${VERSION}" P2_URL="https://download.eclipse.org/jetty/updates/jetty-bundles-9.x/${VERSION}/" diff --git a/java/com.sap.sse.feature.runtime/feature.xml b/java/com.sap.sse.feature.runtime/feature.xml index c503ed25dac..6fac9f9ae2a 100644 --- a/java/com.sap.sse.feature.runtime/feature.xml +++ b/java/com.sap.sse.feature.runtime/feature.xml @@ -63,14 +63,14 @@ id="org.eclipse.jetty.osgi.boot" download-size="0" install-size="0" - version="9.4.57.v20241219" + version="9.4.58.v20250814" unpack="false"/> @@ -895,7 +895,7 @@ id="org.eclipse.jetty.osgi.boot.jsp.source" download-size="0" install-size="0" - version="9.4.57.v20241219" + version="9.4.58.v20250814" unpack="false"/>