use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class PropertiesIndexTest method propertyNotPresent_Maven.
@Test
public void propertyNotPresent_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("my.server.port");
assertNull(propertyInfo);
}
use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class ApplicationPropertiesEditorTest method testMapKeyDotInterpretation.
@Test
public void testMapKeyDotInterpretation() throws Exception {
// Interpretation of '.' changes depending on the domain type (i.e. when domain type is
// is a simple type got which '.' navigation is invalid then the '.' is 'eaten' by the key.
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
assertNotNull(p.getClasspath().findType("demo.Color"));
assertNotNull(p.getClasspath().findType("demo.ColorData"));
data("atommap", "java.util.Map<java.lang.String,java.lang.Integer>", null, "map of atomic data");
data("objectmap", "java.util.Map<java.lang.String,java.lang.Object>", null, "map of atomic object (recursive map)");
data("enummap", "java.util.Map<java.lang.String,demo.Color>", null, "map of enums");
data("pojomap", "java.util.Map<java.lang.String,demo.ColorData>", null, "map of pojos");
Editor editor = newEditor("atommap.something.with.dots=Vaporize\n" + "atommap.something.with.bracket[0]=Brackelate\n" + "objectmap.other.with.dots=Objectify\n" + "enummap.more.dots=Enumerate\n" + "pojomap.do.some.dots=Pojodot\n" + "pojomap.bracket.and.dots[1]=lala\n" + "pojomap.zozo[2]=lala\n");
editor.assertProblems("Vaporize|'int'", "[0]|Can't use '[..]'", // objectmap okay
"Enumerate|Color", "some|no property", "and|no property", "[2]|Can't use '[..]'");
assertCompletionsVariations("enummap.more.dots=R<*>", "enummap.more.dots=RED<*>", // fuzzy match: G(R)EEN
"enummap.more.dots=GREEN<*>");
}
use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class ApplicationPropertiesEditorTest method testHyperlinkTargets.
@Ignore
@Test
public void testHyperlinkTargets() throws Exception {
System.out.println(">>> testHyperlinkTargets");
IJavaProject p = createPredefinedMavenProject("tricky-getters-boot-1.3.1-app");
useProject(p);
Editor editor = newEditor("server.port=888\n" + "spring.datasource.login-timeout=1000\n" + "flyway.init-sqls=a,b,c\n");
editor.assertLinkTargets("server", "org.springframework.boot.autoconfigure.web.ServerProperties.setPort(Integer)");
editor.assertLinkTargets("data", "org.springframework.boot.autoconfigure.jdbc.DataSourceConfigMetadata.hikariDataSource()", "org.springframework.boot.autoconfigure.jdbc.DataSourceConfigMetadata.tomcatDataSource()", "org.springframework.boot.autoconfigure.jdbc.DataSourceConfigMetadata.dbcpDataSource()");
editor.assertLinkTargets("flyway", "org.springframework.boot.autoconfigure.flyway.FlywayProperties.setInitSqls(List<String>)");
System.out.println("<<< testHyperlinkTargets");
}
use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class ApplicationPropertiesEditorTest method testDeprecatedBeanPropertyReconcile.
@Test
public void testDeprecatedBeanPropertyReconcile() throws Exception {
IJavaProject p = createPredefinedMavenProject("tricky-getters-boot-1.3.1-app");
useProject(p);
data("foo", "demo.Deprecater", null, "A Bean with deprecated properties");
Editor editor = newEditor("# comment\n" + "foo.name=Old faithfull\n" + "foo.new-name=New and fancy\n" + "foo.alt-name=alternate\n");
editor.assertProblems("name|Deprecated", "alt-name|Property 'alt-name' of type 'demo.Deprecater' is Deprecated: Use 'something.else' instead. Reason: No good anymore");
}
use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class ApplicationPropertiesEditorTest method testValueProposalAssignedToRelaxedPropertyName.
@Test
public void testValueProposalAssignedToRelaxedPropertyName() throws Exception {
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
data("relaxed-color", "demo.Color", null, "A soothing color");
assertCompletion("relaxed-color=b<*>", "relaxed-color=blue<*>");
assertCompletion("relaxedColor=b<*>", "relaxedColor=blue<*>");
}
Aggregations