use of com.treasuredata.client.model.TDJobSummary in project td-client-java by treasure-data.
the class TestTDClient method submitBulkLoadJob.
@Test
public void submitBulkLoadJob() throws Exception {
ObjectNode config = JsonNodeFactory.instance.objectNode();
ObjectNode in = JsonNodeFactory.instance.objectNode();
in.put("type", "s3");
config.put("in", in);
client.createDatabaseIfNotExists(SAMPLE_DB);
client.createTableIfNotExists(SAMPLE_DB, "sample_output");
String jobId = client.submit(TDJobRequest.newBulkLoad(SAMPLE_DB, "sample_output", config));
TDJobSummary tdJob = waitJobCompletion(jobId);
// this job will fail because of lack of parameters for s3 input plugin
}
use of com.treasuredata.client.model.TDJobSummary in project td-client-java by treasure-data.
the class TestTDClient method submitJobWithDomainKey.
@Test
public void submitJobWithDomainKey() throws Exception {
String domainKey = randomDomainKey();
TDJobRequest request1 = new TDJobRequestBuilder().setType(TDJob.Type.PRESTO).setDatabase("sample_datasets").setQuery("select 1").setDomainKey(domainKey).createTDJobRequest();
String jobId = client.submit(request1);
waitJobCompletion(jobId);
TDJobRequest request2 = new TDJobRequestBuilder().setType(TDJob.Type.PRESTO).setDatabase("sample_datasets").setQuery("select 1").setDomainKey(domainKey).createTDJobRequest();
try {
client.submit(request2);
fail("Expected " + TDClientHttpConflictException.class.getName());
} catch (TDClientHttpConflictException e) {
assertThat(e.getConflictsWith(), is(Optional.of(jobId)));
}
TDJobSummary statusByDomainKey = client.jobStatusByDomainKey(domainKey);
assertThat(statusByDomainKey.getJobId(), is(jobId));
}
Aggregations