| | |
| | | } |
| | | |
| | | @Test |
| | | void doesNotOverwriteDamagedEmbeddedHistoryBeforeValidation() |
| | | void clearsLegacyEmbeddedHistoryForDemoStartup() throws Exception |
| | | { |
| | | AtomicReference<Object> stored = new AtomicReference<>("{\"version\":1,\"devices\":[]," |
| | | + "\"collectors\":[{\"collectorId\":1,\"deviceCode\":\"dev-sim-collector-1\"," |
| | |
| | | + "\"historyFaults\":{\"missingSequences\":[],\"outOfOrder\":false}}]," |
| | | + "\"nextDeviceId\":1,\"nextCollectorId\":2,\"tombstones\":[]}"); |
| | | |
| | | assertThrows(IllegalStateException.class, |
| | | () -> new BtsDevelopmentSimulator(0, store(stored))); |
| | | |
| | | assertEquals(true, stored.get().toString().contains("\"history\":[{")); |
| | | try (BtsDevelopmentSimulator simulator = new BtsDevelopmentSimulator(0, store(stored))) |
| | | { |
| | | assertEquals(0L, simulator.snapshot().collectors().get(0).historyRecordCount()); |
| | | } |
| | | assertEquals(false, stored.get().toString().contains("\"history\":[{")); |
| | | } |
| | | |
| | | @Test |