Search in sources :

Example 1 with LanguageServerTestListener

use of org.springframework.ide.vscode.commons.languageserver.util.LanguageServerTestListener in project sts4 by spring-projects.

the class LanguageServerHarness method reconcilerThreadStart.

/**
 * Blocks the reconciler thread until a specific point in time explicitly controlled by the test.
 */
public SynchronizationPoint reconcilerThreadStart() {
    CompletableFuture<Void> blocker = new CompletableFuture<>();
    getServer().setTestListener(new LanguageServerTestListener() {

        @Override
        public void reconcileStarted(String uri, int version) {
            try {
                blocker.get();
            } catch (Exception e) {
                throw ExceptionUtil.unchecked(e);
            }
        }
    });
    return new SynchronizationPoint() {

        @Override
        public void unblock() {
            blocker.complete(null);
        }

        @Override
        public Future<Void> reached() {
            return blocker;
        }
    };
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) LanguageServerTestListener(org.springframework.ide.vscode.commons.languageserver.util.LanguageServerTestListener)

Aggregations

CompletableFuture (java.util.concurrent.CompletableFuture)1 LanguageServerTestListener (org.springframework.ide.vscode.commons.languageserver.util.LanguageServerTestListener)1