@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PhotoModel that = (PhotoModel) o; return Objects.equal(getTitle(), that.getTitle()) && Objects.equal(getFetchableUrl(), that.getFetchableUrl()) && Objects.equal(getDescription(), that.getDescription()) && Objects.equal(getMediaType(), that.getMediaType()) && Objects.equal(getDataId(), that.getDataId()) && Objects.equal(getAlbumId(), that.getAlbumId()); } }
@VisibleForTesting void importSinglePhoto(UUID jobId, PhotoModel inputPhoto, SmugMugInterface smugMugInterface) throws IOException { // Find album to upload photo to TempPhotosData tempPhotosData = jobStore.findData(jobId, createCacheKey(), TempPhotosData.class); checkState( tempPhotosData != null, "cached temp photos data for %s is null", inputPhoto.getAlbumId()); String newAlbumUri = tempPhotosData.lookupNewAlbumId(inputPhoto.getAlbumId()); checkState( !Strings.isNullOrEmpty(newAlbumUri), "Cached album URI for %s is null", inputPhoto.getAlbumId()); InputStream inputStream; if (inputPhoto.isInTempStore()) { inputStream = jobStore.getStream(jobId, inputPhoto.getFetchableUrl()); } else { inputStream = smugMugInterface.getImageAsStream(inputPhoto.getFetchableUrl()); } SmugMugImageUploadResponse response = smugMugInterface.uploadImage(inputPhoto, newAlbumUri, inputStream); }
String importedAlbumId = photoData.getImportedId(photoModel.getAlbumId()); String uploadUrl = String.format(uploadPhotoUrlTemplate, importedAlbumId, photoModel.getTitle());
if (Strings.isNullOrEmpty(inputPhoto.getAlbumId())) { albumId = tempPhotosData.lookupNewAlbumId(inputPhoto.getAlbumId());
@Test public void toCommonPhoto() { Photo photo = FlickrTestUtils.initializePhoto(PHOTO_TITLE, FETCHABLE_URL, PHOTO_DESCRIPTION, MEDIA_TYPE); PhotoModel photoModel = FlickrPhotosExporter.toCommonPhoto(photo, ALBUM_ID); assertThat(photoModel.getAlbumId()).isEqualTo(ALBUM_ID); assertThat(photoModel.getFetchableUrl()).isEqualTo(FETCHABLE_URL); assertThat(photoModel.getTitle()).isEqualTo(PHOTO_TITLE); assertThat(photoModel.getDescription()).isEqualTo(PHOTO_DESCRIPTION); assertThat(photoModel.getMediaType()).isEqualTo("image/jpeg"); }
private void importSinglePhoto(UUID id, PhotoModel photo) throws FlickrException, IOException { String photoId = uploadPhoto(photo); String oldAlbumId = photo.getAlbumId();
Assert.assertEquals("image1", photo1.getDataId()); Assert.assertEquals("image/png", photo1.getMediaType()); Assert.assertEquals(album.getId(), photo1.getAlbumId()); Assert.assertEquals("image2", photo2.getDataId()); Assert.assertEquals("image/jpeg", photo2.getMediaType()); Assert.assertEquals(album.getId(), photo2.getAlbumId());