Skip to content

Commit 89a9b8b

Browse files
keep all tles
it is not clear when tle can't be downloaded, missing in the upstream or satellite decayed
1 parent 85ee66c commit 89a9b8b

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/main/java/ru/r2cloud/tle/TleDao.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ public Tle find(String id, String name) {
6363
}
6464

6565
private void index(Map<String, Tle> tleById) {
66-
cache.clear();
67-
cacheByName.clear();
6866
cache.putAll(tleById);
6967
for (Tle cur : tleById.values()) {
7068
cacheByName.put(cur.getRaw()[0], cur);

src/test/java/ru/r2cloud/tle/TleDaoTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package ru.r2cloud.tle;
22

33
import static org.junit.Assert.assertEquals;
4+
import static org.junit.Assert.assertNotNull;
45
import static org.junit.Assert.assertTrue;
56

67
import java.io.File;
@@ -31,6 +32,18 @@ public class TleDaoTest {
3132
private MockFileSystem fs;
3233
private String fileLocation;
3334

35+
@Test
36+
public void testAlwaysAddTle() {
37+
String satelliteId = UUID.randomUUID().toString();
38+
Map<String, Tle> tle = new HashMap<>();
39+
// TleDao doesn't verify Tle format
40+
tle.put(satelliteId, new Tle(new String[] { UUID.randomUUID().toString(), UUID.randomUUID().toString(), UUID.randomUUID().toString() }));
41+
dao.saveTle(tle, System.currentTimeMillis());
42+
dao.saveTle(new HashMap<>(), System.currentTimeMillis());
43+
assertEquals(1, dao.findAll().size());
44+
assertNotNull(dao.find(satelliteId, null));
45+
}
46+
3447
@Test
3548
public void testLoadEmpty() {
3649
Map<String, Tle> result = dao.findAll();

0 commit comments

Comments
 (0)