Search in sources :

Example 1 with RestoreRequest

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);
}
Also used : RestoreRequest(com.palantir.atlasdb.backup.RestoreRequest) Namespace(com.palantir.atlasdb.timelock.api.Namespace) Test(org.junit.Test)

Aggregations

RestoreRequest (com.palantir.atlasdb.backup.RestoreRequest)1 Namespace (com.palantir.atlasdb.timelock.api.Namespace)1 Test (org.junit.Test)1