@Before
  public void setUp() throws Exception {
    assumeThat(TD_API_KEY, not(isEmptyOrNullString()));
    projectDir = folder.getRoot().toPath().toAbsolutePath().normalize();
    config = folder.newFile().toPath();
    Files.write(config, asList("secrets.td.apikey = " + TD_API_KEY));
    outfile = projectDir.resolve("outfile");

    client = TDClient.newBuilder(false).setApiKey(TD_API_KEY).build();
    database = "tmp_" + UUID.randomUUID().toString().replace('-', '_');
    client.createDatabase(database);

    table = "test";
    String insertJobId =
        client.submit(
            TDJobRequest.newPrestoQuery(database, "create table " + table + " as select 1"));

    TestUtils.expect(Duration.ofMinutes(5), jobSuccess(client, insertJobId));

    String selectCountJobId =
        client.submit(TDJobRequest.newPrestoQuery(database, "select count(*) from " + table));
    TestUtils.expect(Duration.ofMinutes(5), jobSuccess(client, selectCountJobId));

    List<ArrayNode> result = downloadResult(selectCountJobId);
    assertThat(result.get(0).get(0).asInt(), is(1));
  }
  @Test
  public void testPartialDeleteWithEpochNumbers() throws Exception {
    copyResource(
        "acceptance/td/td_partial_delete/td_partial_delete_with_epoch_numbers.dig",
        projectDir.resolve("workflow.dig"));

    CommandStatus runStatus =
        main(
            "run",
            "-o",
            projectDir.toString(),
            "--config",
            config.toString(),
            "--project",
            projectDir.toString(),
            "-p",
            "outfile=" + outfile,
            "-p",
            "database=" + database,
            "-p",
            "table=" + table,
            "workflow.dig");

    assertThat(runStatus.errUtf8(), runStatus.code(), is(0));

    assertThat(Files.exists(outfile), is(true));

    // Verify that table contents are deleted
    String selectCountJobId =
        client.submit(TDJobRequest.newPrestoQuery(database, "select count(*) from " + table));
    TestUtils.expect(Duration.ofMinutes(5), jobSuccess(client, selectCountJobId));
    List<ArrayNode> result = downloadResult(selectCountJobId);
    assertThat(result.get(0).get(0).asInt(), is(0));
  }
 public void testCountrySubdivisionAtmLocationService() {
   CountrySubdivisionAtmLocationRequestOptions options =
       new CountrySubdivisionAtmLocationRequestOptions("USA");
   CountrySubdivisions countrySubdivisions = service.getCountrySubdivisions(options);
   assertTrue(
       countrySubdivisions.getCountrySubdivision() != null
           && countrySubdivisions.getCountrySubdivision().size() > 0);
   assertTrue(testUtils.validateXML(countrySubdivisions, "countrySubdivisions.xsd"));
 }
 public void setUp() {
   this.service =
       new CountrySubdivisionAtmLocationService(
           Environment.SANDBOX, testUtils.getConsumerKey(), testUtils.getPrivateKey());
 }