Repository: zeppelin Updated Branches: refs/heads/master 873fa8650 -> 7e1ad5b14
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7e1ad5b1/tajo/src/test/java/org/apache/zeppelin/tajo/TesterResultSet.java ---------------------------------------------------------------------- diff --git a/tajo/src/test/java/org/apache/zeppelin/tajo/TesterResultSet.java b/tajo/src/test/java/org/apache/zeppelin/tajo/TesterResultSet.java deleted file mode 100644 index a068975..0000000 --- a/tajo/src/test/java/org/apache/zeppelin/tajo/TesterResultSet.java +++ /dev/null @@ -1,1171 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.tajo; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.InputStream; -import java.io.Reader; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.sql.*; -import java.util.Calendar; -import java.util.Map; - -/** - * This is borrowed from Apache Commons DBCP2. - * - * A dummy {@link java.sql.ResultSet}, for testing purposes. - */ -public class TesterResultSet implements ResultSet { - - Logger LOGGER = LoggerFactory.getLogger(TesterResultSet.class); - - public TesterResultSet(Statement stmt) { - _statement = stmt; - } - - public TesterResultSet(Statement stmt, Object[][] data) { - _statement = stmt; - _data = data; - } - - public TesterResultSet(Statement stmt, int type, int concurrency) { - _statement = stmt; - _data = null; - _type = type; - _concurrency = concurrency; - } - - protected int _type = ResultSet.TYPE_FORWARD_ONLY; - protected int _concurrency = ResultSet.CONCUR_READ_ONLY; - - protected Object[][] _data = null; - protected int _currentRow = -1; - - protected Statement _statement = null; - protected int _rowsLeft = 2; - protected boolean _open = true; - - @Override - public boolean next() throws SQLException { - checkOpen(); - if (_data != null) { - _currentRow++; - return _currentRow < _data.length; - } - else { - if(--_rowsLeft > 0) { - return true; - } else { - return false; - } - } - } - - @Override - public void close() throws SQLException { - if (!_open) { - return; - } - - // Not all result sets are generated from statements eg DatabaseMetaData - if (_statement != null) { - ((TesterStatement)_statement)._resultSet = null; - } - - _open = false; - } - - @Override - public boolean wasNull() throws SQLException { - checkOpen(); - return false; - } - - @Override - public String getString(int columnIndex) throws SQLException { - checkOpen(); - if (columnIndex == -1) { - throw new SQLException("broken connection"); - } - if (_data != null) { - return (String) getObject(columnIndex); - } - return "String" + columnIndex; - } - - @Override - public boolean getBoolean(int columnIndex) throws SQLException { - checkOpen(); - return true; - } - - @Override - public byte getByte(int columnIndex) throws SQLException { - checkOpen(); - return (byte)columnIndex; - } - - @Override - public short getShort(int columnIndex) throws SQLException { - checkOpen(); - return (short)columnIndex; - } - - @Override - public int getInt(int columnIndex) throws SQLException { - checkOpen(); - return (short)columnIndex; - } - - @Override - public long getLong(int columnIndex) throws SQLException { - checkOpen(); - return columnIndex; - } - - @Override - public float getFloat(int columnIndex) throws SQLException { - checkOpen(); - return columnIndex; - } - - @Override - public double getDouble(int columnIndex) throws SQLException { - checkOpen(); - return columnIndex; - } - - /** @deprecated */ - @Deprecated - @Override - public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { - checkOpen(); - return new BigDecimal(columnIndex); - } - - @Override - public byte[] getBytes(int columnIndex) throws SQLException { - checkOpen(); - return new byte[] { (byte)columnIndex }; - } - - @Override - public java.sql.Date getDate(int columnIndex) throws SQLException { - checkOpen(); - return null; - } - - @Override - public java.sql.Time getTime(int columnIndex) throws SQLException { - checkOpen(); - return null; - } - - @Override - public java.sql.Timestamp getTimestamp(int columnIndex) throws SQLException { - checkOpen(); - return null; - } - - @Override - public java.io.InputStream getAsciiStream(int columnIndex) throws SQLException { - checkOpen(); - return null; - } - - /** @deprecated */ - @Deprecated - @Override - public java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException { - checkOpen(); - return null; - } - - @Override - public java.io.InputStream getBinaryStream(int columnIndex) throws SQLException { - checkOpen(); - return null; - } - - @Override - public String getString(String columnName) throws SQLException { - checkOpen(); - return columnName; - } - - @Override - public boolean getBoolean(String columnName) throws SQLException { - checkOpen(); - return true; - } - - @Override - public byte getByte(String columnName) throws SQLException { - checkOpen(); - return (byte)columnName.hashCode(); - } - - @Override - public short getShort(String columnName) throws SQLException { - checkOpen(); - return (short)columnName.hashCode(); - } - - @Override - public int getInt(String columnName) throws SQLException { - checkOpen(); - return columnName.hashCode(); - } - - @Override - public long getLong(String columnName) throws SQLException { - checkOpen(); - return columnName.hashCode(); - } - - @Override - public float getFloat(String columnName) throws SQLException { - checkOpen(); - return columnName.hashCode(); - } - - @Override - public double getDouble(String columnName) throws SQLException { - checkOpen(); - return columnName.hashCode(); - } - - /** @deprecated */ - @Deprecated - @Override - public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException { - checkOpen(); - return new BigDecimal(columnName.hashCode()); - } - - @Override - public byte[] getBytes(String columnName) throws SQLException { - checkOpen(); - try { - return columnName.getBytes("UTF-8"); - } catch (UnsupportedEncodingException e) { - // Impossible. JVMs are required to support UTF-8 - LOGGER.error("Exception in TesterResultSet while getBytes, Impossible. JVMs are required to" + - " support UTF-8", e); - return null; - } - } - - @Override - public java.sql.Date getDate(String columnName) throws SQLException { - checkOpen(); - return null; - } - - @Override - public java.sql.Time getTime(String columnName) throws SQLException { - checkOpen(); - return null; - } - - @Override - public java.sql.Timestamp getTimestamp(String columnName) throws SQLException { - checkOpen(); - return null; - } - - @Override - public java.io.InputStream getAsciiStream(String columnName) throws SQLException { - checkOpen(); - return null; - } - - /** @deprecated */ - @Deprecated - @Override - public java.io.InputStream getUnicodeStream(String columnName) throws SQLException { - checkOpen(); - return null; - } - - @Override - public java.io.InputStream getBinaryStream(String columnName) throws SQLException { - checkOpen(); - return null; - } - - @Override - public SQLWarning getWarnings() throws SQLException { - checkOpen(); - return null; - } - - @Override - public void clearWarnings() throws SQLException { - checkOpen(); - } - - @Override - public String getCursorName() throws SQLException { - checkOpen(); - return null; - } - - @Override - public ResultSetMetaData getMetaData() throws SQLException { - checkOpen(); - return new TesterResultSetMetaData(); - } - - @Override - public Object getObject(int columnIndex) throws SQLException { - checkOpen(); - if (_data != null) { - return _data[_currentRow][columnIndex-1]; - } - return new Object(); - } - - @Override - public Object getObject(String columnName) throws SQLException { - checkOpen(); - return columnName; - } - - @Override - public int findColumn(String columnName) throws SQLException { - checkOpen(); - return 1; - } - - - @Override - public java.io.Reader getCharacterStream(int columnIndex) throws SQLException { - checkOpen(); - return null; - } - - @Override - public java.io.Reader getCharacterStream(String columnName) throws SQLException { - checkOpen(); - return null; - } - - @Override - public BigDecimal getBigDecimal(int columnIndex) throws SQLException { - checkOpen(); - return new BigDecimal(columnIndex); - } - - @Override - public BigDecimal getBigDecimal(String columnName) throws SQLException { - checkOpen(); - return new BigDecimal(columnName.hashCode()); - } - - @Override - public boolean isBeforeFirst() throws SQLException { - checkOpen(); - return _rowsLeft == 2; - } - - @Override - public boolean isAfterLast() throws SQLException { - checkOpen(); - return _rowsLeft < 0; - } - - @Override - public boolean isFirst() throws SQLException { - checkOpen(); - return _rowsLeft == 1; - } - - @Override - public boolean isLast() throws SQLException { - checkOpen(); - return _rowsLeft == 0; - } - - @Override - public void beforeFirst() throws SQLException { - checkOpen(); - } - - @Override - public void afterLast() throws SQLException { - checkOpen(); - } - - @Override - public boolean first() throws SQLException { - checkOpen(); - return false; - } - - @Override - public boolean last() throws SQLException { - checkOpen(); - return false; - } - - @Override - public int getRow() throws SQLException { - checkOpen(); - return 3 - _rowsLeft; - } - - @Override - public boolean absolute( int row ) throws SQLException { - checkOpen(); - return false; - } - - @Override - public boolean relative( int rows ) throws SQLException { - checkOpen(); - return false; - } - - @Override - public boolean previous() throws SQLException { - checkOpen(); - return false; - } - - @Override - public void setFetchDirection(int direction) throws SQLException { - checkOpen(); - } - - @Override - public int getFetchDirection() throws SQLException { - checkOpen(); - return 1; - } - - @Override - public void setFetchSize(int rows) throws SQLException { - checkOpen(); - } - - @Override - public int getFetchSize() throws SQLException { - checkOpen(); - return 2; - } - - @Override - public int getType() throws SQLException { - return this._type; - } - - @Override - public int getConcurrency() throws SQLException { - return this._concurrency; - } - - @Override - public boolean rowUpdated() throws SQLException { - checkOpen(); - return false; - } - - @Override - public boolean rowInserted() throws SQLException { - checkOpen(); - return false; - } - - @Override - public boolean rowDeleted() throws SQLException { - checkOpen(); - return false; - } - - @Override - public void updateNull(int columnIndex) throws SQLException { - checkOpen(); - } - - @Override - public void updateBoolean(int columnIndex, boolean x) throws SQLException { - checkOpen(); - } - - @Override - public void updateByte(int columnIndex, byte x) throws SQLException { - checkOpen(); - } - - @Override - public void updateShort(int columnIndex, short x) throws SQLException { - checkOpen(); - } - - @Override - public void updateInt(int columnIndex, int x) throws SQLException { - checkOpen(); - } - - @Override - public void updateLong(int columnIndex, long x) throws SQLException { - checkOpen(); - } - - @Override - public void updateFloat(int columnIndex, float x) throws SQLException { - checkOpen(); - } - - @Override - public void updateDouble(int columnIndex, double x) throws SQLException { - checkOpen(); - } - - @Override - public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { - checkOpen(); - } - - @Override - public void updateString(int columnIndex, String x) throws SQLException { - checkOpen(); - } - - @Override - public void updateBytes(int columnIndex, byte x[]) throws SQLException { - checkOpen(); - } - - @Override - public void updateDate(int columnIndex, java.sql.Date x) throws SQLException { - checkOpen(); - } - - @Override - public void updateTime(int columnIndex, java.sql.Time x) throws SQLException { - checkOpen(); - } - - @Override - public void updateTimestamp(int columnIndex, java.sql.Timestamp x) throws SQLException { - checkOpen(); - } - - - @Override - public void updateAsciiStream(int columnIndex, - java.io.InputStream x, - int length) throws SQLException { - checkOpen(); - } - - @Override - public void updateBinaryStream(int columnIndex, - java.io.InputStream x, - int length) throws SQLException { - checkOpen(); - } - - @Override - public void updateCharacterStream(int columnIndex, - java.io.Reader x, - int length) throws SQLException { - checkOpen(); - } - - @Override - public void updateObject(int columnIndex, Object x, int scale) - throws SQLException { - checkOpen(); - } - - @Override - public void updateObject(int columnIndex, Object x) throws SQLException { - checkOpen(); - } - - @Override - public void updateNull(String columnName) throws SQLException { - checkOpen(); - } - - @Override - public void updateBoolean(String columnName, boolean x) throws SQLException { - checkOpen(); - } - - @Override - public void updateByte(String columnName, byte x) throws SQLException { - checkOpen(); - } - - @Override - public void updateShort(String columnName, short x) throws SQLException { - checkOpen(); - } - - @Override - public void updateInt(String columnName, int x) throws SQLException { - checkOpen(); - } - - @Override - public void updateLong(String columnName, long x) throws SQLException { - checkOpen(); - } - - @Override - public void updateFloat(String columnName, float x) throws SQLException { - checkOpen(); - } - - @Override - public void updateDouble(String columnName, double x) throws SQLException { - checkOpen(); - } - - @Override - public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException { - checkOpen(); - } - - @Override - public void updateString(String columnName, String x) throws SQLException { - checkOpen(); - } - - @Override - public void updateBytes(String columnName, byte x[]) throws SQLException { - checkOpen(); - } - - @Override - public void updateDate(String columnName, java.sql.Date x) throws SQLException { - checkOpen(); - } - - @Override - public void updateTime(String columnName, java.sql.Time x) throws SQLException { - checkOpen(); - } - - @Override - public void updateTimestamp(String columnName, java.sql.Timestamp x) - throws SQLException { - checkOpen(); - } - - @Override - public void updateAsciiStream(String columnName, - java.io.InputStream x, - int length) throws SQLException { - checkOpen(); - } - - @Override - public void updateBinaryStream(String columnName, - java.io.InputStream x, - int length) throws SQLException { - checkOpen(); - } - - @Override - public void updateCharacterStream(String columnName, - java.io.Reader reader, - int length) throws SQLException { - checkOpen(); - } - - @Override - public void updateObject(String columnName, Object x, int scale) - throws SQLException { - checkOpen(); - } - - @Override - public void updateObject(String columnName, Object x) throws SQLException { - checkOpen(); - } - - @Override - public void insertRow() throws SQLException { - checkOpen(); - } - - @Override - public void updateRow() throws SQLException { - checkOpen(); - } - - @Override - public void deleteRow() throws SQLException { - checkOpen(); - } - - @Override - public void refreshRow() throws SQLException { - checkOpen(); - } - - @Override - public void cancelRowUpdates() throws SQLException { - checkOpen(); - } - - @Override - public void moveToInsertRow() throws SQLException { - checkOpen(); - } - - @Override - public void moveToCurrentRow() throws SQLException { - checkOpen(); - } - - @Override - public Statement getStatement() throws SQLException { - checkOpen(); - return _statement; - } - - - @Override - public Object getObject(int i, Map<String,Class<?>> map) throws SQLException { - checkOpen(); - return new Object(); - } - - @Override - public Ref getRef(int i) throws SQLException { - checkOpen(); - return null; - } - - @Override - public Blob getBlob(int i) throws SQLException { - checkOpen(); - return null; - } - - @Override - public Clob getClob(int i) throws SQLException { - checkOpen(); - return null; - } - - @Override - public Array getArray(int i) throws SQLException { - checkOpen(); - return null; - } - - @Override - public Object getObject(String colName, Map<String,Class<?>> map) throws SQLException { - checkOpen(); - return colName; - } - - @Override - public Ref getRef(String colName) throws SQLException { - checkOpen(); - return null; - } - - @Override - public Blob getBlob(String colName) throws SQLException { - checkOpen(); - return null; - } - - @Override - public Clob getClob(String colName) throws SQLException { - checkOpen(); - return null; - } - - @Override - public Array getArray(String colName) throws SQLException { - checkOpen(); - return null; - } - - @Override - public java.sql.Date getDate(int columnIndex, Calendar cal) throws SQLException { - checkOpen(); - return null; - } - - @Override - public java.sql.Date getDate(String columnName, Calendar cal) throws SQLException { - checkOpen(); - return null; - } - - @Override - public java.sql.Time getTime(int columnIndex, Calendar cal) throws SQLException { - checkOpen(); - return null; - } - - @Override - public java.sql.Time getTime(String columnName, Calendar cal) throws SQLException { - checkOpen(); - return null; - } - - @Override - public java.sql.Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { - checkOpen(); - return null; - } - - @Override - public java.sql.Timestamp getTimestamp(String columnName, Calendar cal) - throws SQLException { - checkOpen(); - return null; - } - - protected void checkOpen() throws SQLException { - if(!_open) { - throw new SQLException("ResultSet is closed."); - } - } - - @Override - public java.net.URL getURL(int columnIndex) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public java.net.URL getURL(String columnName) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateRef(int columnIndex, java.sql.Ref x) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateRef(String columnName, java.sql.Ref x) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateBlob(int columnIndex, java.sql.Blob x) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateBlob(String columnName, java.sql.Blob x) - throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateClob(int columnIndex, java.sql.Clob x) - throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateClob(String columnName, java.sql.Clob x) - throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateArray(int columnIndex, java.sql.Array x) - throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateArray(String columnName, java.sql.Array x) - throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - - @Override - public boolean isWrapperFor(Class<?> iface) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public <T> T unwrap(Class<T> iface) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public RowId getRowId(int columnIndex) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public RowId getRowId(String columnLabel) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateRowId(int columnIndex, RowId value) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateRowId(String columnLabel, RowId value) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public int getHoldability() throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public boolean isClosed() throws SQLException { - return !_open; - } - - @Override - public void updateNString(int columnIndex, String value) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateNString(String columnLabel, String value) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateNClob(int columnIndex, NClob value) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateNClob(String columnLabel, NClob value) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public NClob getNClob(int columnIndex) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public NClob getNClob(String columnLabel) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public SQLXML getSQLXML(int columnIndex) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public SQLXML getSQLXML(String columnLabel) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateSQLXML(int columnIndex, SQLXML value) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateSQLXML(String columnLabel, SQLXML value) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public String getNString(int columnIndex) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public String getNString(String columnLabel) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public Reader getNCharacterStream(int columnIndex) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public Reader getNCharacterStream(String columnLabel) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateNCharacterStream(int columnIndex, Reader reader, long length) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateAsciiStream(int columnIndex, InputStream inputStream, long length) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateBinaryStream(int columnIndex, InputStream inputStream, long length) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateCharacterStream(int columnIndex, Reader reader, long length) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateAsciiStream(String columnLabel, InputStream inputStream, long length) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateBinaryStream(String columnLabel, InputStream inputStream, long length) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateClob(int columnIndex, Reader reader, long length) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateClob(String columnLabel, Reader reader, long length) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateNCharacterStream(int columnIndex, Reader reader) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateAsciiStream(int columnIndex, InputStream inputStream) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateBinaryStream(int columnIndex, InputStream inputStream) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateCharacterStream(int columnIndex, Reader reader) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateAsciiStream(String columnLabel, InputStream inputStream) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateBinaryStream(String columnLabel, InputStream inputStream) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateClob(int columnIndex, Reader reader) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateClob(String columnLabel, Reader reader) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateNClob(int columnIndex, Reader reader) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void updateNClob(String columnLabel, Reader reader) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public <T> T getObject(int columnIndex, Class<T> type) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public <T> T getObject(String columnLabel, Class<T> type) - throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } -} http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7e1ad5b1/tajo/src/test/java/org/apache/zeppelin/tajo/TesterResultSetMetaData.java ---------------------------------------------------------------------- diff --git a/tajo/src/test/java/org/apache/zeppelin/tajo/TesterResultSetMetaData.java b/tajo/src/test/java/org/apache/zeppelin/tajo/TesterResultSetMetaData.java deleted file mode 100644 index d11e22f..0000000 --- a/tajo/src/test/java/org/apache/zeppelin/tajo/TesterResultSetMetaData.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.zeppelin.tajo; - -import java.sql.ResultSetMetaData; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; -import java.util.ArrayList; -import java.util.List; - -/** - * A dummy {@link java.sql.ResultSetMetaData}, for testing purposes. - */ -public class TesterResultSetMetaData implements ResultSetMetaData { - - // Dummy columns - private List<String> columns = null; - - public TesterResultSetMetaData() { - columns = new ArrayList<String>(); - columns.add("id"); - columns.add("name"); - columns.add("score"); - columns.add("type"); - } - - @Override - public int getColumnCount() throws SQLException { - return columns.size(); - } - - @Override - public boolean isAutoIncrement(int column) throws SQLException { - return false; - } - - @Override - public boolean isCaseSensitive(int column) throws SQLException { - return false; - } - - @Override - public boolean isSearchable(int column) throws SQLException { - return false; - } - - @Override - public boolean isCurrency(int column) throws SQLException { - return false; - } - - @Override - public int isNullable(int column) throws SQLException { - return 0; - } - - @Override - public boolean isSigned(int column) throws SQLException { - return false; - } - - @Override - public int getColumnDisplaySize(int column) throws SQLException { - return 0; - } - - @Override - public String getColumnLabel(int column) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public String getColumnName(int column) throws SQLException { - return columns.get(column - 1); - } - - @Override - public String getSchemaName(int column) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public int getPrecision(int column) throws SQLException { - return 0; - } - - @Override - public int getScale(int column) throws SQLException { - return 0; - } - - @Override - public String getTableName(int column) throws SQLException { - return null; - } - - @Override - public String getCatalogName(int column) throws SQLException { - return null; - } - - @Override - public int getColumnType(int column) throws SQLException { - return 0; - } - - @Override - public String getColumnTypeName(int column) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public boolean isReadOnly(int column) throws SQLException { - return false; - } - - @Override - public boolean isWritable(int column) throws SQLException { - return false; - } - - @Override - public boolean isDefinitelyWritable(int column) throws SQLException { - return false; - } - - @Override - public String getColumnClassName(int column) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public <T> T unwrap(Class<T> iface) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public boolean isWrapperFor(Class<?> iface) throws SQLException { - return false; - } -} http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7e1ad5b1/tajo/src/test/java/org/apache/zeppelin/tajo/TesterStatement.java ---------------------------------------------------------------------- diff --git a/tajo/src/test/java/org/apache/zeppelin/tajo/TesterStatement.java b/tajo/src/test/java/org/apache/zeppelin/tajo/TesterStatement.java deleted file mode 100644 index 22be68d..0000000 --- a/tajo/src/test/java/org/apache/zeppelin/tajo/TesterStatement.java +++ /dev/null @@ -1,344 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.zeppelin.tajo; - - -import java.sql.*; - -/** - * This is borrowed from Apache Commons DBCP2. - * - * A dummy {@link java.sql.Statement}, for testing purposes. - */ -public class TesterStatement implements Statement { - public TesterStatement(Connection conn) { - _connection = conn; - } - - public TesterStatement(Connection conn, int resultSetType, int resultSetConcurrency) { - _connection = conn; - _resultSetType = resultSetType; - _resultSetConcurrency = resultSetConcurrency; - } - - protected Connection _connection = null; - protected boolean _open = true; - protected int _rowsUpdated = 1; - protected boolean _executeResponse = true; - protected int _maxFieldSize = 1024; - protected int _maxRows = 1024; - protected boolean _escapeProcessing = false; - protected int _queryTimeout = 1000; - protected String _cursorName = null; - protected int _fetchDirection = 1; - protected int _fetchSize = 1; - protected int _resultSetConcurrency = 1; - protected int _resultSetType = 1; - protected ResultSet _resultSet = null; - - @Override - public ResultSet executeQuery(String sql) throws SQLException { - checkOpen(); - if("null".equals(sql)) { - return null; - } - if("invalid".equals(sql)) { - throw new SQLException("invalid query"); - } - if ("broken".equals(sql)) { - throw new SQLException("broken connection"); - } - if("select username".equals(sql)) { - String username = ((TesterConnection) _connection).getUsername(); - Object[][] data = {{username}}; - return new TesterResultSet(this, data); - } else { - // Simulate timeout if queryTimout is set to less than 5 seconds - if (_queryTimeout > 0 && _queryTimeout < 5) { - throw new SQLException("query timeout"); - } - return new TesterResultSet(this); - } - } - - @Override - public int executeUpdate(String sql) throws SQLException { - checkOpen(); - return _rowsUpdated; - } - - @Override - public void close() throws SQLException { - // calling close twice has no effect - if (!_open) { - return; - } - - _open = false; - if (_resultSet != null) { - _resultSet.close(); - _resultSet = null; - } - } - - @Override - public int getMaxFieldSize() throws SQLException { - checkOpen(); - return _maxFieldSize; - } - - @Override - public void setMaxFieldSize(int max) throws SQLException { - checkOpen(); - _maxFieldSize = max; - } - - @Override - public int getMaxRows() throws SQLException { - checkOpen(); - return _maxRows; - } - - @Override - public void setMaxRows(int max) throws SQLException { - checkOpen(); - _maxRows = max; - } - - @Override - public void setEscapeProcessing(boolean enable) throws SQLException { - checkOpen(); - _escapeProcessing = enable; - } - - @Override - public int getQueryTimeout() throws SQLException { - checkOpen(); - return _queryTimeout; - } - - @Override - public void setQueryTimeout(int seconds) throws SQLException { - checkOpen(); - _queryTimeout = seconds; - } - - @Override - public void cancel() throws SQLException { - checkOpen(); - } - - @Override - public SQLWarning getWarnings() throws SQLException { - checkOpen(); - return null; - } - - @Override - public void clearWarnings() throws SQLException { - checkOpen(); - } - - @Override - public void setCursorName(String name) throws SQLException { - checkOpen(); - _cursorName = name; - } - - @Override - public boolean execute(String sql) throws SQLException { - checkOpen(); - if("invalid".equals(sql)) { - throw new SQLException("invalid query"); - } - return _executeResponse; - } - - @Override - public ResultSet getResultSet() throws SQLException { - checkOpen(); - if (_resultSet == null) { - _resultSet = new TesterResultSet(this); - } - return _resultSet; - } - - @Override - public int getUpdateCount() throws SQLException { - checkOpen(); - return _rowsUpdated; - } - - @Override - public boolean getMoreResults() throws SQLException { - checkOpen(); - return false; - } - - @Override - public void setFetchDirection(int direction) throws SQLException { - checkOpen(); - _fetchDirection = direction; - } - - @Override - public int getFetchDirection() throws SQLException { - checkOpen(); - return _fetchDirection; - } - - @Override - public void setFetchSize(int rows) throws SQLException { - checkOpen(); - _fetchSize = rows; - } - - @Override - public int getFetchSize() throws SQLException { - checkOpen(); - return _fetchSize; - } - - @Override - public int getResultSetConcurrency() throws SQLException { - checkOpen(); - return _resultSetConcurrency; - } - - @Override - public int getResultSetType() throws SQLException { - checkOpen(); - return _resultSetType; - } - - @Override - public void addBatch(String sql) throws SQLException { - checkOpen(); - } - - @Override - public void clearBatch() throws SQLException { - checkOpen(); - } - - @Override - public int[] executeBatch() throws SQLException { - checkOpen(); - return new int[0]; - } - - @Override - public Connection getConnection() throws SQLException { - checkOpen(); - return _connection; - } - - protected void checkOpen() throws SQLException { - if(!_open) { - throw new SQLException("Connection is closed."); - } - } - - @Override - public boolean getMoreResults(int current) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public ResultSet getGeneratedKeys() throws SQLException { - return new TesterResultSet(this); - } - - @Override - public int executeUpdate(String sql, int autoGeneratedKeys) - throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public int executeUpdate(String sql, int columnIndexes[]) - throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public int executeUpdate(String sql, String columnNames[]) - throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public boolean execute(String sql, int autoGeneratedKeys) - throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public boolean execute(String sql, int columnIndexes[]) - throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public boolean execute(String sql, String columnNames[]) - throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public int getResultSetHoldability() throws SQLException { - checkOpen(); - throw new SQLFeatureNotSupportedException("Not supported."); - } - - - @Override - public boolean isWrapperFor(Class<?> iface) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public <T> T unwrap(Class<T> iface) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public boolean isClosed() throws SQLException { - return !_open; - } - - @Override - public void setPoolable(boolean poolable) throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public boolean isPoolable() throws SQLException { - throw new SQLFeatureNotSupportedException("Not supported."); - } - - @Override - public void closeOnCompletion() throws SQLException { - throw new SQLFeatureNotSupportedException("Not implemented."); - } - - @Override - public boolean isCloseOnCompletion() throws SQLException { - throw new SQLFeatureNotSupportedException("Not implemented."); - } -} http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7e1ad5b1/tajo/src/test/java/org/apache/zeppelin/tajo/TesterTajoInterpreter.java ---------------------------------------------------------------------- diff --git a/tajo/src/test/java/org/apache/zeppelin/tajo/TesterTajoInterpreter.java b/tajo/src/test/java/org/apache/zeppelin/tajo/TesterTajoInterpreter.java deleted file mode 100644 index f0eacee..0000000 --- a/tajo/src/test/java/org/apache/zeppelin/tajo/TesterTajoInterpreter.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.zeppelin.tajo; - -import java.sql.Connection; -import java.sql.SQLException; -import java.util.Properties; - -public class TesterTajoInterpreter extends TajoInterpreter { - - public TesterTajoInterpreter(Properties property) { - super(property); - } - - @Override - public Connection getJdbcConnection() - throws SQLException { - return new TesterConnection(); - } -} http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7e1ad5b1/zeppelin-distribution/src/bin_license/LICENSE ---------------------------------------------------------------------- diff --git a/zeppelin-distribution/src/bin_license/LICENSE b/zeppelin-distribution/src/bin_license/LICENSE index 040b3ee..1d54008 100644 --- a/zeppelin-distribution/src/bin_license/LICENSE +++ b/zeppelin-distribution/src/bin_license/LICENSE @@ -42,7 +42,6 @@ The following components are provided under Apache License. (Apache 2.0) Apache Kylin (http://kylin.apache.org/) (Apache 2.0) Apache Lens (http://lens.apache.org/) (Apache 2.0) Apache Phoenix (http://phoenix.apache.org/) - (Apache 2.0) Apache Tajo (http://tajo.apache.org/) (Apache 2.0) Apache Flink (http://flink.apache.org/) (Apache 2.0) Apache Thrift (http://thrift.apache.org/) (Apache 2.0) Apache Lucene (https://lucene.apache.org/) http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7e1ad5b1/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java ---------------------------------------------------------------------- diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java index fa52957..7572ade 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java @@ -492,7 +492,6 @@ public class ZeppelinConfiguration extends XMLConfiguration { + "org.apache.zeppelin.file.HDFSFileInterpreter," + "org.apache.zeppelin.phoenix.PhoenixInterpreter," + "org.apache.zeppelin.postgresql.PostgreSqlInterpreter," - + "org.apache.zeppelin.tajo.TajoInterpreter," + "org.apache.zeppelin.flink.FlinkInterpreter," + "org.apache.zeppelin.python.PythonInterpreter," + "org.apache.zeppelin.ignite.IgniteInterpreter,"
