Package org.apache.sqoop.model

Examples of org.apache.sqoop.model.MJob


    assertFalse(handler.inUseJob(3, getDerbyConnection()));
    assertFalse(handler.inUseJob(4, getDerbyConnection()));
  }

  public void testCreateJob() throws Exception {
    MJob job = getJob();

    // Load some data
    fillJob(job);

    handler.createJob(job, getDerbyConnection());

    assertEquals(1, job.getPersistenceId());
    assertCountForTable("SQOOP.SQ_JOB", 1);
    assertCountForTable("SQOOP.SQ_JOB_INPUT", 4);

    MJob retrieved = handler.findJob(1, getDerbyConnection());
    assertEquals(1, retrieved.getPersistenceId());

    List<MForm> forms;
    forms = job.getConnectorPart().getForms();
    assertEquals("Value1", forms.get(0).getInputs().get(0).getValue());
    assertNull(forms.get(0).getInputs().get(1).getValue());
View Full Code Here


  }

  public void testUpdateJob() throws Exception {
    loadJobs();

    MJob job = handler.findJob(1, getDerbyConnection());

    List<MForm> forms;

    forms = job.getConnectorPart().getForms();
    ((MStringInput)forms.get(0).getInputs().get(1)).setValue("Injected");

    forms = job.getFrameworkPart().getForms();
    ((MStringInput)forms.get(1).getInputs().get(1)).setValue("Injected");

    job.setName("name");

    handler.updateJob(job, getDerbyConnection());

    assertEquals(1, job.getPersistenceId());
    assertCountForTable("SQOOP.SQ_JOB", 4);
    assertCountForTable("SQOOP.SQ_JOB_INPUT", 18);

    MJob retrieved = handler.findJob(1, getDerbyConnection());
    assertEquals("name", retrieved.getName());

    forms = retrieved.getConnectorPart().getForms();
    assertEquals("Injected", forms.get(0).getInputs().get(1).getValue());

    forms = retrieved.getFrameworkPart().getForms();
    assertEquals("Injected", forms.get(1).getInputs().get(1).getValue());
  }
View Full Code Here

    assertCountForTable("SQOOP.SQ_JOB", 0);
    assertCountForTable("SQOOP.SQ_JOB_INPUT", 0);
  }

  public MJob getJob() {
    return new MJob(1, 1, MJob.Type.IMPORT,
      handler.findConnector("A",
        getDerbyConnection()).getJobForms(MJob.Type.IMPORT
      ),
      handler.findFramework(
        getDerbyConnection()).getJobForms(MJob.Type.IMPORT
View Full Code Here

        loadForms(connectorConnForms, connectorJobForms,
          formConnectorFetchStmt, inputFetchStmt, 2);
        loadForms(frameworkConnForms, frameworkJobForms,
          formFrameworkFetchStmt, inputFetchStmt, 2);

        MJob job = new MJob(connectorId, connectionId, type,
          new MJobForms(type, connectorJobForms.get(type)),
          new MJobForms(type, frameworkJobForms.get(type)));

        job.setPersistenceId(id);
        job.setName(name);
        job.setCreationDate(creationDate);
        job.setLastUpdateDate(lastUpdateDate);

        jobs.add(job);
      }
    } finally {
      closeResultSets(rsJob);
View Full Code Here

   * @return
   */
  public MJob newJob(long xid, MJob.Type type) {
    MConnection connection = getConnection(xid);

    return new MJob(
      connection.getConnectorId(),
      connection.getPersistenceId(),
      type,
      getConnector(connection.getConnectorId()).getJobForms(type),
      getFramework().getJobForms(type)
View Full Code Here

  private void createJob(Long connectionId, String type) throws IOException {
    printlnResource(Constants.RES_CREATE_CREATING_JOB, connectionId);

    ConsoleReader reader = new ConsoleReader();
    MJob job = client.newJob(connectionId, MJob.Type.valueOf(type.toUpperCase()));

    ResourceBundle connectorBundle = client.getResourceBundle(job.getConnectorId());
    ResourceBundle frameworkBundle = client.getFrameworkResourceBundle();

    Status status = Status.FINE;

    printlnResource(Constants.RES_PROMPT_FILL_JOB_METADATA);

    do {
      // Print error introduction if needed
      if( !status.canProceed() ) {
        errorIntroduction();
      }

      // Fill in data from user
      if(!fillJob(reader, job, connectorBundle, frameworkBundle)) {
        return;
      }

      // Try to create
      status = client.createJob(job);
    } while(!status.canProceed());
    FormDisplayer.displayFormWarning(job);
    printlnResource(Constants.RES_CREATE_JOB_SUCCESSFUL, status.name(), job.getPersistenceId());
  }
View Full Code Here

    if (entity instanceof MConnection) {
      MConnection connection = (MConnection) entity;
      formList.addAll(connection.getConnectorPart().getForms());
      formList.addAll(connection.getFrameworkPart().getForms());
    } else if(entity instanceof MJob) {
      MJob job = (MJob) entity;
      formList.addAll(job.getConnectorPart().getForms());
      formList.addAll(job.getFrameworkPart().getForms());
    }
    for(MForm form : formList) {
      if(form.getValidationStatus() == Status.ACCEPTABLE) {
        if(showMessage) {
          print("\n@|yellow %s|@\n", resourceString(Constants.RES_FORMDISPLAYER_FORM_WARNING));
View Full Code Here

  private void updateJob(Long jobId) throws IOException {
    printlnResource(Constants.RES_UPDATE_UPDATING_JOB, jobId);

    ConsoleReader reader = new ConsoleReader();

    MJob job = client.getJob(jobId);

    ResourceBundle connectorBundle = client.getResourceBundle(job.getConnectorId());
    ResourceBundle frameworkBundle = client.getFrameworkResourceBundle();

    Status status = Status.FINE;

    printlnResource(Constants.RES_PROMPT_UPDATE_JOB_METADATA);
View Full Code Here

      displayJob(job);
    }
  }

  private void showJob(Long jid) {
    MJob job = client.getJob(jid);
    printlnResource(Constants.RES_SHOW_PROMPT_JOBS_TO_SHOW, 1);

    displayJob(job);
  }
View Full Code Here

TOP

Related Classes of org.apache.sqoop.model.MJob

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.