Examples of MStringInput


Examples of org.apache.sqoop.model.MStringInput

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

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

    input = new MStringInput("f.String", false, (short)30);
    inputs.add(input);

    input = new MMapInput("f.Map", false);
    inputs.add(input);
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 MMapInput("I2", false);
    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 MMapInput("I4", false);
    inputs.add(input);
    forms.add(new MForm("F2", inputs));
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 BOOLEAN:
View Full Code Here

Examples of org.apache.sqoop.model.MStringInput

    connection.setLastUpdateUser("user");
    connection.setLastUpdateDate(updated);
    connection.setEnabled(false);

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

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

    // Check for sensitivity
    JSONArray all = (JSONArray)json.get("all");
    JSONObject allItem = (JSONObject)all.get(0);
    JSONArray connectors = (JSONArray)allItem.get("connector");
    JSONObject connector = (JSONObject)connectors.get(0);
    JSONArray inputs = (JSONArray)connector.get("inputs");
    for (Object input1 : inputs) {
      assertTrue(((JSONObject)input1).containsKey("sensitive"));
    }

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

    // Retrieved transferred object
    JSONObject retrievedJson = (JSONObject) JSONValue.parse(string);
    ConnectionBean retrievedBean = new ConnectionBean();
    retrievedBean.restore(retrievedJson);
    MConnection target = retrievedBean.getConnections().get(0);

    // Check id and name
    assertEquals(666, target.getPersistenceId());
    assertEquals("Connection", target.getName());
    assertEquals("admin", target.getCreationUser());
    assertEquals(created, target.getCreationDate());
    assertEquals("user", target.getLastUpdateUser());
    assertEquals(updated, target.getLastUpdateDate());
    assertEquals(false, target.getEnabled());

    // 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

    connection.setLastUpdateUser("user");
    connection.setLastUpdateDate(updated);
    connection.setEnabled(true);

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

    // Serialize it to JSON object
    ConnectionBean bean = new ConnectionBean(connection);
    JSONObject json = bean.extract(false);
    JSONObject jsonFiltered = bean.extract(true);
View Full Code Here

Examples of org.apache.sqoop.model.MStringInput

    job.setCreationDate(created);
    job.setLastUpdateDate(updated);
    job.setEnabled(false);

    // 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());
    assertEquals(false, target.getEnabled());

    // 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
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.