Search in sources :

Example 6 with Photo

use of com.arnaugarcia.uplace.domain.Photo in project uplace.es by Uplace.

the class PhotoResourceIntTest method updatePhoto.

@Test
@Transactional
public void updatePhoto() throws Exception {
    // Initialize the database
    photoRepository.saveAndFlush(photo);
    int databaseSizeBeforeUpdate = photoRepository.findAll().size();
    // Update the photo
    Photo updatedPhoto = photoRepository.findOne(photo.getId());
    // Disconnect from session so that the updates on updatedPhoto are not directly saved in db
    em.detach(updatedPhoto);
    updatedPhoto.name(UPDATED_NAME).description(UPDATED_DESCRIPTION).photo(UPDATED_PHOTO).photoContentType(UPDATED_PHOTO_CONTENT_TYPE).thumbnail(UPDATED_THUMBNAIL);
    restPhotoMockMvc.perform(put("/api/photos").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(updatedPhoto))).andExpect(status().isOk());
    // Validate the Photo in the database
    List<Photo> photoList = photoRepository.findAll();
    assertThat(photoList).hasSize(databaseSizeBeforeUpdate);
    Photo testPhoto = photoList.get(photoList.size() - 1);
    assertThat(testPhoto.getName()).isEqualTo(UPDATED_NAME);
    assertThat(testPhoto.getDescription()).isEqualTo(UPDATED_DESCRIPTION);
    assertThat(testPhoto.getPhoto()).isEqualTo(UPDATED_PHOTO);
    assertThat(testPhoto.getPhotoContentType()).isEqualTo(UPDATED_PHOTO_CONTENT_TYPE);
    assertThat(testPhoto.isThumbnail()).isEqualTo(UPDATED_THUMBNAIL);
}
Also used : Photo(com.arnaugarcia.uplace.domain.Photo) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 7 with Photo

use of com.arnaugarcia.uplace.domain.Photo in project uplace.es by Uplace.

the class PhotoResourceIntTest method equalsVerifier.

@Test
@Transactional
public void equalsVerifier() throws Exception {
    TestUtil.equalsVerifier(Photo.class);
    Photo photo1 = new Photo();
    photo1.setId(1L);
    Photo photo2 = new Photo();
    photo2.setId(photo1.getId());
    assertThat(photo1).isEqualTo(photo2);
    photo2.setId(2L);
    assertThat(photo1).isNotEqualTo(photo2);
    photo1.setId(null);
    assertThat(photo1).isNotEqualTo(photo2);
}
Also used : Photo(com.arnaugarcia.uplace.domain.Photo) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 8 with Photo

use of com.arnaugarcia.uplace.domain.Photo in project uplace.es by Uplace.

the class PhotoResourceIntTest method createPhoto.

@Test
@Transactional
public void createPhoto() throws Exception {
    int databaseSizeBeforeCreate = photoRepository.findAll().size();
    // Create the Photo
    restPhotoMockMvc.perform(post("/api/photos").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(photo))).andExpect(status().isCreated());
    // Validate the Photo in the database
    List<Photo> photoList = photoRepository.findAll();
    assertThat(photoList).hasSize(databaseSizeBeforeCreate + 1);
    Photo testPhoto = photoList.get(photoList.size() - 1);
    assertThat(testPhoto.getName()).isEqualTo(DEFAULT_NAME);
    assertThat(testPhoto.getDescription()).isEqualTo(DEFAULT_DESCRIPTION);
    assertThat(testPhoto.getPhoto()).isEqualTo(DEFAULT_PHOTO);
    assertThat(testPhoto.getPhotoContentType()).isEqualTo(DEFAULT_PHOTO_CONTENT_TYPE);
    assertThat(testPhoto.isThumbnail()).isEqualTo(DEFAULT_THUMBNAIL);
}
Also used : Photo(com.arnaugarcia.uplace.domain.Photo) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

Photo (com.arnaugarcia.uplace.domain.Photo)8 Transactional (org.springframework.transaction.annotation.Transactional)5 Test (org.junit.Test)4 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)4 Timed (com.codahale.metrics.annotation.Timed)3 Marker (com.arnaugarcia.uplace.domain.Marker)1 PropertyRepository (com.arnaugarcia.uplace.repository.PropertyRepository)1 MarkerDTO (com.arnaugarcia.uplace.service.dto.MarkerDTO)1 TransformMarkerToMarkerDTO.markerToMarkerDTO (com.arnaugarcia.uplace.service.util.TransformMarkerToMarkerDTO.markerToMarkerDTO)1 BadRequestAlertException (com.arnaugarcia.uplace.web.rest.errors.BadRequestAlertException)1 URI (java.net.URI)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1 PageRequest (org.springframework.data.domain.PageRequest)1 Pageable (org.springframework.data.domain.Pageable)1 Service (org.springframework.stereotype.Service)1