Examples of MJob


Examples of org.apache.sqoop.model.MJob

  }

  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(0)).setValue("Updated");
    ((MMapInput)forms.get(0).getInputs().get(1)).setValue(null);
    ((MStringInput)forms.get(1).getInputs().get(0)).setValue("Updated");
    ((MMapInput)forms.get(1).getInputs().get(1)).setValue(null);

    forms = job.getFrameworkPart().getForms();
    ((MStringInput)forms.get(0).getInputs().get(0)).setValue("Updated");
    ((MMapInput)forms.get(0).getInputs().get(1)).setValue(new HashMap<String, String>()); // inject new map value
    ((MStringInput)forms.get(1).getInputs().get(0)).setValue("Updated");
    ((MMapInput)forms.get(1).getInputs().get(1)).setValue(new HashMap<String, String>()); // inject new map value

    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("Updated", forms.get(0).getInputs().get(0).getValue());
    assertNull(forms.get(0).getInputs().get(1).getValue());
    assertEquals("Updated", forms.get(1).getInputs().get(0).getValue());
    assertNull(forms.get(1).getInputs().get(1).getValue());

    forms = retrieved.getFrameworkPart().getForms();
    assertEquals("Updated", forms.get(0).getInputs().get(0).getValue());
    assertNotNull(forms.get(0).getInputs().get(1).getValue());
    assertEquals(((Map)forms.get(0).getInputs().get(1).getValue()).size(), 0);
    assertEquals("Updated", forms.get(1).getInputs().get(0).getValue());
    assertNotNull(forms.get(1).getInputs().get(1).getValue());
View Full Code Here

Examples of org.apache.sqoop.model.MJob

    loadJobs();

    // disable job 1
    handler.enableJob(1, false, getDerbyConnection());

    MJob retrieved = handler.findJob(1, getDerbyConnection());
    assertNotNull(retrieved);
    assertEquals(false, retrieved.getEnabled());

    // enable job 1
    handler.enableJob(1, true, getDerbyConnection());

    retrieved = handler.findJob(1, getDerbyConnection());
    assertNotNull(retrieved);
    assertEquals(true, retrieved.getEnabled());
  }
View Full Code Here

Examples of org.apache.sqoop.model.MJob

    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

Examples of org.apache.sqoop.model.MJob

    connection.setPersistenceId(id);
    return connection;
  }

  private MJob job(long id, long cid, long xid) {
    MJob job = new MJob(cid, xid, Type.IMPORT, new MJobForms(Type.IMPORT, new LinkedList<MForm>()),
        new MJobForms(Type.IMPORT, new LinkedList<MForm>()));
    job.setPersistenceId(id);
    return job;
  }
View Full Code Here

Examples of org.apache.sqoop.model.MJob

        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.setCreationUser(createBy);
        job.setCreationDate(creationDate);
        job.setLastUpdateUser(updateBy);
        job.setLastUpdateDate(lastUpdateDate);
        job.setEnabled(enabled);

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

Examples of org.apache.sqoop.model.MJob

  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

Examples of org.apache.sqoop.model.MJob

   * @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

Examples of org.apache.sqoop.model.MJob

      MJob.Type type = MJob.Type.valueOf(stringType);

      List<MForm> connectorForms = restoreForms(connectorPart);
      List<MForm> frameworkForms = restoreForms(frameworkPart);

      MJob job = new MJob(
        connectorId,
        connectionId,
        type,
        new MJobForms(type, connectorForms),
        new MJobForms(type, frameworkForms)
      );

      job.setPersistenceId((Long) object.get(ID));
      job.setName((String) object.get(NAME));
      job.setEnabled((Boolean) object.get(ENABLED));
      job.setCreationUser((String) object.get(CREATION_USER));
      job.setCreationDate(new Date((Long) object.get(CREATION_DATE)));
      job.setLastUpdateUser((String) object.get(UPDATE_USER));
      job.setLastUpdateDate(new Date((Long) object.get(UPDATE_DATE)));

      jobs.add(job);
    }

    if(jsonObject.containsKey(CONNECTOR_RESOURCES)) {
View Full Code Here

Examples of org.apache.sqoop.model.MJob

      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

Examples of org.apache.sqoop.model.MJob

  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
TOP
Copyright © 2018 www.massapi.com. 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.