Reduced length of thunder tests
This commit is contained in:
parent
9777e5c5b1
commit
d6d41fccd3
3 changed files with 10 additions and 13 deletions
|
@ -15,9 +15,7 @@ public class BlitzortungTest {
|
|||
|
||||
ThunderProvider provider = new BlitzortungProvider();
|
||||
|
||||
provider.registerStrikeHandler(coordinates -> {
|
||||
coordinatesList.add(coordinates);
|
||||
});
|
||||
provider.registerStrikeHandler(coordinatesList::add);
|
||||
|
||||
provider.init();
|
||||
|
||||
|
@ -28,10 +26,10 @@ public class BlitzortungTest {
|
|||
int size = coordinatesList.size();
|
||||
if (size > 0)
|
||||
System.out.printf("Last from tick: %f %f (total %d)\n", coordinatesList.get(size-1).latitude, coordinatesList.get(size-1).longitude, size);
|
||||
Thread.sleep(100);
|
||||
Thread.sleep(25);
|
||||
}
|
||||
|
||||
System.out.printf("Strikes in the last 10s: %d\n", coordinatesList.size());
|
||||
System.out.printf("Strikes in the last 3s: %d\n", coordinatesList.size());
|
||||
System.out.printf("Latency: %dms\n", provider.getLatency());
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public class MockThunderProvider extends ThunderProvider {
|
|||
long now = System.currentTimeMillis();
|
||||
|
||||
for (int i=0; i<40; i++) {
|
||||
strikes.add(new TimedStrike(now + i * 100,
|
||||
strikes.add(new TimedStrike(now + i * 50,
|
||||
new Coordinates(
|
||||
rnd.nextDouble(-90, 90),
|
||||
rnd.nextDouble(-180, 180)
|
||||
|
@ -46,7 +46,7 @@ public class MockThunderProvider extends ThunderProvider {
|
|||
public void tick() {
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
while (strikes.size() > 0) {
|
||||
while (!strikes.isEmpty()) {
|
||||
TimedStrike str = strikes.get(0);
|
||||
if (now > str.timestamp) {
|
||||
System.out.printf("mock thunder given: %d\n", str.timestamp);
|
||||
|
|
|
@ -14,8 +14,7 @@ public class ThunderProviderTest {
|
|||
|
||||
ThunderProvider provider = new MockThunderProvider();
|
||||
|
||||
provider.registerStrikeHandler(coordinates ->
|
||||
coordinatesList.add(coordinates));
|
||||
provider.registerStrikeHandler(coordinatesList::add);
|
||||
|
||||
provider.init();
|
||||
|
||||
|
@ -26,14 +25,14 @@ public class ThunderProviderTest {
|
|||
int size = coordinatesList.size();
|
||||
if (size > 0)
|
||||
System.out.printf("Last from tick: %f %f (total %d)\n", coordinatesList.get(size-1).latitude, coordinatesList.get(size-1).longitude, size);
|
||||
Thread.sleep(50);
|
||||
Thread.sleep(20);
|
||||
}
|
||||
|
||||
provider.stop();
|
||||
|
||||
System.out.printf("Strikes in the last 2.5s: %d\n", coordinatesList.size());
|
||||
System.out.printf("Strikes in the last 1s: %d\n", coordinatesList.size());
|
||||
System.out.printf("Latency: %dms\n", provider.getLatency());
|
||||
|
||||
assert coordinatesList.size() == 25; // TODO this is time sensitive and fails under loaded system
|
||||
assert coordinatesList.size() == 20; // TODO this is time sensitive and fails under loaded system. Also, the entire test is suboptimal
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue