()
| 257 | } |
| 258 | |
| 259 | @Test |
| 260 | public void executedTwice() throws Exception { |
| 261 | final TSQuery query = new TSQuery(); |
| 262 | query.setStart("1h-ago"); |
| 263 | QueryStats stats = new QueryStats(remote, query, headers); |
| 264 | stats.markSerialized(HttpResponseStatus.REQUEST_TIMEOUT, null); |
| 265 | Map<String, Object> map = QueryStats.getRunningAndCompleteStats(); |
| 266 | assertNotNull(map); |
| 267 | assertEquals(0, ((List<Object>)map.get("running")).size()); |
| 268 | assertEquals(1, ((Collection<QueryStats>)map.get("completed")).size()); |
| 269 | QueryStats completed = ((Collection<QueryStats>)map.get("completed")) |
| 270 | .iterator().next(); |
| 271 | assertEquals(1, completed.getExecuted()); |
| 272 | |
| 273 | stats = new QueryStats(remote, query, headers); |
| 274 | stats.markSerialized(HttpResponseStatus.REQUEST_TIMEOUT, null); |
| 275 | map = QueryStats.getRunningAndCompleteStats(); |
| 276 | assertNotNull(map); |
| 277 | assertEquals(0, ((List<Object>)map.get("running")).size()); |
| 278 | assertEquals(1, ((Collection<QueryStats>)map.get("completed")).size()); |
| 279 | completed = ((Collection<QueryStats>)map.get("completed")) |
| 280 | .iterator().next(); |
| 281 | assertEquals(2, completed.getExecuted()); |
| 282 | } |
| 283 | |
| 284 | @Test |
| 285 | public void getStat() throws Exception { |
nothing calls this directly
no test coverage detected