Examples of MStringInput


Examples of org.apache.sqoop.model.MStringInput

    job.setPersistenceId(666);
    job.setCreationDate(created);
    job.setLastUpdateDate(updated);

    // Fill some data at the beginning
    MStringInput input = (MStringInput) job.getConnectorPart().getForms()
      .get(0).getInputs().get(0);
    input.setValue("Hi there!");

    // Serialize it to JSON object
    JobBean bean = new JobBean(job);
    JSONObject json = bean.extract(false);

    // "Move" it across network in text form
    String string = json.toJSONString();

    // Retrieved transferred object
    JSONObject retrievedJson = (JSONObject)JSONValue.parseWithException(string);
    JobBean retrievedBean = new JobBean();
    retrievedBean.restore(retrievedJson);
    MJob target = retrievedBean.getJobs().get(0);

    // Check id and name
    assertEquals(666, target.getPersistenceId());
    assertEquals(MJob.Type.IMPORT, target.getType());
    assertEquals("The big job", target.getName());
    assertEquals(created, target.getCreationDate());
    assertEquals(updated, target.getLastUpdateDate());

    // Test that value was correctly moved
    MStringInput targetInput = (MStringInput) target.getConnectorPart()
      .getForms().get(0).getInputs().get(0);
    assertEquals("Hi there!", targetInput.getValue());
  }
View Full Code Here

Examples of org.apache.sqoop.model.MStringInput

    );
  }

  public static MConnectionForms getConnectionForms() {
    List<MInput<?>> inputs;
    MStringInput input;
    MForm form;
    List<MForm> connectionForms = new ArrayList<MForm>();
    inputs = new ArrayList<MInput<?>>();

    input = new MStringInput("url", false, (short) 10);
    input.setPersistenceId(1);
    inputs.add(input);

    input = new MStringInput("username", false, (short) 10);
    input.setPersistenceId(2);
    input.setValue("test");
    inputs.add(input);

    input = new MStringInput("password", true, (short) 10);
    input.setPersistenceId(3);
    input.setValue("test");
    inputs.add(input);

    form = new MForm("connection", inputs);
    form.setPersistenceId(10);
    connectionForms.add(form);
View Full Code Here

Examples of org.apache.sqoop.model.MStringInput

    return new MConnectionForms(connectionForms);
  }

  public static MJobForms getJobForms(MJob.Type type) {
    List<MInput<?>> inputs;
    MStringInput input;
    MForm form;
    List<MForm> jobForms = new ArrayList<MForm>();

    inputs = new ArrayList<MInput<?>>();

    input = new MStringInput("A", false, (short) 10);
    input.setPersistenceId(4);
    inputs.add(input);

    input = new MStringInput("B", false, (short) 10);
    input.setPersistenceId(5);
    inputs.add(input);

    input = new MStringInput("C", false, (short) 10);
    input.setPersistenceId(6);
    inputs.add(input);

    form = new MForm("Z", inputs);
    form.setPersistenceId(11);
    jobForms.add(form);

    inputs = new ArrayList<MInput<?>>();

    input = new MStringInput("D", false, (short) 10);
    input.setPersistenceId(7);
    inputs.add(input);

    input = new MStringInput("E", false, (short) 10);
    input.setPersistenceId(8);
    inputs.add(input);

    input = new MStringInput("F", false, (short) 10);
    input.setPersistenceId(9);
    inputs.add(input);

    form = new MForm("connection", inputs);
    form.setPersistenceId(12);
    jobForms.add(form);
View Full Code Here

Examples of org.apache.sqoop.model.MStringInput

      Boolean sensitive = (Boolean) input.get(FORM_INPUT_SENSITIVE);
      MInput mInput = null;
      switch (type) {
        case STRING: {
          long size = (Long) input.get(FORM_INPUT_SIZE);
          mInput = new MStringInput(name, sensitive.booleanValue(), (short) size);
          break;
        }
        case MAP: {
          mInput = new MMapInput(name, sensitive.booleanValue());
          break;
View Full Code Here

Examples of org.apache.sqoop.model.MStringInput

    List<MInput<?>> inputs;
    MInput input;

    inputs = new LinkedList<MInput<?>>();
    input = new MStringInput("I1", false, (short)30);
    inputs.add(input);
    input = new MStringInput("I2", false, (short)30);
    inputs.add(input);
    forms.add(new MForm("F1", inputs));

    inputs = new LinkedList<MInput<?>>();
    input = new MStringInput("I3", false, (short)30);
    inputs.add(input);
    input = new MStringInput("I4", false, (short)30);
    inputs.add(input);
    forms.add(new MForm("F2", inputs));

    return forms;
  }
View Full Code Here

Examples of org.apache.sqoop.model.MStringInput

      baseInputStmt.setShort(3, inputIndex++);
      baseInputStmt.setString(4, input.getType().name());
      baseInputStmt.setBoolean(5, input.isSensitive());
      // String specific column(s)
      if (input.getType().equals(MInputType.STRING)) {
        MStringInput  strInput = (MStringInput) input;
        baseInputStmt.setShort(6, strInput.getMaxLength());
      } else {
        baseInputStmt.setNull(6, Types.INTEGER);
      }
      // Enum specific column(s)
      if(input.getType() == MInputType.ENUM) {
View Full Code Here

Examples of org.apache.sqoop.model.MStringInput

        MInputType mit = MInputType.valueOf(inputType);

        MInput input = null;
        switch (mit) {
        case STRING:
          input = new MStringInput(inputName, inputSensitivity, inputStrLength);
          break;
        case MAP:
          input = new MMapInput(inputName, inputSensitivity);
          break;
        case INTEGER:
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.