@VisibleForTesting
void importSinglePhoto(UUID jobId, PhotoModel inputPhoto, SmugMugInterface smugMugInterface)
throws IOException {
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);
}