use of com.treasuredata.client.model.TDJobList in project td-client-java by treasure-data.
the class TestProxyAccess method proxyApiAccess.
@Test
public void proxyApiAccess() {
TDClient client = TDClient.newBuilder().setProxy(proxyBaseConfig()).build();
try {
client.serverStatus();
List<TDTable> tableList = client.listTables("sample_datasets");
assertTrue(tableList.size() >= 2);
TDJobList jobList = client.listJobs();
assertTrue(jobList.getJobs().size() > 0);
} finally {
logger.debug("proxy access count: {}", proxyAccessCount);
assertEquals(1, proxyAccessCount.get());
}
}
use of com.treasuredata.client.model.TDJobList in project td-client-java by treasure-data.
the class TestSSLProxyAccess method proxyApiAccess.
@Test
public void proxyApiAccess() {
ProxyConfig.ProxyConfigBuilder proxy = new ProxyConfig.ProxyConfigBuilder();
proxy.useSSL(true);
proxy.setHost("localhost");
proxy.setPort(proxyPort);
proxy.setUser(PROXY_USER);
proxy.setPassword(PROXY_PASS);
TDClient client = TDClient.newBuilder().setProxy(proxy.createProxyConfig()).build();
try {
client.serverStatus();
List<TDTable> tableList = client.listTables("sample_datasets");
assertTrue(tableList.size() >= 2);
TDJobList jobList = client.listJobs();
assertTrue(jobList.getJobs().size() > 0);
} finally {
logger.debug("proxy access count: {}", proxyAccessCount);
assertEquals(1, proxyAccessCount.get());
}
}
use of com.treasuredata.client.model.TDJobList in project td-client-java by treasure-data.
the class TestTDClient method listJobs.
@Test
public void listJobs() throws Exception {
TDJobList jobs = client.listJobs();
logger.debug("job list: " + jobs);
TDJobList jobsInAnIDRange = client.listJobs(34022478, 34022600);
logger.debug("job list: " + jobsInAnIDRange);
assertTrue(jobsInAnIDRange.getJobs().size() > 0);
// Check getters
Iterable<Method> getters = FluentIterable.from(TDJob.class.getDeclaredMethods()).filter(new Predicate<Method>() {
@Override
public boolean apply(Method input) {
return test(input);
}
@Override
public boolean test(Method input) {
return input.getName().startsWith("get");
}
});
// Call getters
for (TDJob job : jobs.getJobs()) {
for (Method m : getters) {
m.invoke(job);
}
}
}