SnapshotTaskClientImpl implements SnapshotTaskClient { @Override public GetSnapshotContentsTaskResult getSnapshotContents(String snapshotId, int pageNumber, int pageSize, String prefix) throws ContentStoreException { GetSnapshotContentsTaskParameters taskParams = new GetSnapshotContentsTaskParameters(); taskParams.setSnapshotId(snapshotId); taskParams.setPageNumber(pageNumber); taskParams.setPageSize(pageSize); taskParams.setPrefix(prefix); String taskResult = contentStore.performTask(SnapshotConstants.GET_SNAPSHOT_CONTENTS_TASK_NAME, taskParams.serialize()); return GetSnapshotContentsTaskResult.deserialize(taskResult); } SnapshotTaskClientImpl(ContentStore contentStore); @Override CreateSnapshotTaskResult createSnapshot(String spaceId,
                                                   String description,
                                                   String userEmail); @Override GetSnapshotTaskResult getSnapshot(String snapshotId); @Override CleanupSnapshotTaskResult cleanupSnapshot(String spaceId); @Override CompleteSnapshotTaskResult completeSnapshot(String spaceId); @Override GetSnapshotListTaskResult getSnapshots(); @Override GetSnapshotContentsTaskResult getSnapshotContents(String snapshotId,
                                                             int pageNumber,
                                                             int pageSize,
                                                             String prefix); @Override GetSnapshotHistoryTaskResult getSnapshotHistory(String snapshotId,
                                                           int pageNumber,
                                                           int pageSize); @Override RestoreSnapshotTaskResult restoreSnapshot(String snapshotId,
                                                     String userEmail); @Override RequestRestoreSnapshotTaskResult requestRestoreSnapshot(String snapshotId,
                                                                   String userEmail); CompleteRestoreTaskResult completeRestore(String spaceId,
                                                     int daysToExpire); @Override GetRestoreTaskResult getRestore(String restoreId); @Override GetRestoreTaskResult getRestoreBySnapshot(String snapshotId);  }
@Test public void testGetSnapshotContents() throws Exception { String taskName = SnapshotConstants.GET_SNAPSHOT_CONTENTS_TASK_NAME; Map<String, String> contentProps = new HashMap<>(); contentProps.put(propName, propValue); SnapshotContentItem contentItem = new SnapshotContentItem(); contentItem.setContentId(contentId); contentItem.setContentProperties(contentProps); List<SnapshotContentItem> contentItems = new ArrayList<>(); contentItems.add(contentItem); GetSnapshotContentsTaskResult preparedResult = new GetSnapshotContentsTaskResult(); preparedResult.setContentItems(contentItems); setupMock(taskName, preparedResult.serialize()); replayMocks(); GetSnapshotContentsTaskResult result = taskClient.getSnapshotContents(snapshotId, 1, 1000, null); SnapshotContentItem item = result.getContentItems().get(0); assertThat(contentId, equalTo(item.getContentId())); assertThat(propValue, equalTo(item.getContentProperties().get(propName))); }