@Test
  public void testDefaultColumnConstraintOnAddColumn() throws Exception {
    String tableName = getFreeTableName().toUpperCase();
    String columnName = "COLUMN_WITH_DEFAULT_VALUE";

    createMyTable(tableName);
    DBAccessorImpl dbAccessor = injector.getInstance(DBAccessorImpl.class);

    // create a column with a non-NULL constraint that has a default value
    DBColumnInfo dbColumnInfo = new DBColumnInfo(columnName, String.class, 32, "foo", false);
    dbAccessor.addColumn(tableName, dbColumnInfo);

    String schema = null;
    Connection connection = dbAccessor.getConnection();
    DatabaseMetaData databaseMetadata = connection.getMetaData();
    ResultSet schemaResultSet = databaseMetadata.getSchemas();
    if (schemaResultSet.next()) {
      schema = schemaResultSet.getString(1);
    }

    schemaResultSet.close();

    String columnDefaultVal = null;
    ResultSet rs = databaseMetadata.getColumns(null, schema, tableName, columnName);

    if (rs.next()) {
      columnDefaultVal = rs.getString("COLUMN_DEF");
    }

    rs.close();

    assertEquals("'foo'", columnDefaultVal);
   }
Checks to ensure that columns created with a default have the correct
DEFAULT constraint value set in.

@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/orm/DBAccessorImplTest.java