Skip to content

Commit

Permalink
Merge branch 'fix/include-timestamp-drive-root-folder' of github.com:…
Browse files Browse the repository at this point in the history
…alexeyqu-fb/data-transfer-project into fix/include-timestamp-drive-root-folder
  • Loading branch information
alexeyqu-fb committed Dec 1, 2023
2 parents 622a1bb + e2c773b commit 248050b
Show file tree
Hide file tree
Showing 18 changed files with 344 additions and 154 deletions.
88 changes: 44 additions & 44 deletions client-rest/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client-rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"codelyzer": "6.0.2",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~6.3.16",
"karma": "^6.4.2",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~1.4.2",
"karma-jasmine": "~1.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public ImportResult importItem(
idempotentExecutor,
data.getAlbums(),
DataVertical.MEDIA.getDataType());
final Map<String, Long> importResultMap =
final Map<String, Long> importPhotosMap =
mediaInterface.importAllMedia(
jobId,
idempotentExecutor,
Expand All @@ -94,15 +94,15 @@ public ImportResult importItem(
.put(MediaContainerResource.ALBUMS_COUNT_DATA_NAME, albumCount)
.put(
MediaContainerResource.PHOTOS_COUNT_DATA_NAME,
importResultMap.getOrDefault(ApplePhotosConstants.COUNT_KEY, 0L).intValue())
importPhotosMap.getOrDefault(ApplePhotosConstants.COUNT_KEY, 0L).intValue())
.put(
MediaContainerResource.VIDEOS_COUNT_DATA_NAME,
importResultMap.getOrDefault(ApplePhotosConstants.COUNT_KEY, 0L).intValue())
importVideosResult.getOrDefault(ApplePhotosConstants.COUNT_KEY, 0L).intValue())
.build();

return ImportResult.OK
.copyWithBytes(
importResultMap.getOrDefault(ApplePhotosConstants.BYTES_KEY, 0L)
importPhotosMap.getOrDefault(ApplePhotosConstants.BYTES_KEY, 0L)
+ importVideosResult.getOrDefault(ApplePhotosConstants.BYTES_KEY, 0L))
.copyWithCounts(counts);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,19 +113,19 @@ public void importPhotosVideosAndAlbums() throws Exception {
verify(mediaInterface, times(2)).createMedia(anyString(), anyString(), anyList());

// check the result
assertThat(importResult.getCounts().isPresent());
assertThat(importResult.getCounts().isPresent()).isTrue();
assertThat(
importResult.getCounts().get().get(PhotosContainerResource.ALBUMS_COUNT_DATA_NAME) == 1);
importResult.getCounts().get().get(PhotosContainerResource.ALBUMS_COUNT_DATA_NAME) == 1).isTrue();
assertThat(
importResult.getCounts().get().get(PhotosContainerResource.PHOTOS_COUNT_DATA_NAME)
== photoCount);
== photoCount).isTrue();
assertThat(
importResult.getCounts().get().get(VideosContainerResource.VIDEOS_COUNT_DATA_NAME)
== videoCount);
== videoCount).isTrue();

assertThat(
importResult.getBytes().get()
== photoCount * PHOTOS_FILE_SIZE + videoCount * VIDEOS_FILE_SIZE);
== photoCount * PHOTOS_FILE_SIZE + videoCount * VIDEOS_FILE_SIZE).isTrue();

final Map<String, Serializable> expectedKnownValue =
mediaAlbums.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ public void importAlbums() throws Exception {
.collect(Collectors.toList()));

