当前位置: 首页>>代码示例>>Java>>正文


Java HsqldbTestServer.getTableName方法代码示例

本文整理汇总了Java中com.cloudera.sqoop.testutil.HsqldbTestServer.getTableName方法的典型用法代码示例。如果您正苦于以下问题:Java HsqldbTestServer.getTableName方法的具体用法?Java HsqldbTestServer.getTableName怎么用?Java HsqldbTestServer.getTableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.cloudera.sqoop.testutil.HsqldbTestServer的用法示例。


在下文中一共展示了HsqldbTestServer.getTableName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testUserMapping

import com.cloudera.sqoop.testutil.HsqldbTestServer; //导入方法依赖的package包/类
public void testUserMapping() throws Exception {
  String[] args = {
      "--map-column-hive", "id=STRING,value=INTEGER",
  };
  Configuration conf = new Configuration();
  SqoopOptions options =
    new ImportTool().parseArguments(args, null, null, false);
  TableDefWriter writer = new TableDefWriter(options,
      null, HsqldbTestServer.getTableName(), "outputTable", conf, false);

  Map<String, Integer> colTypes = new SqlTypeMap<String, Integer>();
  colTypes.put("id", Types.INTEGER);
  colTypes.put("value", Types.VARCHAR);
  writer.setColumnTypes(colTypes);

  String createTable = writer.getCreateTableStmt();

  assertNotNull(createTable);

  assertTrue(createTable.contains("`id` STRING"));
  assertTrue(createTable.contains("`value` INTEGER"));

  assertFalse(createTable.contains("`id` INTEGER"));
  assertFalse(createTable.contains("`value` STRING"));
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:26,代码来源:TestTableDefWriter.java

示例2: testUserMappingFailWhenCantBeApplied

import com.cloudera.sqoop.testutil.HsqldbTestServer; //导入方法依赖的package包/类
public void testUserMappingFailWhenCantBeApplied() throws Exception {
  String[] args = {
      "--map-column-hive", "id=STRING,value=INTEGER",
  };
  Configuration conf = new Configuration();
  SqoopOptions options =
    new ImportTool().parseArguments(args, null, null, false);
  TableDefWriter writer = new TableDefWriter(options,
      null, HsqldbTestServer.getTableName(), "outputTable", conf, false);

  Map<String, Integer> colTypes = new SqlTypeMap<String, Integer>();
  colTypes.put("id", Types.INTEGER);
  writer.setColumnTypes(colTypes);

  try {
    String createTable = writer.getCreateTableStmt();
    fail("Expected failure on non applied mapping.");
  } catch(IllegalArgumentException iae) {
    // Expected, ok
  }
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:22,代码来源:TestTableDefWriter.java

示例3: testHiveDatabase

import com.cloudera.sqoop.testutil.HsqldbTestServer; //导入方法依赖的package包/类
public void testHiveDatabase() throws Exception {
  String[] args = {
      "--hive-database", "db",
  };
  Configuration conf = new Configuration();
  SqoopOptions options =
    new ImportTool().parseArguments(args, null, null, false);
  TableDefWriter writer = new TableDefWriter(options,
      null, HsqldbTestServer.getTableName(), "outputTable", conf, false);

  Map<String, Integer> colTypes = new SqlTypeMap<String, Integer>();
  writer.setColumnTypes(colTypes);

  String createTable = writer.getCreateTableStmt();
  assertNotNull(createTable);
  assertTrue(createTable.contains("`db`.`outputTable`"));

  String loadStmt = writer.getLoadDataStmt();
  assertNotNull(loadStmt);
  assertTrue(createTable.contains("`db`.`outputTable`"));
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:22,代码来源:TestTableDefWriter.java

示例4: runFailedGenerationTest

import com.cloudera.sqoop.testutil.HsqldbTestServer; //导入方法依赖的package包/类
private void runFailedGenerationTest(String [] argv,
    String classNameToCheck) {
  File codeGenDirFile = new File(CODE_GEN_DIR);
  File classGenDirFile = new File(JAR_GEN_DIR);

  try {
    options = new ImportTool().parseArguments(argv,
        null, options, true);
  } catch (Exception e) {
    LOG.error("Could not parse options: " + e.toString());
  }

  CompilationManager compileMgr = new CompilationManager(options);
  ClassWriter writer = new ClassWriter(options, manager,
      HsqldbTestServer.getTableName(), compileMgr);

  try {
    writer.generate();
    compileMgr.compile();
    fail("ORM class file generation succeeded when it was expected to fail");
  } catch (Exception ioe) {
    LOG.error("Got Exception from ORM generation as expected : "
      + ioe.toString());
  }
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:26,代码来源:TestClassWriter.java

示例5: testAppend

import com.cloudera.sqoop.testutil.HsqldbTestServer; //导入方法依赖的package包/类
/** independent to target-dir. */
public void testAppend() throws IOException {
  ArrayList args = getOutputlessArgv(false, false, HsqldbTestServer.getFieldNames(), getConf());
  args.add("--warehouse-dir");
  args.add(getWarehouseDir());

  Path output = new Path(getWarehouseDir(), HsqldbTestServer.getTableName());
  runAppendTest(args, output);
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:10,代码来源:TestAppendUtils.java

示例6: testWeirdColumnNames

import com.cloudera.sqoop.testutil.HsqldbTestServer; //导入方法依赖的package包/类
@Test
public void testWeirdColumnNames() throws SQLException {
  // Recreate the table with column names that aren't legal Java identifiers.
  String tableName = HsqldbTestServer.getTableName();
  Connection connection = testServer.getConnection();
  Statement st = connection.createStatement();
  try {
    st.executeUpdate("DROP TABLE " + tableName + " IF EXISTS");
    st.executeUpdate("CREATE TABLE " + tableName
        + " (class INT, \"9field\" INT)");
    st.executeUpdate("INSERT INTO " + tableName + " VALUES(42, 41)");
    connection.commit();
  } finally {
    st.close();
    connection.close();
  }

  String [] argv = {
    "--bindir",
    JAR_GEN_DIR,
    "--outdir",
    CODE_GEN_DIR,
    "--package-name",
    OVERRIDE_PACKAGE_NAME,
  };

  runGenerationTest(argv, OVERRIDE_PACKAGE_NAME + "."
      + HsqldbTestServer.getTableName());
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:30,代码来源:TestClassWriter.java

示例7: testAppend

import com.cloudera.sqoop.testutil.HsqldbTestServer; //导入方法依赖的package包/类
/** independent to target-dir. */
public void testAppend() throws IOException {
  ArrayList args = getOutputlessArgv(false, HsqldbTestServer.getFieldNames(),
      getConf());
  args.add("--warehouse-dir");
  args.add(getWarehouseDir());

  Path output = new Path(getWarehouseDir(), HsqldbTestServer.getTableName());
  runAppendTest(args, output);
}
 
开发者ID:unicredit,项目名称:zSqoop,代码行数:11,代码来源:TestAppendUtils.java

示例8: getTableName

import com.cloudera.sqoop.testutil.HsqldbTestServer; //导入方法依赖的package包/类
protected String getTableName() {
  return HsqldbTestServer.getTableName();
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:4,代码来源:TestQuery.java

示例9: testCloningTableWithVarbinaryDoesNotThrowNPE

import com.cloudera.sqoop.testutil.HsqldbTestServer; //导入方法依赖的package包/类
@Test
public void testCloningTableWithVarbinaryDoesNotThrowNPE() throws SQLException,
    IOException, ClassNotFoundException, NoSuchMethodException,
    SecurityException, InstantiationException, IllegalAccessException,
    IllegalArgumentException, InvocationTargetException {
  String tableName = HsqldbTestServer.getTableName();
  Connection connection = testServer.getConnection();
  Statement st = connection.createStatement();
  try {
    st.executeUpdate("DROP TABLE " + tableName + " IF EXISTS");
    st.executeUpdate("CREATE TABLE " + tableName
        + " (id INT, test VARBINARY(10))");
    connection.commit();
  } finally {
    st.close();
    connection.close();
  }

  String [] argv = {
    "--bindir",
    JAR_GEN_DIR,
    "--outdir",
    CODE_GEN_DIR,
    "--package-name",
    OVERRIDE_PACKAGE_NAME,
  };

  String className = OVERRIDE_PACKAGE_NAME + "."
      + HsqldbTestServer.getTableName();
  File ormJarFile = runGenerationTest(argv, className);

  ClassLoader prevClassLoader = ClassLoaderStack.addJarFile(
      ormJarFile.getCanonicalPath(), className);
  Class tableClass = Class.forName(className, true,
      Thread.currentThread().getContextClassLoader());
  Method cloneImplementation = tableClass.getMethod("clone");

  Object instance = tableClass.newInstance();

  assertTrue(cloneImplementation.invoke(instance).getClass().
      getCanonicalName().equals(className));

  if (null != prevClassLoader) {
    ClassLoaderStack.setCurrentClassLoader(prevClassLoader);
  }
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:47,代码来源:TestClassWriter.java


注:本文中的com.cloudera.sqoop.testutil.HsqldbTestServer.getTableName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。