@Test
public void successMigrateDocumentsWithAllVersions() throws Throwable {

    // this test dirties destination host, requires clean up
    clearSourceAndDestInProcessPeers = true;
    // create docs in source host
    Map<String, DocumentVersionType> typeBySelfLink = createVersionedExampleDocuments(this.exampleSourceFactory, this.serviceCount);
    // start migration
    MigrationTaskService.State migrationState = validMigrationState(ExampleService.FACTORY_LINK);
    migrationState.migrationOptions = EnumSet.of(MigrationOption.ALL_VERSIONS);
    Operation post = Operation.createPost(this.destinationFactoryUri).setBody(migrationState);
    ServiceDocument taskState = this.sender.sendAndWait(post, ServiceDocument.class);
    State finalState = waitForServiceCompletion(taskState.documentSelfLink, getDestinationHost());
    assertEquals(TaskStage.FINISHED, finalState.taskInfo.stage);
    validateVersionedExampleDocuments(typeBySelfLink);
    // expected num of document versions: (if documentNumber(serviceCount)=10)
    // - POST = 10x1=10
    // - POST_PUT = 10x2=20
    // - POST_PUT_PATCH = 10x3=30
    // - POST_PUT_PATCH_DELETE = 0 (should not be migrated)
    // - POST_PUT_PATCH_DELETE_POST = 10x1=10
    // - POST_PUT_PATCH_DELETE_POST_PUT = 10x2=20
    // - POST_PUT_PATCH_DELETE_POST_PUT_PATCH = 10x3=30
    //   total 10+20+30+10+20+30=120
    long expectedProcessedDocs = this.serviceCount * (1 + 2 + 3 + 1 + 2 + 3);
    validateNumOfProcessedDoc(getDestinationHost(), taskState.documentSelfLink, expectedProcessedDocs);
}