@Test
public void accessODLAfterRemovedByMemoryPressure() throws Throwable {

    LuceneDocumentIndexService indexService = new LuceneDocumentIndexService();
    this.host = VerificationHost.create(0);
    this.host.setDocumentIndexingService(indexService);
    this.host.start();
    this.host.startFactory(new ExampleODLService());
    this.host.waitForServiceAvailable(ExampleODLService.FACTORY_LINK);
    TestRequestSender sender = this.host.getTestRequestSender();
    List<Operation> posts = new ArrayList<>();
    for (int i = 0; i < 30; i++) {
        ExampleServiceState state = new ExampleServiceState();
        state.name = "foo-" + i;
        state.documentSelfLink = state.name;
        posts.add(Operation.createPost(this.host, ExampleODLService.FACTORY_LINK).setBody(state));
    }
    List<ExampleServiceState> states = sender.sendAndWait(posts, ExampleServiceState.class);
    // perform deletes mimicking ODL stop
    List<Operation> deletes = states.stream().map(state ->
            Operation.createDelete(this.host, state.documentSelfLink)
                    .addPragmaDirective(Operation.PRAGMA_DIRECTIVE_NO_INDEX_UPDATE)
                    .addPragmaDirective(Operation.PRAGMA_DIRECTIVE_NO_FORWARDING)
    ).collect(toList());
    sender.sendAndWait(deletes);
    // memory pressure to update document update info. set limit=1 so that all entries will be updated.
    indexService.updateMapMemoryLimit = 1;
    indexService.applyMemoryLimitToDocumentUpdateInfo();
    // verify those removed ODL should be accessible
    List<Operation> gets = states.stream()
            .map(state -> Operation.createGet(this.host, state.documentSelfLink))
            .collect(toList());
    sender.sendAndWait(gets);
}