use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class PropertiesIndexTest method springStandardPropertyPresent_ClasspathFile.
@Test
public void springStandardPropertyPresent_ClasspathFile() throws Exception {
SpringPropertiesIndexManager indexManager = new SpringPropertiesIndexManager(ValueProviderRegistry.getDefault(), null);
IJavaProject classpathFileProject = projects.javaProjectWithClasspathFile(CUSTOM_PROPERTIES_PROJECT);
FuzzyMap<PropertyInfo> index = indexManager.get(classpathFileProject, progressService);
PropertyInfo propertyInfo = index.get("server.port");
assertNotNull(propertyInfo);
assertEquals(Integer.class.getName(), propertyInfo.getType());
assertEquals("port", propertyInfo.getName());
}
use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class PropertiesIndexTest method customPropertyPresent_ClasspathFile.
@Test
public void customPropertyPresent_ClasspathFile() throws Exception {
SpringPropertiesIndexManager indexManager = new SpringPropertiesIndexManager(ValueProviderRegistry.getDefault(), null);
IJavaProject classpathFileProject = projects.javaProjectWithClasspathFile(CUSTOM_PROPERTIES_PROJECT);
FuzzyMap<PropertyInfo> index = indexManager.get(classpathFileProject, progressService);
PropertyInfo propertyInfo = index.get("demo.settings.user");
assertNotNull(propertyInfo);
assertEquals(String.class.getName(), propertyInfo.getType());
assertEquals("user", propertyInfo.getName());
}
use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class ApplicationPropertiesEditorTest method testEnumPropertyCompletion.
@Test
public void testEnumPropertyCompletion() throws Exception {
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
assertNotNull(p.getClasspath().findType("demo.Color"));
data("foo.color", "demo.Color", null, "A foonky colour");
// Should add the '=' because enums are 'simple' values.
assertCompletion("foo.c<*>", "foo.color=<*>");
assertCompletion("foo.color=R<*>", "foo.color=RED<*>");
assertCompletion("foo.color=G<*>", "foo.color=GREEN<*>");
assertCompletion("foo.color=B<*>", "foo.color=BLUE<*>");
assertCompletionsDisplayString("foo.color=<*>", "red", "green", "blue");
}
use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class ApplicationPropertiesEditorTest method doCommaCollectionReconcileTest.
private void doCommaCollectionReconcileTest(String collectionType) throws Exception {
Editor editor;
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
assertNotNull(p.getClasspath().findType("demo.Color"));
data("my.colors", collectionType + "<demo.Color>", null, "Ooh! nice colors!");
editor = newEditor("#comment\n" + "my.colors=RED, green, not-a-color , BLUE");
editor.assertProblems("not-a-color|demo.Color");
editor = newEditor("my.colors=\\\n" + " red , \\\n" + " green,\\\n" + " bad\n");
editor.assertProblems("bad|demo.Color");
editor = newEditor("my.colors=\\\n" + " red,\\\n" + " green,\\\n" + " blue\n");
editor.assertProblems();
editor = newEditor("my.colors=\\\n" + " bad,\\\n" + " green,\\\n" + " blue\n");
editor.assertProblems("bad|demo.Color");
editor = newEditor("my.colors=\\\n" + " bad , \\\n" + " green,\\\n" + " blue\n");
editor.assertProblems("bad|demo.Color");
editor = newEditor("my.colors=\\\n" + " red , \\\n" + " green,\\\n" + " bad \n");
editor.assertProblems("bad|demo.Color");
editor = newEditor("my.colors=red,\n");
editor.assertProblems(",|demo.Color");
editor = newEditor("my.colors=red, \n");
editor.assertProblems(" |demo.Color");
}
use of org.springframework.ide.vscode.commons.java.IJavaProject in project sts4 by spring-projects.
the class ApplicationPropertiesEditorTest method testMapKeyDotInterpretationInPojo.
@Test
public void testMapKeyDotInterpretationInPojo() throws Exception {
// Similar to testMapKeyDotInterpretation but this time maps are not attached to property
// directly but via a pojo property
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
assertNotNull(p.getClasspath().findType("demo.Color"));
assertNotNull(p.getClasspath().findType("demo.ColorData"));
Editor editor = newEditor("foo.color-names.BLUE.dot=Blauw\n" + "foo.color-data.RED.name=Good\n" + "foo.color-data.GREEN.bad=Bad\n" + "foo.color-data.GREEN.wrong[1]=Wrong\n");
editor.assertProblems(// dot is eaten so this is an error
"BLUE.dot|Color", // dot not eaten so '.bad' is accessing a property
"bad|no property", "wrong|no property");
assertCompletionsVariations("foo.color-data.RED.ch<*>", "foo.color-data.RED.children[<*>", "foo.color-data.RED.color-children.<*>", "foo.color-data.RED.mapped-children.<*>");
}
Aggregations