@Test public void testGetContainersForAccount() throws Exception { List<Container> containerList = containerDao.getContainers(accountId); assertEquals(1, containerList.size()); assertEquals(testContainer, containerList.get(0)); }
public List<Container> getContainers(int accountId) throws SQLException { PreparedStatement getByAccountStatement = dataAccessor.getPreparedStatement(getByAccountSql); getByAccountStatement.setInt(1, accountId); try (ResultSet rs = getByAccountStatement.executeQuery()) { return convertResultSet(rs); } catch (SQLException e) { dataAccessor.reset(); throw e; } }
ContainerDao { public List<Container> getContainers(int accountId) throws SQLException { PreparedStatement getByAccountStatement = dataAccessor.getPreparedStatement(getByAccountSql); getByAccountStatement.setInt(1, accountId); try (ResultSet rs = getByAccountStatement.executeQuery()) { return convertResultSet(rs); } catch (SQLException e) { dataAccessor.reset(); throw e; } } }
ContainerDao { public List<Container> getContainers(int accountId) throws SQLException { PreparedStatement getByAccountStatement = dataAccessor.getPreparedStatement(getByAccountSql); getByAccountStatement.setInt(1, accountId); try (ResultSet rs = getByAccountStatement.executeQuery()) { return convertResultSet(rs); } catch (SQLException e) { dataAccessor.reset(); throw e; } } ContainerDao(MySqlDataAccessor dataAccessor); }
ContainerDao { public List<Container> getContainers(int accountId) throws SQLException { PreparedStatement getByAccountStatement = dataAccessor.getPreparedStatement(getByAccountSql); getByAccountStatement.setInt(1, accountId); try (ResultSet rs = getByAccountStatement.executeQuery()) { return convertResultSet(rs); } catch (SQLException e) { dataAccessor.reset(); throw e; } } ContainerDao(MySqlDataAccessor dataAccessor); void addContainer(int accountId, Container container); void updateContainer(int accountId, Container container); List<Container> getContainers(int accountId); List<Container> getNewContainers(long updatedSince); }
ContainerDao { public List<Container> getContainers(int accountId) throws SQLException { PreparedStatement getByAccountStatement = dataAccessor.getPreparedStatement(getByAccountSql); getByAccountStatement.setInt(1, accountId); try (ResultSet rs = getByAccountStatement.executeQuery()) { return convertResultSet(rs); } catch (SQLException e) { dataAccessor.reset(); throw e; } } ContainerDao(MySqlDataAccessor dataAccessor); void addContainer(int accountId, Container container); void updateContainer(int accountId, Container container); List<Container> getContainers(int accountId); List<Container> getNewContainers(long updatedSince); static final String CONTAINER_TABLE; static final String ACCOUNT_ID; static final String CONTAINER_ID; static final String CONTAINER_INFO; static final String VERSION; static final String CREATION_TIME; static final String LAST_MODIFIED_TIME; }