@Test void v1Configuration() throws NoSuchFieldException, IllegalAccessException { InfluxDBClient client = InfluxDBClientFactory.createV1("http: InfluxDBClientOptions options = getDeclaredField(client, "options", AbstractInfluxDBClient.class); Assertions.assertThat(options.getUrl()).isEqualTo("http: Assertions.assertThat(options.getOrg()).isEqualTo("-"); Assertions.assertThat(options.getBucket()).isEqualTo("database/week"); Assertions.assertThat(options.getToken()).isEqualTo("my-username:my-password".toCharArray()); client = InfluxDBClientFactory.createV1("http: options = getDeclaredField(client, "options", AbstractInfluxDBClient.class); Assertions.assertThat(options.getUrl()).isEqualTo("http: Assertions.assertThat(options.getOrg()).isEqualTo("-"); Assertions.assertThat(options.getBucket()).isEqualTo("database/"); Assertions.assertThat(options.getToken()).isEqualTo(":".toCharArray()); }
@Nonnull public static InfluxDBClient createV1(@Nonnull final String url, @Nullable final String username, final char[] password, @Nonnull final String database, @Nullable final String retentionPolicy) { Arguments.checkNonEmpty(database, "database"); InfluxDBClientOptions options = InfluxDBClientOptions.builder() .url(url) .org("-") .authenticateToken(String.format("%s:%s", username == null ? "" : username, password == null ? "" : String.valueOf(password)).toCharArray()) .bucket(String.format("%s/%s", database, retentionPolicy == null ? "" : retentionPolicy)) .build(); return create(options); }
InfluxDBClientFactory { @Nonnull public static InfluxDBClient createV1(@Nonnull final String url, @Nullable final String username, final char[] password, @Nonnull final String database, @Nullable final String retentionPolicy) { Arguments.checkNonEmpty(database, "database"); InfluxDBClientOptions options = InfluxDBClientOptions.builder() .url(url) .org("-") .authenticateToken(String.format("%s:%s", username == null ? "" : username, password == null ? "" : String.valueOf(password)).toCharArray()) .bucket(String.format("%s/%s", database, retentionPolicy == null ? "" : retentionPolicy)) .build(); return create(options); } }
InfluxDBClientFactory { @Nonnull public static InfluxDBClient createV1(@Nonnull final String url, @Nullable final String username, final char[] password, @Nonnull final String database, @Nullable final String retentionPolicy) { Arguments.checkNonEmpty(database, "database"); InfluxDBClientOptions options = InfluxDBClientOptions.builder() .url(url) .org("-") .authenticateToken(String.format("%s:%s", username == null ? "" : username, password == null ? "" : String.valueOf(password)).toCharArray()) .bucket(String.format("%s/%s", database, retentionPolicy == null ? "" : retentionPolicy)) .build(); return create(options); } private  InfluxDBClientFactory(); }
InfluxDBClientFactory { @Nonnull public static InfluxDBClient createV1(@Nonnull final String url, @Nullable final String username, final char[] password, @Nonnull final String database, @Nullable final String retentionPolicy) { Arguments.checkNonEmpty(database, "database"); InfluxDBClientOptions options = InfluxDBClientOptions.builder() .url(url) .org("-") .authenticateToken(String.format("%s:%s", username == null ? "" : username, password == null ? "" : String.valueOf(password)).toCharArray()) .bucket(String.format("%s/%s", database, retentionPolicy == null ? "" : retentionPolicy)) .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 createV1(@Nonnull final String url, @Nullable final String username, final char[] password, @Nonnull final String database, @Nullable final String retentionPolicy) { Arguments.checkNonEmpty(database, "database"); InfluxDBClientOptions options = InfluxDBClientOptions.builder() .url(url) .org("-") .authenticateToken(String.format("%s:%s", username == null ? "" : username, password == null ? "" : String.valueOf(password)).toCharArray()) .bucket(String.format("%s/%s", database, retentionPolicy == null ? "" : retentionPolicy)) .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);  }