コード例 #1
0
ファイル: ConnectorTestCase.java プロジェクト: gbecares/Sqoop
  /**
   * Run job with given jid.
   *
   * @param jid Job id
   * @throws Exception
   */
  protected void executeJob(String jobName) throws Exception {
    MSubmission finalSubmission = getClient().startJob(jobName, DEFAULT_SUBMISSION_CALLBACKS, 100);

    if (finalSubmission.getStatus().isFailure()) {
      LOG.error("Submission has failed: " + finalSubmission.getError().getErrorSummary());
      LOG.error("Corresponding error details: " + finalSubmission.getError().getErrorDetails());
    }
    assertEquals(
        finalSubmission.getStatus(),
        SubmissionStatus.SUCCEEDED,
        "Submission finished with error: " + finalSubmission.getError().getErrorSummary());
  }
コード例 #2
0
  @SuppressWarnings("unchecked")
  private JSONObject extractSubmission(MSubmission submission) {
    JSONObject object = new JSONObject();

    object.put(JOB, submission.getJobId());
    object.put(JOB_ID, submission.getJobId());
    object.put(STATUS, submission.getStatus().name());
    object.put(PROGRESS, submission.getProgress());

    if (submission.getCreationUser() != null) {
      object.put(CREATION_USER, submission.getCreationUser());
    }
    if (submission.getCreationDate() != null) {
      object.put(CREATION_DATE, submission.getCreationDate().getTime());
    }
    if (submission.getLastUpdateUser() != null) {
      object.put(LAST_UPDATE_USER, submission.getLastUpdateUser());
    }
    if (submission.getLastUpdateDate() != null) {
      object.put(LAST_UPDATE_DATE, submission.getLastUpdateDate().getTime());
    }
    if (submission.getExternalJobId() != null) {
      object.put(EXTERNAL_ID, submission.getExternalJobId());
    }
    if (submission.getExternalLink() != null) {
      object.put(EXTERNAL_LINK, submission.getExternalLink());
    }
    if (submission.getError().getErrorSummary() != null) {
      object.put(ERROR_SUMMARY, submission.getError().getErrorSummary());
    }
    if (submission.getError().getErrorDetails() != null) {
      object.put(ERROR_DETAILS, submission.getError().getErrorDetails());
    }
    if (submission.getCounters() != null) {
      object.put(COUNTERS, extractCounters(submission.getCounters()));
    }
    if (submission.getFromSchema() != null) {
      object.put(FROM_SCHEMA, extractSchema(submission.getFromSchema()));
    }
    if (submission.getToSchema() != null) {
      object.put(TO_SCHEMA, extractSchema(submission.getToSchema()));
    }
    return object;
  }