use of com.palantir.atlasdb.backup.RestoreRequest in project atlasdb by palantir.
the class BackupAndRestoreEteTest method canPrepareAndCompleteRestore.
@Test
public void canPrepareAndCompleteRestore() {
addTodo();
backupResource.prepareBackup(NAMESPACES);
backupResource.completeBackup(NAMESPACES);
assertThat(timestampClient.getFreshTimestamp()).isGreaterThan(0L);
String backupId = "backupId";
RestoreRequest restoreRequest = RestoreRequest.builder().oldNamespace(NAMESPACE).newNamespace(NAMESPACE).build();
Set<Namespace> preparedNamespaces = backupResource.prepareRestore(RestoreRequestWithId.of(restoreRequest, backupId));
assertThat(preparedNamespaces).containsExactly(NAMESPACE);
// verify TimeLock is disabled
assertThatRemoteExceptionThrownBy(timestampClient::getFreshTimestamp).isGeneratedFromErrorType(ErrorType.INTERNAL);
Set<Namespace> completedNamespaces = backupResource.completeRestore(RestoreRequestWithId.of(restoreRequest, backupId));
assertThat(completedNamespaces).containsExactly(NAMESPACE);
// verify TimeLock is re-enabled
assertThat(timestampClient.getFreshTimestamp()).isGreaterThan(0L);
}
Aggregations