@Test void loadFromProperties() throws NoSuchFieldException, IllegalAccessException { InfluxDBClient influxDBClient = InfluxDBClientFactory.create(); InfluxDBClientOptions options = getDeclaredField(influxDBClient, "options", AbstractInfluxDBClient.class); Assertions.assertThat(options.getUrl()).isEqualTo("http: Assertions.assertThat(options.getOrg()).isEqualTo("my-org"); Assertions.assertThat(options.getBucket()).isEqualTo("my-bucket"); Assertions.assertThat(options.getToken()).isEqualTo("my-token".toCharArray()); Assertions.assertThat(options.getLogLevel()).isEqualTo(LogLevel.BODY); Assertions.assertThat(influxDBClient.getLogLevel()).isEqualTo(LogLevel.BODY); Retrofit retrofit = getDeclaredField(influxDBClient, "retrofit", AbstractInfluxDBClient.class); OkHttpClient okHttpClient = (OkHttpClient) retrofit.callFactory(); Assertions.assertThat(okHttpClient.readTimeoutMillis()).isEqualTo(5_000); Assertions.assertThat(okHttpClient.writeTimeoutMillis()).isEqualTo(10_000); Assertions.assertThat(okHttpClient.connectTimeoutMillis()).isEqualTo(5_000); Map<String, String> defaultTags = getDeclaredField(options.getPointSettings(), "defaultTags", PointSettings.class); Assertions.assertThat(defaultTags).hasSize(4) .hasEntrySatisfying("id", value -> Assertions.assertThat(value).isEqualTo("132-987-655")) .hasEntrySatisfying("customer", value -> Assertions.assertThat(value).isEqualTo("California Miner")) .hasEntrySatisfying("version", value -> Assertions.assertThat(value).isEqualTo("${version}")) .hasEntrySatisfying("hostname", value -> Assertions.assertThat(value).isEqualTo("${env.hostname}")); }
@Nonnull public static InfluxDBClient create() { InfluxDBClientOptions options = InfluxDBClientOptions.builder() .loadProperties() .build(); return create(options); }
InfluxDBClientFactory { @Nonnull public static InfluxDBClient create() { InfluxDBClientOptions options = InfluxDBClientOptions.builder() .loadProperties() .build(); return create(options); } }
InfluxDBClientFactory { @Nonnull public static InfluxDBClient create() { InfluxDBClientOptions options = InfluxDBClientOptions.builder() .loadProperties() .build(); return create(options); } private  InfluxDBClientFactory(); }
InfluxDBClientFactory { @Nonnull public static InfluxDBClient create() { InfluxDBClientOptions options = InfluxDBClientOptions.builder() .loadProperties() .build(); return create(options); } private  InfluxDBClientFactory(); @Nonnull static InfluxDBClient create(); @Nonnull static InfluxDBClient create(@Nonnull final String connectionString); @Nonnull static InfluxDBClient create(@Nonnull final String url,
                                        @Nonnull final String username,
                                        @Nonnull final char[] password); @Nonnull static InfluxDBClient create(@Nonnull final String url, @Nonnull final char[] token); @Nonnull static InfluxDBClient create(@Nonnull final String url,
                                        @Nonnull final char[] token,
                                        @Nullable final String org); @Nonnull static InfluxDBClient create(@Nonnull final String url,
                                        @Nonnull final char[] token,
                                        @Nullable final String org,
                                        @Nullable final String bucket); @Nonnull static InfluxDBClient createV1(@Nonnull final String url,
                                          @Nullable final String username,
                                          final char[] password,
                                          @Nonnull final String database,
                                          @Nullable final String retentionPolicy); @Nonnull static InfluxDBClient create(@Nonnull final InfluxDBClientOptions options); @Nonnull static OnboardingResponse onBoarding(@Nonnull final String url,
                                                @Nonnull final String username,
                                                @Nonnull final String password,
                                                @Nonnull final String org,
                                                @Nonnull final String bucket); @Nonnull static OnboardingResponse onBoarding(@Nonnull final String url,
                                                @Nonnull final OnboardingRequest onboarding); }
InfluxDBClientFactory { @Nonnull public static InfluxDBClient create() { InfluxDBClientOptions options = InfluxDBClientOptions.builder() .loadProperties() .build(); return create(options); } private  InfluxDBClientFactory(); @Nonnull static InfluxDBClient create(); @Nonnull static InfluxDBClient create(@Nonnull final String connectionString); @Nonnull static InfluxDBClient create(@Nonnull final String url,
                                        @Nonnull final String username,
                                        @Nonnull final char[] password); @Nonnull static InfluxDBClient create(@Nonnull final String url, @Nonnull final char[] token); @Nonnull static InfluxDBClient create(@Nonnull final String url,
                                        @Nonnull final char[] token,
                                        @Nullable final String org); @Nonnull static InfluxDBClient create(@Nonnull final String url,
                                        @Nonnull final char[] token,
                                        @Nullable final String org,
                                        @Nullable final String bucket); @Nonnull static InfluxDBClient createV1(@Nonnull final String url,
                                          @Nullable final String username,
                                          final char[] password,
                                          @Nonnull final String database,
                                          @Nullable final String retentionPolicy); @Nonnull static InfluxDBClient create(@Nonnull final InfluxDBClientOptions options); @Nonnull static OnboardingResponse onBoarding(@Nonnull final String url,
                                                @Nonnull final String username,
                                                @Nonnull final String password,
                                                @Nonnull final String org,
                                                @Nonnull final String bucket); @Nonnull static OnboardingResponse onBoarding(@Nonnull final String url,
                                                @Nonnull final OnboardingRequest onboarding);  }