@Test @Sql(scripts = {"/sql/clearCity.sql", "/sql/clearTenant.sql","/sql/insertTenantData.sql"}) public void test_should_update_tenant() throws Exception { City city = City.builder().id(1L).build(); Tenant expected = Tenant.builder() .code("AP.KURNOOL") .name("kurnool") .description("descrdsfghjkliption") .domainUrl("http: .logoId("d45d7118-2013-11e7-93ae-92361f002671") .imageId("8716872c-cd50-4fbb-a0d6-722e6bc9c143") .type("CITY") .twitterUrl("twitterUrl") .facebookUrl("faceBookUrl") .emailId("email") .address("address") .contactNumber("contactNumber") .helpLineNumber("helpLineNumber") .city(city) .build(); Tenant actual= tenantRepository.update(expected); assertEquals(expected,actual); }
@Transactional public org.egov.tenant.domain.model.Tenant update(final org.egov.tenant.domain.model.Tenant tenant) { final Map<String, Object> parametersMap = new HashMap<String, Object>() {{ put(Tenant.NAME, tenant.getName()); put(Tenant.DESCRIPTION, tenant.getDescription()); put(Tenant.DOMAIN_URL, tenant.getDomainUrl()); put(Tenant.LOGO_ID, tenant.getLogoId()); put(Tenant.IMAGE_ID, tenant.getImageId()); put(Tenant.TYPE, tenant.getType().toString()); put(Tenant.LAST_MODIFIED_BY, 1L); put(Tenant.LAST_MODIFIED_DATE, new Date()); put(Tenant.TWITTER_URL,tenant.getTwitterUrl()); put(Tenant.FACEBOOK_URL,tenant.getFacebookUrl()); put(Tenant.EMAILID,tenant.getEmailId()); put(Tenant.ADDRESS, tenant.getAddress()); put(Tenant.CONTACTNUMBER, tenant.getContactNumber()); put(Tenant.HELPLINENUMBER,tenant.getHelpLineNumber()); put(Tenant.CODE, tenant.getCode()); }}; namedParameterJdbcTemplate.update(UPDATE_QUERY, parametersMap); cityRepository.update(tenant.getCity(), tenant.getCode()); return tenant; }
TenantRepository { @Transactional public org.egov.tenant.domain.model.Tenant update(final org.egov.tenant.domain.model.Tenant tenant) { final Map<String, Object> parametersMap = new HashMap<String, Object>() {{ put(Tenant.NAME, tenant.getName()); put(Tenant.DESCRIPTION, tenant.getDescription()); put(Tenant.DOMAIN_URL, tenant.getDomainUrl()); put(Tenant.LOGO_ID, tenant.getLogoId()); put(Tenant.IMAGE_ID, tenant.getImageId()); put(Tenant.TYPE, tenant.getType().toString()); put(Tenant.LAST_MODIFIED_BY, 1L); put(Tenant.LAST_MODIFIED_DATE, new Date()); put(Tenant.TWITTER_URL,tenant.getTwitterUrl()); put(Tenant.FACEBOOK_URL,tenant.getFacebookUrl()); put(Tenant.EMAILID,tenant.getEmailId()); put(Tenant.ADDRESS, tenant.getAddress()); put(Tenant.CONTACTNUMBER, tenant.getContactNumber()); put(Tenant.HELPLINENUMBER,tenant.getHelpLineNumber()); put(Tenant.CODE, tenant.getCode()); }}; namedParameterJdbcTemplate.update(UPDATE_QUERY, parametersMap); cityRepository.update(tenant.getCity(), tenant.getCode()); return tenant; } }
TenantRepository { @Transactional public org.egov.tenant.domain.model.Tenant update(final org.egov.tenant.domain.model.Tenant tenant) { final Map<String, Object> parametersMap = new HashMap<String, Object>() {{ put(Tenant.NAME, tenant.getName()); put(Tenant.DESCRIPTION, tenant.getDescription()); put(Tenant.DOMAIN_URL, tenant.getDomainUrl()); put(Tenant.LOGO_ID, tenant.getLogoId()); put(Tenant.IMAGE_ID, tenant.getImageId()); put(Tenant.TYPE, tenant.getType().toString()); put(Tenant.LAST_MODIFIED_BY, 1L); put(Tenant.LAST_MODIFIED_DATE, new Date()); put(Tenant.TWITTER_URL,tenant.getTwitterUrl()); put(Tenant.FACEBOOK_URL,tenant.getFacebookUrl()); put(Tenant.EMAILID,tenant.getEmailId()); put(Tenant.ADDRESS, tenant.getAddress()); put(Tenant.CONTACTNUMBER, tenant.getContactNumber()); put(Tenant.HELPLINENUMBER,tenant.getHelpLineNumber()); put(Tenant.CODE, tenant.getCode()); }}; namedParameterJdbcTemplate.update(UPDATE_QUERY, parametersMap); cityRepository.update(tenant.getCity(), tenant.getCode()); return tenant; } TenantRepository(CityRepository cityRepository, NamedParameterJdbcTemplate namedParameterJdbcTemplate); }
TenantRepository { @Transactional public org.egov.tenant.domain.model.Tenant update(final org.egov.tenant.domain.model.Tenant tenant) { final Map<String, Object> parametersMap = new HashMap<String, Object>() {{ put(Tenant.NAME, tenant.getName()); put(Tenant.DESCRIPTION, tenant.getDescription()); put(Tenant.DOMAIN_URL, tenant.getDomainUrl()); put(Tenant.LOGO_ID, tenant.getLogoId()); put(Tenant.IMAGE_ID, tenant.getImageId()); put(Tenant.TYPE, tenant.getType().toString()); put(Tenant.LAST_MODIFIED_BY, 1L); put(Tenant.LAST_MODIFIED_DATE, new Date()); put(Tenant.TWITTER_URL,tenant.getTwitterUrl()); put(Tenant.FACEBOOK_URL,tenant.getFacebookUrl()); put(Tenant.EMAILID,tenant.getEmailId()); put(Tenant.ADDRESS, tenant.getAddress()); put(Tenant.CONTACTNUMBER, tenant.getContactNumber()); put(Tenant.HELPLINENUMBER,tenant.getHelpLineNumber()); put(Tenant.CODE, tenant.getCode()); }}; namedParameterJdbcTemplate.update(UPDATE_QUERY, parametersMap); cityRepository.update(tenant.getCity(), tenant.getCode()); return tenant; } TenantRepository(CityRepository cityRepository, NamedParameterJdbcTemplate namedParameterJdbcTemplate); List<org.egov.tenant.domain.model.Tenant> find(TenantSearchCriteria tenantSearchCriteria); @Transactional org.egov.tenant.domain.model.Tenant save(final org.egov.tenant.domain.model.Tenant tenant); @Transactional org.egov.tenant.domain.model.Tenant update(final org.egov.tenant.domain.model.Tenant tenant); Long isTenantPresent(String tenantCode); }
TenantRepository { @Transactional public org.egov.tenant.domain.model.Tenant update(final org.egov.tenant.domain.model.Tenant tenant) { final Map<String, Object> parametersMap = new HashMap<String, Object>() {{ put(Tenant.NAME, tenant.getName()); put(Tenant.DESCRIPTION, tenant.getDescription()); put(Tenant.DOMAIN_URL, tenant.getDomainUrl()); put(Tenant.LOGO_ID, tenant.getLogoId()); put(Tenant.IMAGE_ID, tenant.getImageId()); put(Tenant.TYPE, tenant.getType().toString()); put(Tenant.LAST_MODIFIED_BY, 1L); put(Tenant.LAST_MODIFIED_DATE, new Date()); put(Tenant.TWITTER_URL,tenant.getTwitterUrl()); put(Tenant.FACEBOOK_URL,tenant.getFacebookUrl()); put(Tenant.EMAILID,tenant.getEmailId()); put(Tenant.ADDRESS, tenant.getAddress()); put(Tenant.CONTACTNUMBER, tenant.getContactNumber()); put(Tenant.HELPLINENUMBER,tenant.getHelpLineNumber()); put(Tenant.CODE, tenant.getCode()); }}; namedParameterJdbcTemplate.update(UPDATE_QUERY, parametersMap); cityRepository.update(tenant.getCity(), tenant.getCode()); return tenant; } TenantRepository(CityRepository cityRepository, NamedParameterJdbcTemplate namedParameterJdbcTemplate); List<org.egov.tenant.domain.model.Tenant> find(TenantSearchCriteria tenantSearchCriteria); @Transactional org.egov.tenant.domain.model.Tenant save(final org.egov.tenant.domain.model.Tenant tenant); @Transactional org.egov.tenant.domain.model.Tenant update(final org.egov.tenant.domain.model.Tenant tenant); Long isTenantPresent(String tenantCode);  }