use of com.arnaugarcia.uplace.service.dto.LocationDTO in project uplace.es by Uplace.
the class LocationResource method getLocation.
/**
* GET /locations/:id : get the "id" location.
*
* @param id the id of the locationDTO to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the locationDTO, or with status 404 (Not Found)
*/
@GetMapping("/locations/{id}")
@Timed
public ResponseEntity<LocationDTO> getLocation(@PathVariable Long id) {
log.debug("REST request to get Location : {}", id);
Location location = locationRepository.findOne(id);
LocationDTO locationDTO = locationMapper.toDto(location);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(locationDTO));
}
use of com.arnaugarcia.uplace.service.dto.LocationDTO in project uplace.es by Uplace.
the class LocationResourceIntTest method dtoEqualsVerifier.
@Test
@Transactional
public void dtoEqualsVerifier() throws Exception {
TestUtil.equalsVerifier(LocationDTO.class);
LocationDTO locationDTO1 = new LocationDTO();
locationDTO1.setId(1L);
LocationDTO locationDTO2 = new LocationDTO();
assertThat(locationDTO1).isNotEqualTo(locationDTO2);
locationDTO2.setId(locationDTO1.getId());
assertThat(locationDTO1).isEqualTo(locationDTO2);
locationDTO2.setId(2L);
assertThat(locationDTO1).isNotEqualTo(locationDTO2);
locationDTO1.setId(null);
assertThat(locationDTO1).isNotEqualTo(locationDTO2);
}
use of com.arnaugarcia.uplace.service.dto.LocationDTO in project uplace.es by Uplace.
the class LocationResourceIntTest method createLocation.
@Test
@Transactional
public void createLocation() throws Exception {
int databaseSizeBeforeCreate = locationRepository.findAll().size();
// Create the Location
LocationDTO locationDTO = locationMapper.toDto(location);
restLocationMockMvc.perform(post("/api/locations").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(locationDTO))).andExpect(status().isCreated());
// Validate the Location in the database
List<Location> locationList = locationRepository.findAll();
assertThat(locationList).hasSize(databaseSizeBeforeCreate + 1);
Location testLocation = locationList.get(locationList.size() - 1);
assertThat(testLocation.getLatitude()).isEqualTo(DEFAULT_LATITUDE);
assertThat(testLocation.getPostalCode()).isEqualTo(DEFAULT_POSTAL_CODE);
assertThat(testLocation.getLongitude()).isEqualTo(DEFAULT_LONGITUDE);
assertThat(testLocation.getCity()).isEqualTo(DEFAULT_CITY);
assertThat(testLocation.getFullAddress()).isEqualTo(DEFAULT_FULL_ADDRESS);
assertThat(testLocation.isHide()).isEqualTo(DEFAULT_HIDE);
assertThat(testLocation.getUrlGMaps()).isEqualTo(DEFAULT_URL_G_MAPS);
}
Aggregations