當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。