Skip to content

Commit 7e24523

Browse files
author
Maximilian Hippler
committed
Added test for Issue #602
1 parent 3169621 commit 7e24523

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

src/test/java/org/influxdb/InfluxDBTest.java

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
package org.influxdb;
22

3-
import java.util.Collections;
3+
import okhttp3.OkHttpClient;
44
import org.influxdb.InfluxDB.LogLevel;
55
import org.influxdb.InfluxDB.ResponseFormat;
6-
import org.influxdb.dto.BatchPoints;
6+
import org.influxdb.dto.*;
77
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;
128
import org.influxdb.dto.QueryResult.Series;
139
import org.influxdb.impl.InfluxDBImpl;
1410
import org.junit.jupiter.api.AfterEach;
@@ -19,25 +15,13 @@
1915
import org.junit.platform.runner.JUnitPlatform;
2016
import org.junit.runner.RunWith;
2117

22-
import okhttp3.OkHttpClient;
23-
2418
import java.io.IOException;
2519
import java.net.ConnectException;
2620
import java.time.Instant;
2721
import java.time.ZoneId;
2822
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.*;
4125
import java.util.concurrent.atomic.LongAdder;
4226
import java.util.function.Consumer;
4327

@@ -194,6 +178,20 @@ public void accept(QueryResult queryResult) {
194178
result.result();
195179
}
196180

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+
197195
/**
198196
* Test that describe Databases works.
199197
*/

0 commit comments

Comments
 (0)