mirror of
https://github.com/apache/sqoop.git
synced 2025-05-03 23:22:51 +08:00
SQOOP-2839: Sqoop import failure due to data member conflict in ORM code for table
(VISHNU S NAIR via Jarek Jarcec Cecho)
This commit is contained in:
parent
b84ebf1e84
commit
cfa7927c2a
@ -121,6 +121,8 @@ public class ClassWriter {
|
||||
// not strictly reserved words, but collides with
|
||||
// our imports
|
||||
JAVA_RESERVED_WORDS.add("Text");
|
||||
//Fix For Issue SQOOP-2839
|
||||
JAVA_RESERVED_WORDS.add("PROTOCOL_VERSION");
|
||||
}
|
||||
|
||||
public static final String PROPERTY_CODEGEN_METHODS_MAXCOLS =
|
||||
|
@ -373,6 +373,8 @@ public void testJavaIdentifierConversion() {
|
||||
"9isLegalInSql"));
|
||||
assertEquals("____", ClassWriter.toJavaIdentifier("___"));
|
||||
assertEquals("__class", ClassWriter.toJavaIdentifier("_class"));
|
||||
//Checking Java identifier for Constant PROTOCOL_VERSION
|
||||
assertEquals("_PROTOCOL_VERSION", ClassWriter.toJavaIdentifier("PROTOCOL_VERSION"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -405,6 +407,38 @@ public void testWeirdColumnNames() throws SQLException {
|
||||
+ HsqldbTestServer.getTableName());
|
||||
}
|
||||
|
||||
// Test For checking Codegneration perfroming successfully
|
||||
// in case of Table with Column name as PROTOCOL_VERSION
|
||||
@Test
|
||||
public void testColumnNameAsProtocolVersion() throws SQLException {
|
||||
// Recreate the table with column name as PROTOCOL_VERSION.
|
||||
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
|
||||
+ " (PROTOCOL_VERSION INT)");
|
||||
st.executeUpdate("INSERT INTO " + tableName + " VALUES(42)");
|
||||
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());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCloningTableWithVarbinaryDoesNotThrowNPE() throws SQLException,
|
||||
IOException, ClassNotFoundException, NoSuchMethodException,
|
||||
|
Loading…
Reference in New Issue
Block a user