Beispiel #1
0
  @Test
  public void testBasic() throws Exception {
    createFromFile(
        "input-0001",
        "1,'USA','2004-10-23','San Francisco'",
        "2,'USA','2004-10-24','Sunnyvale'",
        "3,'Czech Republic','2004-10-25','Brno'",
        "4,'USA','2004-10-26','Palo Alto'");

    // RDBMS link
    MLink rdbmsLink = getClient().createLink("generic-jdbc-connector");
    fillRdbmsLinkConfig(rdbmsLink);
    saveLink(rdbmsLink);

    // HDFS link
    MLink hdfsLink = getClient().createLink("hdfs-connector");
    fillHdfsLink(hdfsLink);
    saveLink(hdfsLink);

    // Job creation
    MJob job = getClient().createJob(hdfsLink.getName(), rdbmsLink.getName());

    // set hdfs "FROM" config for the job, since the connector test case base class only has
    // utilities for hdfs!
    fillHdfsFromConfig(job);

    // set the rdbms "TO" config here
    fillRdbmsToConfig(job);

    // driver config
    MDriverConfig driverConfig = job.getDriverConfig();
    driverConfig.getIntegerInput("throttlingConfig.numExtractors").setValue(3);
    saveJob(job);

    executeJob(job);

    assertEquals(4L, provider.rowCount(getTableName()));
    assertRowInCities(1, "USA", "2004-10-23", "San Francisco");
    assertRowInCities(2, "USA", "2004-10-24", "Sunnyvale");
    assertRowInCities(3, "Czech Republic", "2004-10-25", "Brno");
    assertRowInCities(4, "USA", "2004-10-26", "Palo Alto");
  }
Beispiel #2
0
  private void displayJob(MJob job) {
    DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);

    printlnResource(
        Constants.RES_SHOW_PROMPT_JOB_INFO,
        job.getName(),
        job.getEnabled(),
        job.getCreationUser(),
        formatter.format(job.getCreationDate()),
        job.getLastUpdateUser(),
        formatter.format(job.getLastUpdateDate()));

    displayConfig(job.getDriverConfig().getConfigs(), client.getDriverConfigBundle());
    printlnResource(Constants.RES_SHOW_PROMPT_JOB_FROM_LID_INFO, job.getFromLinkName());
    displayConfig(
        job.getFromJobConfig().getConfigs(),
        client.getConnectorConfigBundle(job.getFromConnectorName()));
    printlnResource(Constants.RES_SHOW_PROMPT_JOB_TO_LID_INFO, job.getToLinkName());
    displayConfig(
        job.getToJobConfig().getConfigs(),
        client.getConnectorConfigBundle(job.getToConnectorName()));
  }
Beispiel #3
0
 /**
  * Fill Driver config
  *
  * @param job
  */
 protected void fillDriverConfig(MJob job) {
   job.getDriverConfig().getStringInput("throttlingConfig.numExtractors").setValue("3");
 }