// check the result
assertThat(importResult.getCounts().isPresent());
assertThat(importResult.getCounts().get().get(ALBUMS_COUNT_DATA_NAME) == albumCount);
assertThat(importResult.getCounts().isPresent()).isTrue();
assertThat(importResult.getCounts().get().get(ALBUMS_COUNT_DATA_NAME) == albumCount).isTrue();
final Map<String, Serializable> expectedKnownValue =
photoAlbums.stream()
.collect(
Expand Down Expand Up @@ -152,8 +152,8 @@ public void importAlbumWithoutName() throws Exception {
.collect(Collectors.toList()));

// check the result
assertThat(importResult.getCounts().isPresent());
assertThat(importResult.getCounts().get().get(ALBUMS_COUNT_DATA_NAME) == albumCount);
assertThat(importResult.getCounts().isPresent()).isTrue();
assertThat(importResult.getCounts().get().get(ALBUMS_COUNT_DATA_NAME) == albumCount).isTrue();
final Map<String, Serializable> expectedKnownValue =
photoAlbums.stream()
.collect(
Expand Down Expand Up @@ -196,8 +196,8 @@ public void importAlbumsMultipleBatches() throws Exception {
.collect(Collectors.toList()));

// check the result
assertThat(importResult.getCounts().isPresent());
assertThat(importResult.getCounts().get().get(ALBUMS_COUNT_DATA_NAME) == albumCount);
assertThat(importResult.getCounts().isPresent()).isTrue();
assertThat(importResult.getCounts().get().get(ALBUMS_COUNT_DATA_NAME) == albumCount).isTrue();
final Map<String, Serializable> expectedKnownValue =
photoAlbums.stream()
.collect(
Expand Down Expand Up @@ -242,9 +242,9 @@ public void importAlbumsWithFailure() throws Exception {
.collect(Collectors.toList()));

// check the result
assertThat(importResult.getCounts().isPresent());
assertThat(importResult.getCounts().isPresent()).isTrue();
assertThat(
importResult.getCounts().get().get(ALBUMS_COUNT_DATA_NAME) == albumCount - errorCount);
importResult.getCounts().get().get(ALBUMS_COUNT_DATA_NAME) == albumCount - errorCount).isTrue();
final Map<String, Serializable> expectedKnownValue =
photoAlbums.stream()
.filter(
Expand Down Expand Up @@ -303,10 +303,10 @@ public void importSinglePhoto() throws Exception {
verify(mediaInterface).createMedia(anyString(), anyString(), anyList());

// check the result
assertThat(importResult.getCounts().isPresent());
assertThat(importResult.getCounts().get().get(ALBUMS_COUNT_DATA_NAME) == 0);
assertThat(importResult.getCounts().get().get(PHOTOS_COUNT_DATA_NAME) == photoCount);
assertThat(importResult.getBytes().get() == photoCount * PHOTOS_FILE_SIZE);
assertThat(importResult.getCounts().isPresent()).isTrue();
assertThat(importResult.getCounts().get().get(ALBUMS_COUNT_DATA_NAME) == 0).isTrue();
assertThat(importResult.getCounts().get().get(PHOTOS_COUNT_DATA_NAME) == photoCount).isTrue();
assertThat(importResult.getBytes().get() == photoCount * PHOTOS_FILE_SIZE).isTrue();

final Map<String, Serializable> expectedKnownValue =
photos.stream()
Expand Down Expand Up @@ -358,10 +358,10 @@ public void importPhotosMultipleBatches() throws Exception {
verify(mediaInterface, times(2)).createMedia(anyString(), anyString(), anyList());

// check the result
assertThat(importResult.getCounts().isPresent());
assertThat(importResult.getCounts().get().get(ALBUMS_COUNT_DATA_NAME) == 0);
assertThat(importResult.getCounts().get().get(PHOTOS_COUNT_DATA_NAME) == photoCount);
assertThat(importResult.getBytes().get() == photoCount * PHOTOS_FILE_SIZE);
assertThat(importResult.getCounts().isPresent()).isTrue();
assertThat(importResult.getCounts().get().get(ALBUMS_COUNT_DATA_NAME) == 0).isTrue();
assertThat(importResult.getCounts().get().get(PHOTOS_COUNT_DATA_NAME) == photoCount).isTrue();
assertThat(importResult.getBytes().get() == photoCount * PHOTOS_FILE_SIZE).isTrue();

final Map<String, Serializable> expectedKnownValue =
photos.stream()
Expand Down Expand Up @@ -422,10 +422,10 @@ public void importPhotosWithFailure() throws Exception {
verify(mediaInterface, times(2)).createMedia(anyString(), anyString(), anyList());

// check the result
assertThat(importResult.getCounts().isPresent());
assertThat(importResult.getCounts().get().get(ALBUMS_COUNT_DATA_NAME) == 0);
assertThat(importResult.getCounts().get().get(PHOTOS_COUNT_DATA_NAME) == successCount);
assertThat(importResult.getBytes().get() == successCount * PHOTOS_FILE_SIZE);
assertThat(importResult.getCounts().isPresent()).isTrue();
assertThat(importResult.getCounts().get().get(ALBUMS_COUNT_DATA_NAME) == 0).isTrue();
assertThat(importResult.getCounts().get().get(PHOTOS_COUNT_DATA_NAME) == successCount).isTrue();
assertThat(importResult.getBytes().get() == successCount * PHOTOS_FILE_SIZE).isTrue();

final Map<String, Serializable> expectedKnownValue =
photos.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ public void importSingleVideo() throws Exception {
verify(mediaInterface).createMedia(anyString(), anyString(), anyList());

// check the result
assertThat(importResult.getCounts().isPresent());
assertThat(importResult.getCounts().get().get(VIDEOS_COUNT_DATA_NAME) == videoCount);
assertThat(importResult.getBytes().get() == videoCount * VIDEOS_FILE_SIZE);
assertThat(importResult.getCounts().isPresent()).isTrue();
assertThat(importResult.getCounts().get().get(VIDEOS_COUNT_DATA_NAME) == videoCount).isTrue();
assertThat(importResult.getBytes().get() == videoCount * VIDEOS_FILE_SIZE).isTrue();

final Map<String, Serializable> expectedKnownValue =
videos.stream()
Expand Down Expand Up @@ -117,9 +117,9 @@ public void importVideosMultipleBatches() throws Exception {
verify(mediaInterface, times(2)).createMedia(anyString(), anyString(), anyList());

// check the result
assertThat(importResult.getCounts().isPresent());
assertThat(importResult.getCounts().get().get(VIDEOS_COUNT_DATA_NAME) == videoCount);
assertThat(importResult.getBytes().get() == videoCount * VIDEOS_FILE_SIZE);
assertThat(importResult.getCounts().isPresent()).isTrue();
assertThat(importResult.getCounts().get().get(VIDEOS_COUNT_DATA_NAME) == videoCount).isTrue();
assertThat(importResult.getBytes().get() == videoCount * VIDEOS_FILE_SIZE).isTrue();
}

@Test
Expand Down Expand Up @@ -172,9 +172,9 @@ public void importVideosWithFailure() throws Exception {
verify(mediaInterface, times(2)).createMedia(anyString(), anyString(), anyList());

// check the result
assertThat(importResult.getCounts().isPresent());
assertThat(importResult.getCounts().get().get(VIDEOS_COUNT_DATA_NAME) == videoCount);
assertThat(importResult.getBytes().get() == successCount * VIDEOS_FILE_SIZE);
assertThat(importResult.getCounts().isPresent()).isTrue();
assertThat(importResult.getCounts().get().get(VIDEOS_COUNT_DATA_NAME) == successCount).isTrue();
assertThat(importResult.getBytes().get() == successCount * VIDEOS_FILE_SIZE).isTrue();

final Map<String, Serializable> expectedKnownValue =
videos.stream()
Expand Down
Loading

0 comments on commit 248050b

Please sign in to comment.