diff --git a/java/com.sap.sailing.declination/src/com/sap/sailing/declination/impl/DeclinationImporter.java b/java/com.sap.sailing.declination/src/com/sap/sailing/declination/impl/DeclinationImporter.java index db6b08d244f..c7d978fc894 100644 --- a/java/com.sap.sailing.declination/src/com/sap/sailing/declination/impl/DeclinationImporter.java +++ b/java/com.sap.sailing.declination/src/com/sap/sailing/declination/impl/DeclinationImporter.java @@ -44,7 +44,7 @@ public abstract class DeclinationImporter { result.notifyAll(); } } catch (IOException | ParserConfigurationException | SAXException e) { - logger.log(Level.FINE, "Exception while trying to load magnetic declination online", e); + logger.log(Level.INFO, "Exception while trying to load magnetic declination online", e); synchronized (result) { result.notifyAll(); // wake up waiter; no result will show up anymore } diff --git a/java/com.sap.sailing.expeditionconnector.test/src/com/sap/sailing/expeditionconnector/test/UDPExpeditionReceiverTest.java b/java/com.sap.sailing.expeditionconnector.test/src/com/sap/sailing/expeditionconnector/test/UDPExpeditionReceiverTest.java index 31d9a4ffa43..582e94ac147 100755 --- a/java/com.sap.sailing.expeditionconnector.test/src/com/sap/sailing/expeditionconnector/test/UDPExpeditionReceiverTest.java +++ b/java/com.sap.sailing.expeditionconnector.test/src/com/sap/sailing/expeditionconnector/test/UDPExpeditionReceiverTest.java @@ -76,8 +76,8 @@ public class UDPExpeditionReceiverTest { private String[] validLines; private String[] someValidWithFourInvalidLines; - final List messages = new ArrayList(); - final int PORT = 9876; + private final List messages = new ArrayList(); + private final int PORT = 9929; private DatagramPacket packet; private DatagramSocket socket; private byte[] buf; @@ -447,17 +447,20 @@ public class UDPExpeditionReceiverTest { String[] lines = new String[validLines.length+1]; lines[0] = "#0,1,7.900,2,-42.0,3,25.90,9,323.0,13,326.0,48,54.511867,49,10.152700,50,340.3,146,40348.578310*25"; System.arraycopy(validLines, 0, lines, 1, validLines.length); - // ensure declination service has 2011 loaded (which takes a few seconds) + // ensure declination service has 2010 and 2011 loaded (which takes a few seconds) + declinationService.getDeclination( + new MillisecondsTimePoint(new SimpleDateFormat("yyyy-MM-dd").parse("2010-07-01").getTime()), + new DegreePosition(54, 9), /* timeoutForOnlineFetchInMilliseconds */10000); declinationService.getDeclination( new MillisecondsTimePoint(new SimpleDateFormat("yyyy-MM-dd").parse("2011-07-01").getTime()), - new DegreePosition(54, 9), /* timeoutForOnlineFetchInMilliseconds */3000); + new DegreePosition(54, 9), /* timeoutForOnlineFetchInMilliseconds */10000); sendAndWaitABit(lines); Thread.sleep(3000); // wait until at least the declination was received assertEquals(lines.length, messages.size()); // note that the tracks are ordered by timestamps; however, not all Expedition messages have an original timestamp. // So, some of them are timestamped with "now" which shuffles ordering. We keep track of the matched wind fixes in // a map - Set matched = new HashSet(); + final Set matched = new HashSet<>(); // now assert that wind bearings have undergone declination correction Position lastKnownPosition = null; for (ExpeditionMessage m : messages) { @@ -466,13 +469,13 @@ public class UDPExpeditionReceiverTest { } if (m.getTrueWind() != null) { Declination declination = declinationService.getDeclination(m.getTimePoint(), lastKnownPosition, - /* timeoutForOnlineFetchInMilliseconds */5000); + /* timeoutForOnlineFetchInMilliseconds */10000); race.getWindTrack().lockForRead(); try { for (Wind recordedWind : race.getWindTrack().getRawFixes()) { if (Math.abs(m.getTrueWindBearing().getDegrees() + declination.getBearingCorrectedTo(m.getTimePoint()).getDegrees() - - recordedWind.getBearing().getDegrees()) <= 0.0000001) { + - recordedWind.getBearing().getDegrees()) <= 0.01) { // not more precise due to the use of VeryCompactWindFix in wind track matched.add(recordedWind); break; }