use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class ApplicationYamlEditorTest method testDeprecatedBeanPropertyReconcile.
@Test
public void testDeprecatedBeanPropertyReconcile() throws Exception {
IJavaProject jp = createPredefinedMavenProject("tricky-getters-boot-1.3.1-app");
useProject(jp);
data("foo", "demo.Deprecater", null, "A Bean with deprecated properties");
Editor editor = newEditor("# comment\n" + "foo:\n" + " name: Old faithfull\n" + " new-name: New and fancy\n" + " alt-name: alternate\n");
editor.assertProblems("name|Property 'name' of type 'demo.Deprecater' is Deprecated!", "alt-name|Deprecated");
editor = newEditor("# comment\n" + "foo:\n" + " alt-name: alternate\n");
// check that message also contains reason and replacement infos.
editor.assertProblems("alt-name|Use 'something.else' instead");
editor.assertProblems("alt-name|No good anymore");
}
use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class ApplicationYamlEditorTest method testHoverInfoForEnumValueInMapKey.
@Test
public void testHoverInfoForEnumValueInMapKey() throws Exception {
Editor editor;
IJavaProject project = createPredefinedMavenProject("empty-boot-1.3.0-app");
useProject(project);
// This test will fail if source jars haven't been downloaded.
// Probably that is why it fails in CI build?
// Let's check:
// IType type = project.findType("com.fasterxml.jackson.databind.SerializationFeature");
// System.out.println(">>> source for: "+type.getFullyQualifiedName());
// System.out.println(downloadSources(type));
// System.out.println("<<< source for: "+type.getFullyQualifiedName());
editor = newEditor("spring:\n" + " jackson:\n" + " serialization:\n" + " indent-output: true");
editor.assertIsHoverRegion("indent-output");
editor.assertHoverContains("indent-output", "allows enabling (or disabling) indentation");
// Also try that it works when spelled in all upper-case
editor = newEditor("spring:\n" + " jackson:\n" + " serialization:\n" + " INDENT_OUTPUT: true");
editor.assertIsHoverRegion("INDENT_OUTPUT");
editor.assertHoverContains("INDENT_OUTPUT", "allows enabling (or disabling) indentation");
}
use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class ActuatorWarningHoverTest method noWarningIf_ActuatorOnClasspath.
@Test
public void noWarningIf_ActuatorOnClasspath() throws Exception {
// Has running app:
mockAppProvider.builder().isSpringBootApp(true).processId("22022").processName("foo.bar.RunningApp").profilesUnknown().build();
// Actuator on classpath:
String projectName = 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\n" + " Foo myFoo() {\n" + " return new FooImplementation();\n" + " }\n" + "}");
editor.assertHighlights();
editor.assertNoHover("@Bean");
}
use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class ActuatorWarningHoverTest method showWarningIf_NoActuator_and_RunningApp.
@Test
public void showWarningIf_NoActuator_and_RunningApp() throws Exception {
// 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.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.assertHoverContains("@Profile", "No live hover information");
editor.assertHoverContains("@Profile", "Consider adding `spring-boot-actuator` as a dependency to your project `" + projectName + "`");
}
use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class PropertiesIndexTest method springStandardPropertyPresent_Maven.
@Test
public void springStandardPropertyPresent_Maven() throws Exception {
SpringPropertiesIndexManager indexManager = new SpringPropertiesIndexManager(ValueProviderRegistry.getDefault(), null);
IJavaProject mavenProject = projects.mavenProject(CUSTOM_PROPERTIES_PROJECT);
FuzzyMap<PropertyInfo> index = indexManager.get(mavenProject, progressService);
PropertyInfo propertyInfo = index.get("server.port");
assertNotNull(propertyInfo);
assertEquals(Integer.class.getName(), propertyInfo.getType());
assertEquals("port", propertyInfo.getName());
}
Aggregations