|
1 | 1 | package org.influxdb;
|
2 | 2 |
|
3 |
| -import java.util.Collections; |
| 3 | +import okhttp3.OkHttpClient; |
4 | 4 | import org.influxdb.InfluxDB.LogLevel;
|
5 | 5 | import org.influxdb.InfluxDB.ResponseFormat;
|
6 |
| -import org.influxdb.dto.BatchPoints; |
| 6 | +import org.influxdb.dto.*; |
7 | 7 | import org.influxdb.dto.BoundParameterQuery.QueryBuilder;
|
8 |
| -import org.influxdb.dto.Point; |
9 |
| -import org.influxdb.dto.Pong; |
10 |
| -import org.influxdb.dto.Query; |
11 |
| -import org.influxdb.dto.QueryResult; |
12 | 8 | import org.influxdb.dto.QueryResult.Series;
|
13 | 9 | import org.influxdb.impl.InfluxDBImpl;
|
14 | 10 | import org.junit.jupiter.api.AfterEach;
|
|
19 | 15 | import org.junit.platform.runner.JUnitPlatform;
|
20 | 16 | import org.junit.runner.RunWith;
|
21 | 17 |
|
22 |
| -import okhttp3.OkHttpClient; |
23 |
| - |
24 | 18 | import java.io.IOException;
|
25 | 19 | import java.net.ConnectException;
|
26 | 20 | import java.time.Instant;
|
27 | 21 | import java.time.ZoneId;
|
28 | 22 | import java.time.format.DateTimeFormatter;
|
29 |
| -import java.util.ArrayList; |
30 |
| -import java.util.Arrays; |
31 |
| -import java.util.List; |
32 |
| -import java.util.Set; |
33 |
| -import java.util.concurrent.BlockingQueue; |
34 |
| -import java.util.concurrent.Callable; |
35 |
| -import java.util.concurrent.CountDownLatch; |
36 |
| -import java.util.concurrent.ExecutorService; |
37 |
| -import java.util.concurrent.Executors; |
38 |
| -import java.util.concurrent.LinkedBlockingQueue; |
39 |
| -import java.util.concurrent.ThreadFactory; |
40 |
| -import java.util.concurrent.TimeUnit; |
| 23 | +import java.util.*; |
| 24 | +import java.util.concurrent.*; |
41 | 25 | import java.util.concurrent.atomic.LongAdder;
|
42 | 26 | import java.util.function.Consumer;
|
43 | 27 |
|
@@ -194,6 +178,20 @@ public void accept(QueryResult queryResult) {
|
194 | 178 | result.result();
|
195 | 179 | }
|
196 | 180 |
|
| 181 | + /** |
| 182 | + * Tests for callback query with a failure. |
| 183 | + * see Issue #602 |
| 184 | + */ |
| 185 | + @Test |
| 186 | + public void testCallbackQueryFailureHandling() { |
| 187 | + final AsyncResult<QueryResult> res = new AsyncResult<>(); |
| 188 | + |
| 189 | + this.influxDB.query(new Query("SHOW SERRIES"), res.resultConsumer, res.errorConsumer); |
| 190 | + |
| 191 | + Assertions.assertThrows(InfluxDBException.class, res::result, |
| 192 | + "Malformed query should throw InfluxDBException"); |
| 193 | + } |
| 194 | + |
197 | 195 | /**
|
198 | 196 | * Test that describe Databases works.
|
199 | 197 | */
|
|
0 commit comments