2121 */
2222package com .influxdb .v3 .client .integration ;
2323
24+ import com .influxdb .v3 .client .InfluxDBClient ;
25+ import com .influxdb .v3 .client .Point ;
26+ import com .influxdb .v3 .client .PointValues ;
27+ import com .influxdb .v3 .client .config .ClientConfig ;
28+ import com .influxdb .v3 .client .query .QueryOptions ;
29+ import com .influxdb .v3 .client .write .WriteOptions ;
30+ import com .influxdb .v3 .client .write .WritePrecision ;
31+ import org .apache .arrow .flight .FlightRuntimeException ;
32+ import org .assertj .core .api .Assertions ;
33+ import org .junit .jupiter .api .Test ;
34+ import org .junit .jupiter .api .condition .EnabledIfEnvironmentVariable ;
35+
36+ import javax .annotation .Nonnull ;
37+ import javax .net .ssl .SSLException ;
2438import java .math .BigInteger ;
2539import java .net .ConnectException ;
2640import java .net .URISyntaxException ;
3549import java .util .logging .Logger ;
3650import java .util .stream .Collectors ;
3751import java .util .stream .Stream ;
38- import javax .annotation .Nonnull ;
39- import javax .net .ssl .SSLException ;
40-
41- import io .netty .handler .proxy .HttpProxyHandler ;
42- import org .apache .arrow .flight .FlightRuntimeException ;
43- import org .assertj .core .api .Assertions ;
44- import org .junit .jupiter .api .Test ;
45- import org .junit .jupiter .api .condition .EnabledIfEnvironmentVariable ;
46-
47- import com .influxdb .v3 .client .InfluxDBClient ;
48- import com .influxdb .v3 .client .Point ;
49- import com .influxdb .v3 .client .PointValues ;
50- import com .influxdb .v3 .client .config .ClientConfig ;
51- import com .influxdb .v3 .client .query .QueryOptions ;
52- import com .influxdb .v3 .client .write .WriteOptions ;
53- import com .influxdb .v3 .client .write .WritePrecision ;
5452
5553import static org .junit .jupiter .api .Assumptions .assumeFalse ;
5654
@@ -85,20 +83,16 @@ void testQueryWithProxy() throws URISyntaxException, SSLException {
8583 .proxyUrl (proxyUrl )
8684 .build ();
8785
88- var testId = UUID .randomUUID ().toString ();
8986 InfluxDBClient influxDBClient = InfluxDBClient .getInstance (clientConfig );
9087 influxDBClient .writePoint (
91- Point .measurement ("test5" )
92- .setTag ("tag" , "tagValue1" )
88+ Point .measurement ("test1" )
9389 .setField ("field" , "field1" )
94- .setField ("testId" , testId )
9590 );
9691
97- String query = String .format ("SELECT * FROM \" test5\" WHERE \" testId\" = '%s'" , testId );
98- try (Stream <PointValues > stream = influxDBClient .queryPoints (query )) {
92+ try (Stream <PointValues > stream = influxDBClient .queryPoints ("SELECT * FROM test1" )) {
9993 stream .findFirst ()
10094 .ifPresent (pointValues -> {
101- Assertions .assertThat (pointValues .getField ("testId " )).isEqualTo (testId );
95+ Assertions .assertThat (pointValues .getField ("field " )).isEqualTo ("field1" );
10296 });
10397 }
10498 }
@@ -401,27 +395,27 @@ public void testNoAllocatorMemoryLeak() {
401395 Assertions .assertThatNoException ().isThrownBy (() -> {
402396
403397 try (InfluxDBClient client = InfluxDBClient .getInstance (
404- System .getenv ("TESTING_INFLUXDB_URL" ),
405- System .getenv ("TESTING_INFLUXDB_TOKEN" ).toCharArray (),
406- System .getenv ("TESTING_INFLUXDB_DATABASE" ),
407- null )) {
398+ System .getenv ("TESTING_INFLUXDB_URL" ),
399+ System .getenv ("TESTING_INFLUXDB_TOKEN" ).toCharArray (),
400+ System .getenv ("TESTING_INFLUXDB_DATABASE" ),
401+ null )) {
408402
409403 List <Point > points = List .of (
410- Point .measurement (measurement )
411- .setTag ("type" , "test" )
412- .setFloatField ("rads" , 3.14 )
413- .setIntegerField ("life" , 42 )
414- .setTimestamp (now .minus (2 , ChronoUnit .SECONDS )),
415- Point .measurement (measurement )
416- .setTag ("type" , "test" )
417- .setFloatField ("rads" , 3.14 )
418- .setIntegerField ("life" , 42 )
419- .setTimestamp (now .minus (1 , ChronoUnit .SECONDS )),
420- Point .measurement (measurement )
421- .setTag ("type" , "test" )
422- .setFloatField ("rads" , 3.14 )
423- .setIntegerField ("life" , 42 )
424- .setTimestamp (now ));
404+ Point .measurement (measurement )
405+ .setTag ("type" , "test" )
406+ .setFloatField ("rads" , 3.14 )
407+ .setIntegerField ("life" , 42 )
408+ .setTimestamp (now .minus (2 , ChronoUnit .SECONDS )),
409+ Point .measurement (measurement )
410+ .setTag ("type" , "test" )
411+ .setFloatField ("rads" , 3.14 )
412+ .setIntegerField ("life" , 42 )
413+ .setTimestamp (now .minus (1 , ChronoUnit .SECONDS )),
414+ Point .measurement (measurement )
415+ .setTag ("type" , "test" )
416+ .setFloatField ("rads" , 3.14 )
417+ .setIntegerField ("life" , 42 )
418+ .setTimestamp (now ));
425419
426420 client .writePoints (points );
427421 String query = "SELECT * FROM " + measurement ;
@@ -433,10 +427,10 @@ public void testNoAllocatorMemoryLeak() {
433427 // Test to ensure FlightStream was closed even though two more records
434428 // remain in the stream
435429 stream .findFirst ()
436- .ifPresent (pointValues -> {
437- Assertions .assertThat (pointValues .getField ("life" )).isEqualTo (42L );
438- Assertions .assertThat (pointValues .getField ("rads" )).isEqualTo (3.14 );
439- });
430+ .ifPresent (pointValues -> {
431+ Assertions .assertThat (pointValues .getField ("life" )).isEqualTo (42L );
432+ Assertions .assertThat (pointValues .getField ("rads" )).isEqualTo (3.14 );
433+ });
440434 }
441435 }
442436 });
@@ -487,8 +481,11 @@ public void testMultipleQueries() throws Exception {
487481 }
488482 }
489483 }
484+
485+
490486 }
491487
488+
492489 private void assertGetDataSuccess (@ Nonnull final InfluxDBClient influxDBClient ) {
493490 influxDBClient .writePoint (
494491 Point .measurement ("test1" )
0 commit comments