List of usage examples for java.sql ResultSet isWrapperFor
boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException;
From source file:com.github.woonsan.jdbc.jcr.impl.JcrJdbcResultSetTest.java
@Test public void testWrapper() throws Exception { Statement statement = getConnection().createStatement(); ResultSet rs = statement.executeQuery(SQL_EMPS); assertTrue(rs.isWrapperFor(JcrResultSet.class)); try {/* www .j a v a2 s .c o m*/ rs.isWrapperFor(null); fail(); } catch (IllegalArgumentException ignore) { } assertFalse(rs.isWrapperFor(QueryResult.class)); JcrResultSet jrs = rs.unwrap(JcrResultSet.class); assertNotNull(jrs); int count = 0; while (jrs.next()) { ++count; Node node = jrs.getCurrentRow().getNode(); String nodeName = node.getName(); String nodePath = node.getPath(); String nodeId = node.getIdentifier(); double score = jrs.getCurrentRow().getScore(); assertEquals("testdata-" + count, nodeName); assertEquals("/testdatafolder/" + nodeName, nodePath); assertTrue(nodeId != null && !nodeId.isEmpty()); assertTrue(score > 0.0); } rs.close(); statement.close(); }