use of org.apache.phoenix.schema.ConstraintViolationException in project phoenix by apache.
the class VariableLengthPKIT method testTooShortKVColumn.
@Test
public void testTooShortKVColumn() throws Exception {
long ts = nextTimestamp();
ensureTableCreated(getUrl(), BTABLE_NAME, BTABLE_NAME, null, ts - 2, null);
// Insert at timestamp 0
String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + ts;
Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
Connection conn = DriverManager.getConnection(url, props);
conn.setAutoCommit(true);
// Insert all rows at ts
PreparedStatement stmt = conn.prepareStatement("upsert into " + "BTABLE(" + " A_STRING, " + " A_ID," + " B_STRING," + " A_INTEGER," + " C_STRING," + " E_STRING)" + "VALUES (?, ?, ?, ?, ?, ?)");
stmt.setString(1, "abc");
stmt.setString(2, "123");
stmt.setString(3, "x");
stmt.setInt(4, 1);
stmt.setString(5, "ab");
stmt.setString(6, "01234");
try {
stmt.execute();
} catch (ConstraintViolationException e) {
fail("Constraint voilation Exception should not be thrown, the characters have to be padded");
} finally {
conn.close();
}
}
Aggregations