use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class ScopeCompletionTest method setup.
@Before
public void setup() throws Exception {
IJavaProject testProject = ProjectsHarness.INSTANCE.mavenProject("test-annotations");
harness = BootJavaLanguageServerHarness.builder().mockDefaults().build();
harness.useProject(testProject);
harness.intialize(null);
}
use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class CompilationUnitCacheTest method cu_cached.
@Test
public void cu_cached() throws Exception {
harness = BootJavaLanguageServerHarness.builder().mockDefaults().build();
harness.useProject(new IJavaProject() {
@Override
public IClasspath getClasspath() {
return new DelegatingCachedClasspath<>(() -> null, null);
}
});
harness.intialize(null);
TextDocument doc = new TextDocument(harness.createTempUri(), LanguageId.JAVA, 0, "package my.package\n" + "\n" + "public class SomeClass {\n" + "\n" + "}\n");
CompilationUnit cu = getCompilationUnit(doc);
assertNotNull(cu);
CompilationUnit cuAnother = getCompilationUnit(doc);
assertTrue(cu == cuAnother);
}
use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class CompilationUnitCacheTest method cu_cache_invalidated_by_doc_change.
@Test
public void cu_cache_invalidated_by_doc_change() throws Exception {
harness = BootJavaLanguageServerHarness.builder().mockDefaults().build();
harness.useProject(new IJavaProject() {
@Override
public IClasspath getClasspath() {
return new DelegatingCachedClasspath<>(() -> null, null);
}
});
harness.intialize(null);
TextDocument doc = new TextDocument(harness.createTempUri(), LanguageId.JAVA, 0, "package my.package\n" + "\n" + "public class SomeClass {\n" + "\n" + "}\n");
harness.newEditorFromFileUri(doc.getUri(), doc.getLanguageId());
CompilationUnit cu = getCompilationUnit(doc);
assertNotNull(cu);
harness.changeDocument(doc.getUri(), 0, 0, " ");
CompilationUnit cuAnother = getCompilationUnit(doc);
assertNotNull(cuAnother);
assertFalse(cu == cuAnother);
CompilationUnit cuYetAnother = getCompilationUnit(doc);
assertTrue(cuAnother == cuYetAnother);
}
use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class ActuatorWarningHoverTest method warningHoverHasPreciseLocation.
@Test
public void warningHoverHasPreciseLocation() throws Exception {
// It will be less annoying if limit the area the hover responds to, to just inside the
// annotation name rather than the whole range of the ast node.
// Has running app:
mockAppProvider.builder().isSpringBootApp(true).processId("22022").processName("foo.bar.RunningApp").profilesUnknown().build();
// No actuator on classpath:
String projectName = NO_ACTUATOR_PROJECT;
IJavaProject project = projects.mavenProject(projectName);
harness.useProject(project);
harness.intialize(null);
Editor editor = harness.newEditor(LanguageId.JAVA, "package hello;\n" + "\n" + "import org.springframework.context.annotation.Bean;\n" + "import org.springframework.context.annotation.Configuration;\n" + "import org.springframework.context.annotation.Profile;\n" + "\n" + "@Configuration\n" + "public class LocalConfig {\n" + " \n" + " @Bean(\"the-bean-name\")\n" + " Foo myFoo() {\n" + " return new FooImplementation();\n" + " }\n" + "}");
editor.assertHighlights();
editor.assertHoverContains("@Bean", "No live hover information");
editor.assertNoHover("the-bean-name");
}
use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class ActuatorWarningHoverTest method noWarningIf_NoRunningApps.
@Test
public void noWarningIf_NoRunningApps() throws Exception {
// No running app:
// actaully... no code needed to set that up. mockAppBuilder is 'empty' by default.
// No actuator on classpath:
String projectName = NO_ACTUATOR_PROJECT;
IJavaProject project = projects.mavenProject(projectName);
harness.useProject(project);
harness.intialize(null);
Editor editor = harness.newEditor(LanguageId.JAVA, "package hello;\n" + "\n" + "import org.springframework.context.annotation.Configuration;\n" + "import org.springframework.context.annotation.Profile;\n" + "\n" + "@Configuration\n" + "@Profile({\"local-profile\", \"inactive\", \"testing-profile\"})\n" + "public class LocalConfig {\n" + "}");
editor.assertHighlights();
editor.assertNoHover("@Profile");
}
Aggregations