1 20 21 package org.apache.derbyTesting.functionTests.tests.jdbc4; 22 23 import org.apache.derbyTesting.junit.BaseJDBCTestCase; 24 25 import junit.framework.*; 26 27 import java.sql.*; 28 29 42 public class RowIdNotImplementedTest 43 extends BaseJDBCTestCase { 44 45 50 public RowIdNotImplementedTest(String name) { 51 super(name); 52 } 53 54 55 public void testRowIdInPreparedStatementSetRowId() 56 throws SQLException { 57 PreparedStatement pStmt = 58 prepareStatement("select count(*) from sys.systables"); 59 try { 60 pStmt.setRowId(1, null); 61 fail("PreparedStatement.setRowId should not be implemented"); 62 } catch (SQLFeatureNotSupportedException sfnse) { 63 } 65 } 66 67 public void testRowIdInCallableStatementGetRowIdInt() 68 throws SQLException { 69 CallableStatement cStmt = getCallableStatement(); 70 try { 71 cStmt.getRowId(1); 72 fail("CallableStatement.getRowId(int) should not be implemented."); 73 } catch (SQLFeatureNotSupportedException sfnse) { 74 } 76 } 77 78 public void testRowIdInCallableStatementGetRowIdString() 79 throws SQLException { 80 CallableStatement cStmt = getCallableStatement(); 81 try { 82 cStmt.getRowId("some-parameter-name"); 83 fail("CallableStatement.getRowId(String) should not be " + 84 "implemented."); 85 } catch (SQLFeatureNotSupportedException sfnse) { 86 } 88 } 89 90 public void testRowIdInCallableStatementSetRowId() 91 throws SQLException { 92 CallableStatement cStmt = getCallableStatement(); 93 try { 94 cStmt.setRowId("some-parameter-name", null); 95 fail("CallableStatement.setRowId should not be implemented"); 96 } catch (SQLFeatureNotSupportedException sfnse) { 97 } 99 } 100 101 public void testRowIdInResultSetGetRowIdInt() 102 throws SQLException { 103 ResultSet rs = getResultSet(); 104 try { 105 rs.getRowId(1); 106 fail("ResultSet.getRowId(int) should not be implemented"); 107 } catch (SQLFeatureNotSupportedException sfnse) { 108 } 110 } 111 112 public void testRowIdInResultSetGetRowIdString() 113 throws SQLException { 114 ResultSet rs = getResultSet(); 115 try { 116 rs.getRowId("some-parameter-name"); 117 fail("ResultSet.getRowId(String) should not be implemented"); 118 } catch (SQLFeatureNotSupportedException sfnse) { 119 } 121 } 122 123 public void testRowIdInResultSetUpdateRowIdInt() 124 throws SQLException { 125 ResultSet rs = getResultSet(); 126 try { 127 rs.updateRowId(1, null); 128 fail("ResultSet.updateRowId(int) should not be implemented"); 129 } catch (SQLFeatureNotSupportedException sfnse) { 130 } 132 } 133 134 public void testRowIdInResultSetUpdateRowIdString() 135 throws SQLException { 136 ResultSet rs = getResultSet(); 137 try { 138 rs.updateRowId("some-parameter-name", null); 139 fail("ResultSet.updateRowId(String) should not be implemented"); 140 } catch (SQLFeatureNotSupportedException sfnse) { 141 } 143 } 144 145 public void testRowIdInDatabaseMetaDataRowIdLifeTime() 146 throws SQLException { 147 DatabaseMetaData meta = getConnection().getMetaData(); 148 RowIdLifetime rowIdLifetime = meta.getRowIdLifetime(); 149 assertEquals("RowIdLifetime should be ROWID_UNSUPPORTED", 150 RowIdLifetime.ROWID_UNSUPPORTED, 151 rowIdLifetime); 152 meta = null; 153 } 154 155 161 private CallableStatement getCallableStatement() 162 throws SQLException { 163 return prepareCall("values 1"); 165 } 166 167 173 private ResultSet getResultSet() 174 throws SQLException { 175 return createStatement().executeQuery("values 1"); 177 } 178 179 184 public static Test suite() { 185 return new TestSuite(RowIdNotImplementedTest.class, 186 "RowIdNotImplementedTest suite"); 187 } 188 189 } | Popular Tags |