Package org.apache.sqoop.common

Examples of org.apache.sqoop.common.MutableMapContext


    });

  }

  public void testTimePartition() throws Exception {
    MutableContext context = new MutableMapContext();
    context.setString(GenericJdbcConnectorConstants
        .CONNECTOR_JDBC_PARTITION_COLUMNNAME, "TCOL");
    context.setString(GenericJdbcConnectorConstants
        .CONNECTOR_JDBC_PARTITION_COLUMNTYPE, String.valueOf(Types.TIME));
    context.setString(GenericJdbcConnectorConstants.CONNECTOR_JDBC_PARTITION_MINVALUE,
        Time.valueOf("01:01:01").toString());
    context.setString(GenericJdbcConnectorConstants.CONNECTOR_JDBC_PARTITION_MAXVALUE,
        Time.valueOf("10:40:50").toString());


    ConnectionConfiguration connConf = new ConnectionConfiguration();
    ImportJobConfiguration jobConf = new ImportJobConfiguration();
View Full Code Here


        "'07:27:33' <= TCOL AND TCOL <= '10:40:50'",
    });
  }

  public void testTimestampPartition() throws Exception {
    MutableContext context = new MutableMapContext();
    context.setString(GenericJdbcConnectorConstants
        .CONNECTOR_JDBC_PARTITION_COLUMNNAME, "TSCOL");
    context.setString(GenericJdbcConnectorConstants
        .CONNECTOR_JDBC_PARTITION_COLUMNTYPE, String.valueOf(Types.TIMESTAMP));
    context.setString(GenericJdbcConnectorConstants.CONNECTOR_JDBC_PARTITION_MINVALUE,
        Timestamp.valueOf("2013-01-01 01:01:01.123").toString());
    context.setString(GenericJdbcConnectorConstants.CONNECTOR_JDBC_PARTITION_MAXVALUE,
        Timestamp.valueOf("2013-12-31 10:40:50.654").toString());

    ConnectionConfiguration connConf = new ConnectionConfiguration();
    ImportJobConfiguration jobConf = new ImportJobConfiguration();
View Full Code Here

        "'2013-08-31 23:27:34.144' <= TSCOL AND TSCOL <= '2013-12-31 10:40:50.654'",
    });
  }

  public void testBooleanPartition() throws Exception {
    MutableContext context = new MutableMapContext();
    context.setString(GenericJdbcConnectorConstants
        .CONNECTOR_JDBC_PARTITION_COLUMNNAME, "BCOL");
    context.setString(GenericJdbcConnectorConstants
        .CONNECTOR_JDBC_PARTITION_COLUMNTYPE, String.valueOf(Types.BOOLEAN));
    context.setString(GenericJdbcConnectorConstants
        .CONNECTOR_JDBC_PARTITION_MINVALUE, "0");
    context.setString(GenericJdbcConnectorConstants
        .CONNECTOR_JDBC_PARTITION_MAXVALUE, "1");

    ConnectionConfiguration connConf = new ConnectionConfiguration();
    ImportJobConfiguration jobConf = new ImportJobConfiguration();
View Full Code Here

      "BCOL = FALSE",
    });
  }

  public void testVarcharPartition() throws Exception {
    MutableContext context = new MutableMapContext();
    context.setString(GenericJdbcConnectorConstants
        .CONNECTOR_JDBC_PARTITION_COLUMNNAME, "VCCOL");
    context.setString(GenericJdbcConnectorConstants
        .CONNECTOR_JDBC_PARTITION_COLUMNTYPE, String.valueOf(Types.VARCHAR));
    context.setString(GenericJdbcConnectorConstants
        .CONNECTOR_JDBC_PARTITION_MINVALUE, "A");
    context.setString(GenericJdbcConnectorConstants
        .CONNECTOR_JDBC_PARTITION_MAXVALUE, "Z");

    ConnectionConfiguration connConf = new ConnectionConfiguration();
    ImportJobConfiguration jobConf = new ImportJobConfiguration();
View Full Code Here

        "'Y' <= VCCOL AND VCCOL <= 'Z'",
    });
  }

  public void testVarcharPartition2() throws Exception {
    MutableContext context = new MutableMapContext();
    context.setString(GenericJdbcConnectorConstants
      .CONNECTOR_JDBC_PARTITION_COLUMNNAME, "VCCOL");
    context.setString(GenericJdbcConnectorConstants
      .CONNECTOR_JDBC_PARTITION_COLUMNTYPE, String.valueOf(Types.VARCHAR));
    context.setString(GenericJdbcConnectorConstants
      .CONNECTOR_JDBC_PARTITION_MINVALUE, "Breezy Badger");
    context.setString(GenericJdbcConnectorConstants
      .CONNECTOR_JDBC_PARTITION_MAXVALUE, "Warty Warthog");

    ConnectionConfiguration connConf = new ConnectionConfiguration();
    ImportJobConfiguration jobConf = new ImportJobConfiguration();
    Partitioner partitioner = new GenericJdbcImportPartitioner();
View Full Code Here

    // Last partition needs to contain entire lower bound
    assertTrue(partitions.get(4).toString().contains("Warty Warthog"));
  }

  public void testVarcharPartitionWithCommonPrefix() throws Exception {
    MutableContext context = new MutableMapContext();
    context.setString(GenericJdbcConnectorConstants
        .CONNECTOR_JDBC_PARTITION_COLUMNNAME, "VCCOL");
    context.setString(GenericJdbcConnectorConstants
        .CONNECTOR_JDBC_PARTITION_COLUMNTYPE, String.valueOf(Types.VARCHAR));
    context.setString(GenericJdbcConnectorConstants
        .CONNECTOR_JDBC_PARTITION_MINVALUE, "AAA");
    context.setString(GenericJdbcConnectorConstants
        .CONNECTOR_JDBC_PARTITION_MAXVALUE, "AAF");

    ConnectionConfiguration connConf = new ConnectionConfiguration();
    ImportJobConfiguration jobConf = new ImportJobConfiguration();
View Full Code Here

    });

  }

  public void testPatitionWithNullValues() throws Exception {
    MutableContext context = new MutableMapContext();
    context.setString(GenericJdbcConnectorConstants
        .CONNECTOR_JDBC_PARTITION_COLUMNNAME, "VCCOL");
    context.setString(GenericJdbcConnectorConstants
        .CONNECTOR_JDBC_PARTITION_COLUMNTYPE, String.valueOf(Types.VARCHAR));
    context.setString(GenericJdbcConnectorConstants
        .CONNECTOR_JDBC_PARTITION_MINVALUE, "AAA");
    context.setString(GenericJdbcConnectorConstants
        .CONNECTOR_JDBC_PARTITION_MAXVALUE, "AAE");

    ConnectionConfiguration connConf = new ConnectionConfiguration();
    ImportJobConfiguration jobConf = new ImportJobConfiguration();
    jobConf.table.partitionColumnNull = true;
View Full Code Here

  private static final int START = -5;
  private static final int NUMBER_OF_ROWS = 11;

  public void testIntegerEvenPartition() throws Exception {
    MutableContext context = new MutableMapContext();
    context.setString(
        GenericJdbcConnectorConstants.CONNECTOR_JDBC_PARTITION_COLUMNNAME,
        "ICOL");
    context.setString(
        GenericJdbcConnectorConstants.CONNECTOR_JDBC_PARTITION_COLUMNTYPE,
        String.valueOf(Types.INTEGER));
    context.setString(
        GenericJdbcConnectorConstants.CONNECTOR_JDBC_PARTITION_MINVALUE,
        String.valueOf(START));
    context.setString(
        GenericJdbcConnectorConstants.CONNECTOR_JDBC_PARTITION_MAXVALUE,
        String.valueOf(START + NUMBER_OF_ROWS - 1));

    ConnectionConfiguration connConf = new ConnectionConfiguration();
    ImportJobConfiguration jobConf = new ImportJobConfiguration();
View Full Code Here

        "3 <= ICOL AND ICOL <= 5"
    });
  }

  public void testIntegerUnevenPartition() throws Exception {
    MutableContext context = new MutableMapContext();
    context.setString(
        GenericJdbcConnectorConstants.CONNECTOR_JDBC_PARTITION_COLUMNNAME,
        "ICOL");
    context.setString(
        GenericJdbcConnectorConstants.CONNECTOR_JDBC_PARTITION_COLUMNTYPE,
        String.valueOf(Types.INTEGER));
    context.setString(
        GenericJdbcConnectorConstants.CONNECTOR_JDBC_PARTITION_MINVALUE,
        String.valueOf(START));
    context.setString(
        GenericJdbcConnectorConstants.CONNECTOR_JDBC_PARTITION_MAXVALUE,
        String.valueOf(START + NUMBER_OF_ROWS - 1));

    ConnectionConfiguration connConf = new ConnectionConfiguration();
    ImportJobConfiguration jobConf = new ImportJobConfiguration();
View Full Code Here

  public void tearDown() {
    executor.close();
  }

  public void testQuery() throws Exception {
    MutableContext context = new MutableMapContext();

    ConnectionConfiguration connectionConfig = new ConnectionConfiguration();

    connectionConfig.connection.jdbcDriver = GenericJdbcTestConstants.DRIVER;
    connectionConfig.connection.connectionString = GenericJdbcTestConstants.URL;

    ImportJobConfiguration jobConfig = new ImportJobConfiguration();

    context.setString(GenericJdbcConnectorConstants.CONNECTOR_JDBC_DATA_SQL,
        "SELECT * FROM " + executor.delimitIdentifier(tableName) + " WHERE ${CONDITIONS}");

    GenericJdbcImportPartition partition;

    Extractor extractor = new GenericJdbcImportExtractor();
View Full Code Here

TOP

Related Classes of org.apache.sqoop.common.MutableMapContext

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.