@Test @Sql(scripts = { "/sql/clearAddresses.sql","/sql/clearUserRoles.sql","/sql/clearUsers.sql","/sql/createUsers.sql","/sql/createAddresses.sql"}) public void test_should_return_addresses_for_given_user_id_and_tenant() { final List<Address> actualAddresses = addressRepository.find(1L, "ap.public"); assertNotNull(actualAddresses); assertEquals(2, actualAddresses.size()); }
public List<Address> find(Long userId, String tenantId) { final Map<String, Object> Map = new HashMap<String, Object>(); Map.put("userId", userId); Map.put("tenantId", tenantId); List<Address> addressList = namedParameterJdbcTemplate.query(GET_ADDRESS_BY_USERID, Map, new AddressRowMapper()); return addressList; }
AddressRepository { public List<Address> find(Long userId, String tenantId) { final Map<String, Object> Map = new HashMap<String, Object>(); Map.put("userId", userId); Map.put("tenantId", tenantId); List<Address> addressList = namedParameterJdbcTemplate.query(GET_ADDRESS_BY_USERID, Map, new AddressRowMapper()); return addressList; } }
AddressRepository { public List<Address> find(Long userId, String tenantId) { final Map<String, Object> Map = new HashMap<String, Object>(); Map.put("userId", userId); Map.put("tenantId", tenantId); List<Address> addressList = namedParameterJdbcTemplate.query(GET_ADDRESS_BY_USERID, Map, new AddressRowMapper()); return addressList; } AddressRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate, JdbcTemplate jdbcTemplate); }
AddressRepository { public List<Address> find(Long userId, String tenantId) { final Map<String, Object> Map = new HashMap<String, Object>(); Map.put("userId", userId); Map.put("tenantId", tenantId); List<Address> addressList = namedParameterJdbcTemplate.query(GET_ADDRESS_BY_USERID, Map, new AddressRowMapper()); return addressList; } AddressRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate, JdbcTemplate jdbcTemplate); Address create(Address address, Long userId, String tenantId); void update(List<Address> domainAddresses, Long userId, String tenantId); List<Address> find(Long userId, String tenantId); }
AddressRepository { public List<Address> find(Long userId, String tenantId) { final Map<String, Object> Map = new HashMap<String, Object>(); Map.put("userId", userId); Map.put("tenantId", tenantId); List<Address> addressList = namedParameterJdbcTemplate.query(GET_ADDRESS_BY_USERID, Map, new AddressRowMapper()); return addressList; } AddressRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate, JdbcTemplate jdbcTemplate); Address create(Address address, Long userId, String tenantId); void update(List<Address> domainAddresses, Long userId, String tenantId); List<Address> find(Long userId, String tenantId); static final String GET_ADDRESS_BY_USERID; static final String INSERT_ADDRESS_BYUSERID; static final String SELECT_NEXT_SEQUENCE; static final String DELETE_ADDRESSES; static final String DELETE_ADDRESS; static final String UPDATE_ADDRESS_BYIDAND_TENANTID; }