@Test @Sql(scripts = {"/sql/clearCity.sql", "/sql/clearTenant.sql", "/sql/insertTenantData.sql", "/sql/insertCityData.sql", "/sql/updateCityData.sql"}) public void test_should_retrieve_city() { City city = cityRepository.find("AP.KURNOOL"); Calendar calendar = Calendar.getInstance(); calendar.set(1990, Calendar.JULY, 23, 0, 0, 0); Date date = calendar.getTime(); assertThat(city.getId()).isEqualTo(1L); assertThat(city.getName()).isEqualTo("Bengaluru"); assertThat(city.getLocalName()).isEqualTo("localname"); assertThat(city.getDistrictCode()).isEqualTo("ABC"); assertThat(city.getDistrictName()).isEqualTo("Udupi"); assertThat(city.getRegionName()).isEqualTo("Region"); assertThat(city.getLongitude()).isEqualTo(34.567); assertThat(city.getLatitude()).isEqualTo(74.566); assertThat(city.getTenantCode()).isEqualTo("AP.KURNOOL"); assertThat(city.getUlbGrade()).isEqualTo("Municipality"); assertThat(city.getCreatedBy()).isEqualTo(1L); assertThat(city.getCreatedDate()).isInSameSecondAs(date); assertThat(city.getLastModifiedBy()).isEqualTo(1L); assertThat(city.getShapeFileLocation()).isEqualTo("shapeFileLocation"); assertThat(city.getCaptcha()).isEqualTo("captcha"); assertThat(city.getCode()).isEqualTo("1016"); }
public City find(String tenantCode) { Map<String, Object> parameterMap = new HashMap<String, Object>() {{ put(TENANT_CODE, tenantCode); }}; return namedParameterJdbcTemplate.query(SELECT_QUERY, parameterMap, new CityRowMapper()).get(0).toDomain(); }
CityRepository { public City find(String tenantCode) { Map<String, Object> parameterMap = new HashMap<String, Object>() {{ put(TENANT_CODE, tenantCode); }}; return namedParameterJdbcTemplate.query(SELECT_QUERY, parameterMap, new CityRowMapper()).get(0).toDomain(); } }
CityRepository { public City find(String tenantCode) { Map<String, Object> parameterMap = new HashMap<String, Object>() {{ put(TENANT_CODE, tenantCode); }}; return namedParameterJdbcTemplate.query(SELECT_QUERY, parameterMap, new CityRowMapper()).get(0).toDomain(); } CityRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate); }
CityRepository { public City find(String tenantCode) { Map<String, Object> parameterMap = new HashMap<String, Object>() {{ put(TENANT_CODE, tenantCode); }}; return namedParameterJdbcTemplate.query(SELECT_QUERY, parameterMap, new CityRowMapper()).get(0).toDomain(); } CityRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate); City save(City city, String tenantCode); City update(City city, String tenantCode); City find(String tenantCode); }
CityRepository { public City find(String tenantCode) { Map<String, Object> parameterMap = new HashMap<String, Object>() {{ put(TENANT_CODE, tenantCode); }}; return namedParameterJdbcTemplate.query(SELECT_QUERY, parameterMap, new CityRowMapper()).get(0).toDomain(); } CityRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate); City save(City city, String tenantCode); City update(City city, String tenantCode); City find(String tenantCode);  }