Search in sources :

Example 1 with BasicFileObserver

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

the class MavenProjectCacheTest method setup.

@Before
public void setup() throws Exception {
    fileObserver = new BasicFileObserver();
    server = mock(Sts4LanguageServer.class);
    SimpleWorkspaceService workspaceService = mock(SimpleWorkspaceService.class);
    when(workspaceService.getFileObserver()).thenReturn(fileObserver);
    when(server.getWorkspaceService()).thenReturn(workspaceService);
    testProjectPath = Paths.get(DependencyTreeTest.class.getResource("/empty-boot-project-with-classpath-file").toURI());
    pomFile = testProjectPath.resolve(MavenCore.POM_XML).toFile();
    pomFileContents = new String(Files.readAllBytes(pomFile.toPath()), Charset.defaultCharset());
    Path cacheFolerPath = testProjectPath.resolve(IJavaProject.PROJECT_CACHE_FOLDER);
    if (cacheFolerPath.toFile().exists()) {
        Files.walk(cacheFolerPath, FileVisitOption.FOLLOW_LINKS).sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete);
    }
}
Also used : Path(java.nio.file.Path) BasicFileObserver(org.springframework.ide.vscode.commons.util.BasicFileObserver) SimpleWorkspaceService(org.springframework.ide.vscode.commons.languageserver.util.SimpleWorkspaceService) Sts4LanguageServer(org.springframework.ide.vscode.commons.languageserver.Sts4LanguageServer) File(java.io.File) Before(org.junit.Before)

Example 2 with BasicFileObserver

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

the class GradleProjectTest method setup.

@Before
public void setup() throws Exception {
    fileObserver = new BasicFileObserver();
    server = mock(Sts4LanguageServer.class);
    SimpleWorkspaceService workspaceService = mock(SimpleWorkspaceService.class);
    when(workspaceService.getFileObserver()).thenReturn(fileObserver);
    when(server.getWorkspaceService()).thenReturn(workspaceService);
}
Also used : BasicFileObserver(org.springframework.ide.vscode.commons.util.BasicFileObserver) SimpleWorkspaceService(org.springframework.ide.vscode.commons.languageserver.util.SimpleWorkspaceService) Sts4LanguageServer(org.springframework.ide.vscode.commons.languageserver.Sts4LanguageServer) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)2 Sts4LanguageServer (org.springframework.ide.vscode.commons.languageserver.Sts4LanguageServer)2 SimpleWorkspaceService (org.springframework.ide.vscode.commons.languageserver.util.SimpleWorkspaceService)2 BasicFileObserver (org.springframework.ide.vscode.commons.util.BasicFileObserver)2 File (java.io.File)1 Path (java.nio.file.Path)1