2121 */
2222package com .influxdb .client ;
2323
24+ import javax .annotation .Nonnull ;
25+ import java .io .IOException ;
26+ import java .net .InetSocketAddress ;
27+ import java .net .Proxy ;
28+ import java .util .List ;
29+ import java .util .Objects ;
30+ import java .util .logging .Level ;
31+ import java .util .logging .LogRecord ;
32+ import java .util .logging .Logger ;
2433import com .influxdb .LogLevel ;
25- import com .influxdb .client .domain .*;
34+ import com .influxdb .client .domain .Authorization ;
35+ import com .influxdb .client .domain .InfluxQLQuery ;
36+ import com .influxdb .client .domain .Run ;
37+ import com .influxdb .client .domain .WriteConsistency ;
38+ import com .influxdb .client .domain .WritePrecision ;
2639import com .influxdb .client .internal .AbstractInfluxDBClientTest ;
2740import com .influxdb .client .service .InfluxQLQueryService ;
28- import okhttp3 .*;
41+ import okhttp3 .HttpUrl ;
42+ import okhttp3 .Interceptor ;
43+ import okhttp3 .OkHttpClient ;
44+ import okhttp3 .Request ;
45+ import okhttp3 .Response ;
46+ import okhttp3 .ResponseBody ;
2947import okhttp3 .mockwebserver .Dispatcher ;
3048import okhttp3 .mockwebserver .MockResponse ;
3149import okhttp3 .mockwebserver .MockWebServer ;
3452import org .junit .jupiter .api .Test ;
3553import retrofit2 .Call ;
3654
37- import javax .annotation .Nonnull ;
38- import java .io .IOException ;
39- import java .net .InetSocketAddress ;
40- import java .net .Proxy ;
41- import java .util .List ;
42- import java .util .Objects ;
43- import java .util .logging .Level ;
44- import java .util .logging .LogRecord ;
45- import java .util .logging .Logger ;
46-
4755/**
4856 * @author Jakub Bednar (bednar@github) (05/09/2018 14:00)
4957 */
@@ -115,21 +123,21 @@ public void createNotificationRulesApi() {
115123 public void serviceHeaderDefault () {
116124 InfluxQLQueryService service = influxDBClient .getService (InfluxQLQueryService .class );
117125 Call <ResponseBody > call = service .query ("SELECT * FROM cpu" , "test_db" ,
118- null ,
119- null ,
120- null ,
121- InfluxQLQuery .AcceptHeader .JSON .getVal ());
126+ null ,
127+ null ,
128+ null ,
129+ InfluxQLQuery .AcceptHeader .JSON .getVal ());
122130 Assertions .assertThat (call .request ().header ("Accept" )).isEqualTo ("application/json" );
123131 }
124132
125133 @ Test
126134 public void serviceHeaderChange () {
127135 InfluxQLQueryService service = influxDBClient .getService (InfluxQLQueryService .class );
128136 Call <ResponseBody > call = service .query ("SELECT * FROM cpu" , "test_db" ,
129- null ,
130- null ,
131- null ,
132- InfluxQLQuery .AcceptHeader .CSV .getVal ());
137+ null ,
138+ null ,
139+ null ,
140+ InfluxQLQuery .AcceptHeader .CSV .getVal ());
133141 Assertions .assertThat (call .request ().header ("accept" )).isEqualTo ("application/csv" );
134142 }
135143
@@ -206,7 +214,8 @@ void parseUnknownEnumAsNull() {
206214
207215 @ Test
208216 void parseDateTime () {
209- mockServer .enqueue (new MockResponse ().setBody ("{\" id\" :\" runID\" ,\" taskID\" :\" taskID\" ,\" startedAt\" :\" 2019-03-11T11:57:30.830995162Z\" }" ));
217+ mockServer .enqueue (new MockResponse ().setBody (
218+ "{\" id\" :\" runID\" ,\" taskID\" :\" taskID\" ,\" startedAt\" :\" 2019-03-11T11:57:30.830995162Z\" }" ));
210219
211220 Run run = influxDBClient .getTasksApi ().getRun ("taskID" , "runID" );
212221
@@ -230,19 +239,23 @@ public void trailingSlashInUrl() throws InterruptedException {
230239 InfluxDBClient influxDBClient = InfluxDBClientFactory
231240 .create (path , "my-token" .toCharArray ());
232241
233- influxDBClient .getWriteApiBlocking ().writeRecord ("my-bucket" , "my-org" , WritePrecision .NS , "record,tag=a value=1" );
242+ influxDBClient .getWriteApiBlocking ()
243+ .writeRecord ("my-bucket" , "my-org" , WritePrecision .NS , "record,tag=a value=1" );
234244
235245 RecordedRequest request = mockServer .takeRequest ();
236- Assertions .assertThat (request .getRequestUrl ().toString ()).isEqualTo (path + "api/v2/write?org=my-org&bucket=my-bucket&precision=ns" );
246+ Assertions .assertThat (request .getRequestUrl ().toString ())
247+ .isEqualTo (path + "api/v2/write?org=my-org&bucket=my-bucket&precision=ns" );
237248 influxDBClient .close ();
238249
239250 influxDBClient = InfluxDBClientFactory
240251 .create (path .substring (0 , path .length () - 1 ), "my-token" .toCharArray ());
241252
242- influxDBClient .getWriteApiBlocking ().writeRecord ("my-bucket" , "my-org" , WritePrecision .NS , "record,tag=a value=1" );
253+ influxDBClient .getWriteApiBlocking ()
254+ .writeRecord ("my-bucket" , "my-org" , WritePrecision .NS , "record,tag=a value=1" );
243255
244256 request = mockServer .takeRequest ();
245- Assertions .assertThat (request .getRequestUrl ().toString ()).isEqualTo (path + "api/v2/write?org=my-org&bucket=my-bucket&precision=ns" );
257+ Assertions .assertThat (request .getRequestUrl ().toString ())
258+ .isEqualTo (path + "api/v2/write?org=my-org&bucket=my-bucket&precision=ns" );
246259 influxDBClient .close ();
247260 }
248261
@@ -262,9 +275,11 @@ void customPath() throws InterruptedException {
262275 // http://localhost:8086 -> http://localhost:8086/api/v2/query
263276 {serverURL , serverURL + "/api/v2/query" },
264277 // http://localhost:8086?readTimeout=1000&writeTimeout=3000&connectTimeout=2000&logLevel=HEADERS" -> http://localhost:8086/api/v2/query
265- {serverURL + "?readTimeout=1000&writeTimeout=3000&connectTimeout=2000&logLevel=HEADERS" , serverURL + "/api/v2/query" },
278+ {serverURL + "?readTimeout=1000&writeTimeout=3000&connectTimeout=2000&logLevel=HEADERS" ,
279+ serverURL + "/api/v2/query" },
266280 // http://localhost:8086/influx?readTimeout=1000&writeTimeout=3000&connectTimeout=2000&logLevel=HEADERS" -> http://localhost:8086/influx/api/v2/query
267- {serverURL + "/influx?readTimeout=1000&writeTimeout=3000&connectTimeout=2000&logLevel=HEADERS" , serverURL + "/influx/api/v2/query" }
281+ {serverURL + "/influx?readTimeout=1000&writeTimeout=3000&connectTimeout=2000&logLevel=HEADERS" ,
282+ serverURL + "/influx/api/v2/query" }
268283 };
269284
270285 for (String [] connectionString : connectionStrings ) {
@@ -409,14 +424,14 @@ public void connectionStringPrecision() {
409424 InfluxDBClientOptions options = InfluxDBClientOptions .builder ()
410425 .connectionString ("https://us-west-2-1.aws.cloud2.influxdata.com?precision=US" )
411426 .build ();
412-
427+
413428 Assertions .assertThat (options .getPrecision ()).isEqualTo (WritePrecision .US );
414429 }
415430
416431 @ Test
417432 public void propertiesPrecision () {
418433 InfluxDBClientOptions options = InfluxDBClientOptions .builder ().loadProperties ().build ();
419-
434+
420435 Assertions .assertThat (options .getPrecision ()).isEqualTo (WritePrecision .US );
421436 }
422437
@@ -453,7 +468,8 @@ public void customClientType() throws InterruptedException {
453468 .writeRecord ("my-bucket" , "my-org" , WritePrecision .NS , "record,tag=a value=1" );
454469
455470 RecordedRequest request = mockServer .takeRequest ();
456- Assertions .assertThat (request .getHeaders ().get ("User-Agent" )).startsWith ("influxdb-client-awesome-service/" );
471+ Assertions .assertThat (request .getHeaders ().get ("User-Agent" ))
472+ .startsWith ("influxdb-client-awesome-service/" );
457473 }
458474 }
459475
@@ -467,7 +483,8 @@ public void redactedAuthorizationHeader() {
467483 final Logger logger = Logger .getLogger ("okhttp3.OkHttpClient" );
468484 logger .addHandler (handler );
469485
470- try (InfluxDBClient client = InfluxDBClientFactory .create (mockServer .url ("/" ).toString (), "my-token" .toCharArray ())) {
486+ try (InfluxDBClient client = InfluxDBClientFactory .create (mockServer .url ("/" ).toString (),
487+ "my-token" .toCharArray ())) {
471488 client .setLogLevel (LogLevel .HEADERS );
472489 client
473490 .getWriteApiBlocking ()
0 commit comments