本文整理汇总了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"));
}
示例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
}
}
示例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`"));
}
示例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());
}
}
示例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);
}
示例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());
}
示例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);
}
示例8: getTableName
import com.cloudera.sqoop.testutil.HsqldbTestServer; //导入方法依赖的package包/类
protected String getTableName() {
return HsqldbTestServer.getTableName();
}
示例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);
}
}