Package info.galleria.domain

Examples of info.galleria.domain.Album


   
    em.flush();
    em.clear();
   
    //Execute
    Album album = new Album(TEST_ALBUM_NAME, TEST_ALBUM_DESCRIPTION);
    user.addToAlbums(album);
    user = repository.modify(user);
    em.flush();
    em.clear();
   
View Full Code Here


 
  @Test
  public void testModifyUserModifyAlbum() throws Exception
  {
    //Setup
    Album album = new Album(TEST_ALBUM_NAME, TEST_ALBUM_DESCRIPTION);
    User user = new User(TEST_USER_ID , TEST_PASSWORD);
    user.addToAlbums(album);
    em.persist(user);
   
    em.flush();
View Full Code Here

 
  @Test
  public void testModifyUserRemoveAlbum() throws Exception
  {
    //Setup
    Album album = new Album(TEST_ALBUM_NAME, TEST_ALBUM_DESCRIPTION);
    User user = new User(TEST_USER_ID , TEST_PASSWORD);
    user.addToAlbums(album);
    em.persist(user);
   
    em.flush();
View Full Code Here

 
  @Test
  public void testModifyUserRemoveAlbumWithPhoto() throws Exception
  {
    //Setup
    Album album = new Album(TEST_ALBUM_NAME, TEST_ALBUM_DESCRIPTION);
    User user = new User(TEST_USER_ID , TEST_PASSWORD);
    user.addToAlbums(album);
    Photo photo = new Photo(TEST_PHOTO_NAME, TEST_PHOTO_CONTENT);
    photo.setUploadTime(new Date());
    for(Album anAlbum: user.getAlbums())
    {
      if(anAlbum.equals(album))
      {
        anAlbum.addToPhotos(photo);
      }
    }
    em.persist(user);
    long albumId = album.getAlbumId();
    long photoId = photo.getPhotoId();
   
    em.flush();
    em.clear();
   
    //Execute
    user.removeFromAlbums(album);
    user = repository.modify(user);
    em.flush();
    em.clear();
   
    //Verify
    User actualUser = em.find(User.class, TEST_USER_ID);
    Album actualAlbum =  em.find(Album.class, albumId);
    Photo actualPhoto =  em.find(Photo.class, photoId);
    assertEquals(user, actualUser);
    assertFalse(actualUser.getAlbums().contains(album));
    assertNull(actualAlbum);
    assertNull(actualPhoto);
View Full Code Here

  @Test
  public void testModifyUserAddPhoto() throws Exception
  {
    //Setup
    User user = new User(TEST_USER_ID , TEST_PASSWORD);
    Album album = new Album(TEST_ALBUM_NAME, TEST_ALBUM_DESCRIPTION);
    user.addToAlbums(album);
    em.persist(user);
   
    em.flush();
    em.clear();
View Full Code Here

  @Test
  public void testModifyUserModifyPhoto() throws Exception
  {
    //Setup
    User user = new User(TEST_USER_ID , TEST_PASSWORD);
    Album album = new Album(TEST_ALBUM_NAME, TEST_ALBUM_DESCRIPTION);
    user.addToAlbums(album);
    Photo photo = new Photo(TEST_PHOTO_NAME, TEST_PHOTO_CONTENT);
    photo.setUploadTime(new Date());
    for(Album anAlbum: user.getAlbums())
    {
View Full Code Here

  @Test
  public void testModifyUserRemovePhoto() throws Exception
  {
    //Setup
    User user = new User(TEST_USER_ID , TEST_PASSWORD);
    Album album = new Album(TEST_ALBUM_NAME, TEST_ALBUM_DESCRIPTION);
    user.addToAlbums(album);
    Photo photo = new Photo(TEST_PHOTO_NAME, TEST_PHOTO_CONTENT);
    photo.setUploadTime(new Date());
    for(Album anAlbum: user.getAlbums())
    {
View Full Code Here

 
  @Test
  public void testDeleteUserWithAlbumAndPhotos() throws Exception
  {
    //Setup
    Album album = new Album(TEST_ALBUM_NAME, TEST_ALBUM_DESCRIPTION);
    User user = new User(TEST_USER_ID , TEST_PASSWORD);
    user.addToAlbums(album);
    Photo photo = new Photo(TEST_PHOTO_NAME, TEST_PHOTO_CONTENT);
    photo.setUploadTime(new Date());
    for(Album anAlbum: user.getAlbums())
    {
      if(anAlbum.equals(album))
      {
        anAlbum.addToPhotos(photo);
      }
    }
    em.persist(user);
    long albumId = album.getAlbumId();
    long photoId = photo.getPhotoId();
   
    em.flush();
    em.clear();
   
    //Execute
    repository.delete(user);
    em.flush();
    em.clear();
   
    //Verify
    User actualUser = em.find(User.class, TEST_USER_ID);
    Album actualAlbum =  em.find(Album.class, albumId);
    Photo actualPhoto =  em.find(Photo.class, photoId);
    assertNull(actualUser);
    assertNull(actualAlbum);
    assertNull(actualPhoto);
  }
View Full Code Here

  @Override
  public Album modify(Album album)
  {
    em.find(Album.class, album.getAlbumId());
    Album mergedAlbum = em.merge(album);
    return mergedAlbum;
  }
View Full Code Here

  }

  @Override
  public void delete(Album album)
  {
    Album foundAlbum = em.find(Album.class, album.getAlbumId());
    foundAlbum.clearUser();
    em.remove(foundAlbum);
  }
View Full Code Here

TOP

Related Classes of info.galleria.domain.Album

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.