From e545d05c170c955446f682e6086ffa7ad09a2062 Mon Sep 17 00:00:00 2001 From: dernasherbrezon Date: Mon, 18 Nov 2024 11:50:10 +0000 Subject: [PATCH] load last update time from disk if any --- src/main/java/ru/r2cloud/satellite/SatelliteDao.java | 4 +++- src/test/java/ru/r2cloud/it/util/BaseTest.java | 6 ------ src/test/resources/satellites-test.json | 3 ++- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main/java/ru/r2cloud/satellite/SatelliteDao.java b/src/main/java/ru/r2cloud/satellite/SatelliteDao.java index 3fdf8fd9..2e62d409 100644 --- a/src/main/java/ru/r2cloud/satellite/SatelliteDao.java +++ b/src/main/java/ru/r2cloud/satellite/SatelliteDao.java @@ -256,7 +256,9 @@ private static List loadFromConfig(Path metaLocation, SatelliteSource continue; } cur.setSource(source); - cur.setLastUpdateTime(lastUpdateTime); + if (cur.getLastUpdateTime() == 0) { + cur.setLastUpdateTime(lastUpdateTime); + } result.add(cur); } return result; diff --git a/src/test/java/ru/r2cloud/it/util/BaseTest.java b/src/test/java/ru/r2cloud/it/util/BaseTest.java index 1e601cec..fbe56265 100644 --- a/src/test/java/ru/r2cloud/it/util/BaseTest.java +++ b/src/test/java/ru/r2cloud/it/util/BaseTest.java @@ -14,13 +14,9 @@ import java.net.InetSocketAddress; import java.net.http.HttpResponse; import java.nio.file.FileSystems; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.attribute.FileTime; import java.util.Properties; import java.util.Random; import java.util.UUID; -import java.util.concurrent.TimeUnit; import java.util.logging.LogManager; import org.junit.After; @@ -176,8 +172,6 @@ protected Configuration prepareConfiguration() throws IOException { w.append("ittests"); } config.setProperty("server.keyword.location", setupKeyword.getAbsolutePath()); - Path p = config.getPathFromProperty("satellites.meta.location"); - Files.setLastModifiedTime(p, FileTime.from(1719525695573L, TimeUnit.MILLISECONDS)); return config; } diff --git a/src/test/resources/satellites-test.json b/src/test/resources/satellites-test.json index 65fd6ad6..f13420d7 100644 --- a/src/test/resources/satellites-test.json +++ b/src/test/resources/satellites-test.json @@ -1490,7 +1490,8 @@ "frequency": 137620000, "bandwidth": 34000 } - ] + ], + "lastUpdateTime": 1719525695573 }, { "name": "SWAMPSAT-2",