SnapshotTaskClientImpl implements SnapshotTaskClient { @Override public GetRestoreTaskResult getRestore(String restoreId) throws ContentStoreException { GetRestoreTaskParameters taskParams = new GetRestoreTaskParameters(); taskParams.setRestoreId(restoreId); String taskResult = contentStore.performTask(SnapshotConstants.GET_RESTORE_TASK_NAME, taskParams.serialize()); return GetRestoreTaskResult.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 testGetRestore() throws Exception { String taskName = SnapshotConstants.GET_RESTORE_TASK_NAME; GetRestoreTaskResult preparedResult = new GetRestoreTaskResult(); preparedResult.setRestoreId(restoreId); preparedResult.setDestinationHost(host); preparedResult.setDestinationPort(port); preparedResult.setDestinationSpaceId(spaceId); preparedResult.setDestinationStoreId(storeId); preparedResult.setEndDate(snapshotDate); preparedResult.setExpirationDate(snapshotDate); preparedResult.setSnapshotId(snapshotId); preparedResult.setStartDate(snapshotDate); preparedResult.setStatus(restoreStatus); preparedResult.setStatusText(restoreStatus.name()); setupMock(taskName, preparedResult.serialize()); replayMocks(); GetRestoreTaskResult result = taskClient.getRestore(restoreId); assertThat(restoreId, equalTo(result.getRestoreId())); assertThat(host, equalTo(result.getDestinationHost())); assertThat(port, equalTo(result.getDestinationPort())); assertThat(spaceId, equalTo(result.getDestinationSpaceId())); assertThat(storeId, equalTo(result.getDestinationStoreId())); assertThat(snapshotDate, equalTo(result.getEndDate())); assertThat(snapshotDate, equalTo(result.getExpirationDate())); assertThat(snapshotId, equalTo(result.getSnapshotId())); assertThat(snapshotDate, equalTo(result.getStartDate())); assertThat(restoreStatus, equalTo(result.getStatus())); assertThat(restoreStatus.name(), equalTo(result.getStatusText())); }