@Test public void testCreateSchemaOnlyColumnLabel() throws ClassNotFoundException, SQLException { final ResultSet resultSet = mock(ResultSet.class); final ResultSetMetaData resultSetMetaData = mock(ResultSetMetaData.class); when(resultSet.getMetaData()).thenReturn(resultSetMetaData); when(resultSetMetaData.getColumnCount()).thenReturn(2); when(resultSetMetaData.getTableName(1)).thenReturn("TEST"); when(resultSetMetaData.getColumnType(1)).thenReturn(Types.INTEGER); when(resultSetMetaData.getColumnName(1)).thenReturn(""); when(resultSetMetaData.getColumnLabel(1)).thenReturn("ID"); when(resultSetMetaData.getColumnType(2)).thenReturn(Types.VARCHAR); when(resultSetMetaData.getColumnName(2)).thenReturn("VCHARC"); when(resultSetMetaData.getColumnLabel(2)).thenReturn("NOT_VCHARC"); final Schema schema = JdbcCommon.createSchema(resultSet); assertNotNull(schema); assertNotNull(schema.getField("ID")); assertNotNull(schema.getField("NOT_VCHARC")); assertEquals("TEST", schema.getName()); }
public static Schema createSchema(final ResultSet rs) throws SQLException { return createSchema(rs, null, false); }
JdbcCommon { public static Schema createSchema(final ResultSet rs) throws SQLException { return createSchema(rs, null, false); } }
JdbcCommon { public static Schema createSchema(final ResultSet rs) throws SQLException { return createSchema(rs, null, false); }  }
JdbcCommon { public static Schema createSchema(final ResultSet rs) throws SQLException { return createSchema(rs, null, false); }  static long convertToAvroStream(final ResultSet rs, final OutputStream outStream, boolean convertNames); static long convertToAvroStream(final ResultSet rs, final OutputStream outStream, String recordName, boolean convertNames); static long convertToAvroStream(final ResultSet rs, final OutputStream outStream, String recordName, ResultSetRowCallback callback, boolean convertNames); static long convertToAvroStream(final ResultSet rs, final OutputStream outStream, String recordName, ResultSetRowCallback callback, final int maxRows, boolean convertNames); static Schema createSchema(final ResultSet rs); static Schema createSchema(final ResultSet rs, String recordName, boolean convertNames); static String normalizeNameForAvro(String inputName); }
JdbcCommon { public static Schema createSchema(final ResultSet rs) throws SQLException { return createSchema(rs, null, false); }  static long convertToAvroStream(final ResultSet rs, final OutputStream outStream, boolean convertNames); static long convertToAvroStream(final ResultSet rs, final OutputStream outStream, String recordName, boolean convertNames); static long convertToAvroStream(final ResultSet rs, final OutputStream outStream, String recordName, ResultSetRowCallback callback, boolean convertNames); static long convertToAvroStream(final ResultSet rs, final OutputStream outStream, String recordName, ResultSetRowCallback callback, final int maxRows, boolean convertNames); static Schema createSchema(final ResultSet rs); static Schema createSchema(final ResultSet rs, String recordName, boolean convertNames); static String normalizeNameForAvro(String inputName);  }