@Test public void testReadUserRecord() throws SQLException { final OracleCaseSensitivitySetup cs = cfg.getCSSetup(); try { SQLUtil.executeUpdateStatement(conn, "drop user " + cs.formatToken(USER, "user1")); } catch (SQLException e) { } try { SQLUtil.executeUpdateStatement(conn, "drop user " + cs.formatToken(USER, "user2")); } catch (SQLException e) { } SQLUtil.executeUpdateStatement(conn, "create user " + cs.formatToken(USER, "user1") + " identified by password"); SQLUtil.executeUpdateStatement(conn, "create user " + cs.formatToken(USER, "user2") + " identified by password"); UserRecord record1 = userReader.readUserRecord("user1"); assertNotNull(record1); assertEqualsIgnoreCase("user1", record1.getUserName()); assertNotNull(record1.getUserId()); assertNotNull(record1.getDefaultTableSpace()); assertNotNull(record1.getTemporaryTableSpace()); assertNotNull(record1.getCreatedDate()); assertNull(record1.getLockDate()); assertEquals("OPEN", record1.getStatus()); SQLUtil.executeUpdateStatement(conn, "alter user " + cs.formatToken(USER, "user1") + " password expire account lock"); record1 = userReader.readUserRecord("user1"); assertNotNull(record1); assertNotNull(record1.getExpireDate()); assertNotNull(record1.getLockDate()); assertEquals("EXPIRED & LOCKED", record1.getStatus()); SQLUtil.executeUpdateStatement(conn, "drop user " + cs.formatToken(USER, "user1")); SQLUtil.executeUpdateStatement(conn, "drop user " + cs.formatToken(USER, "user2")); assertNull(userReader.readUserRecord("dummyUser")); }
UserRecord readUserRecord(String username) throws SQLException { String query = "select * from DBA_USERS where USERNAME = ?"; PreparedStatement ps = null; ResultSet rs = null; try { ps = adminConn.prepareStatement(query); ps.setString(1, username); rs = ps.executeQuery(); if (rs.next()) { UserRecord userRecord = translateRowToUserRecord(rs); return userRecord; } return null; } finally { SQLUtil.closeQuietly(rs); SQLUtil.closeQuietly(ps); } }
OracleUserReader { UserRecord readUserRecord(String username) throws SQLException { String query = "select * from DBA_USERS where USERNAME = ?"; PreparedStatement ps = null; ResultSet rs = null; try { ps = adminConn.prepareStatement(query); ps.setString(1, username); rs = ps.executeQuery(); if (rs.next()) { UserRecord userRecord = translateRowToUserRecord(rs); return userRecord; } return null; } finally { SQLUtil.closeQuietly(rs); SQLUtil.closeQuietly(ps); } } }
OracleUserReader { UserRecord readUserRecord(String username) throws SQLException { String query = "select * from DBA_USERS where USERNAME = ?"; PreparedStatement ps = null; ResultSet rs = null; try { ps = adminConn.prepareStatement(query); ps.setString(1, username); rs = ps.executeQuery(); if (rs.next()) { UserRecord userRecord = translateRowToUserRecord(rs); return userRecord; } return null; } finally { SQLUtil.closeQuietly(rs); SQLUtil.closeQuietly(ps); } } OracleUserReader(Connection adminConn, ConnectorMessages cm); }
OracleUserReader { UserRecord readUserRecord(String username) throws SQLException { String query = "select * from DBA_USERS where USERNAME = ?"; PreparedStatement ps = null; ResultSet rs = null; try { ps = adminConn.prepareStatement(query); ps.setString(1, username); rs = ps.executeQuery(); if (rs.next()) { UserRecord userRecord = translateRowToUserRecord(rs); return userRecord; } return null; } finally { SQLUtil.closeQuietly(rs); SQLUtil.closeQuietly(ps); } } OracleUserReader(Connection adminConn, ConnectorMessages cm);  }
OracleUserReader { UserRecord readUserRecord(String username) throws SQLException { String query = "select * from DBA_USERS where USERNAME = ?"; PreparedStatement ps = null; ResultSet rs = null; try { ps = adminConn.prepareStatement(query); ps.setString(1, username); rs = ps.executeQuery(); if (rs.next()) { UserRecord userRecord = translateRowToUserRecord(rs); return userRecord; } return null; } finally { SQLUtil.closeQuietly(rs); SQLUtil.closeQuietly(ps); } } OracleUserReader(Connection adminConn, ConnectorMessages cm);   }