@Test public void testFromConfig() throws Exception { Config config = newConfig() .set("database", "foobar"); SecretProvider secrets = key -> Optional.fromNullable( ImmutableMap.of("apikey", "quux").get(key)); TDOperator.fromConfig(DEFAULT_DEFAULT_SYSTEM_CONFIG, EMPTY_ENV, config, secrets); }
public static TDOperator fromConfig(SystemDefaultConfig systemDefaultConfig, Map<String, String> env, Config config, SecretProvider secrets) { String database = secrets.getSecretOptional("database").or(config.get("database", String.class)).trim(); if (database.isEmpty()) { throw new ConfigException("Parameter 'database' is empty"); } TDClient client = TDClientFactory.clientFromConfig(systemDefaultConfig, env, config, secrets); return new TDOperator(client, database); }
TDOperator implements Closeable { public static TDOperator fromConfig(SystemDefaultConfig systemDefaultConfig, Map<String, String> env, Config config, SecretProvider secrets) { String database = secrets.getSecretOptional("database").or(config.get("database", String.class)).trim(); if (database.isEmpty()) { throw new ConfigException("Parameter 'database' is empty"); } TDClient client = TDClientFactory.clientFromConfig(systemDefaultConfig, env, config, secrets); return new TDOperator(client, database); } }
TDOperator implements Closeable { public static TDOperator fromConfig(SystemDefaultConfig systemDefaultConfig, Map<String, String> env, Config config, SecretProvider secrets) { String database = secrets.getSecretOptional("database").or(config.get("database", String.class)).trim(); if (database.isEmpty()) { throw new ConfigException("Parameter 'database' is empty"); } TDClient client = TDClientFactory.clientFromConfig(systemDefaultConfig, env, config, secrets); return new TDOperator(client, database); } TDOperator(TDClient client, String database); }
TDOperator implements Closeable { public static TDOperator fromConfig(SystemDefaultConfig systemDefaultConfig, Map<String, String> env, Config config, SecretProvider secrets) { String database = secrets.getSecretOptional("database").or(config.get("database", String.class)).trim(); if (database.isEmpty()) { throw new ConfigException("Parameter 'database' is empty"); } TDClient client = TDClientFactory.clientFromConfig(systemDefaultConfig, env, config, secrets); return new TDOperator(client, database); } TDOperator(TDClient client, String database); static TDOperator fromConfig(SystemDefaultConfig systemDefaultConfig, Map<String, String> env, Config config, SecretProvider secrets); static String escapeHiveIdent(String ident); static String escapePrestoIdent(String ident); static String escapeHiveTableName(TableParam table); static String escapePrestoTableName(TableParam table); TDOperator withDatabase(String anotherDatabase); String getDatabase(); void ensureDatabaseCreated(String name); void ensureDatabaseDeleted(String name); void ensureTableCreated(String tableName); void ensureTableDeleted(String tableName); void ensureExistentTableRenamed(String existentTable, String toName); boolean tableExists(String table); long lookupConnection(String name); String submitNewJobWithRetry(TDJobRequest req); String submitNewJobWithRetry(Submitter submitter); TDJobOperator newJobOperator(String jobId); TDJobOperator runJob(TaskState state, String key, DurationInterval pollInterval, DurationInterval retryInterval, JobStarter starter); @Override void close(); }
TDOperator implements Closeable { public static TDOperator fromConfig(SystemDefaultConfig systemDefaultConfig, Map<String, String> env, Config config, SecretProvider secrets) { String database = secrets.getSecretOptional("database").or(config.get("database", String.class)).trim(); if (database.isEmpty()) { throw new ConfigException("Parameter 'database' is empty"); } TDClient client = TDClientFactory.clientFromConfig(systemDefaultConfig, env, config, secrets); return new TDOperator(client, database); } TDOperator(TDClient client, String database); static TDOperator fromConfig(SystemDefaultConfig systemDefaultConfig, Map<String, String> env, Config config, SecretProvider secrets); static String escapeHiveIdent(String ident); static String escapePrestoIdent(String ident); static String escapeHiveTableName(TableParam table); static String escapePrestoTableName(TableParam table); TDOperator withDatabase(String anotherDatabase); String getDatabase(); void ensureDatabaseCreated(String name); void ensureDatabaseDeleted(String name); void ensureTableCreated(String tableName); void ensureTableDeleted(String tableName); void ensureExistentTableRenamed(String existentTable, String toName); boolean tableExists(String table); long lookupConnection(String name); String submitNewJobWithRetry(TDJobRequest req); String submitNewJobWithRetry(Submitter submitter); TDJobOperator newJobOperator(String jobId); TDJobOperator runJob(TaskState state, String key, DurationInterval pollInterval, DurationInterval retryInterval, JobStarter starter); @Override void close();  }