Make .properties reconciler aware of document marker
See: https://github.com/spring-projects/sts4/issues/533 Signed-off-by: Kris De Volder <kdevolder@pivotal.io>
This commit is contained in:
@@ -283,6 +283,7 @@ public class PropertyIndexHarness {
|
||||
data("spring.batch.job.enabled", "java.lang.Boolean", "true", "Execute all Spring Batch jobs in the context on startup.");
|
||||
data("spring.batch.job.names", "java.lang.String", "", "Comma-separated list of job names to execute on startup. By default, all Jobs\n found in the context are executed.");
|
||||
data("spring.batch.schema", "java.lang.String", "classpath:org/springframework/batch/core/schema-@@platform@@.sql", "Path to the SQL file to use to initialize the database schema.");
|
||||
data("spring.config.activate.on-profile", "java.lang.String[]", null, "Activate on blah.");
|
||||
data("spring.config.location", "java.lang.String", null, "Config file locations.");
|
||||
data("spring.config.name", "java.lang.String", "application", "Config file name.");
|
||||
data("spring.dao.exceptiontranslation.enabled", "java.lang.Boolean", "true", "Enable the PersistenceExceptionTranslationPostProcessor.");
|
||||
|
||||
@@ -77,6 +77,66 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
|
||||
private static final ProjectCustomizer WITH_EMPTY_APPLICATION_YML = projectContents -> {
|
||||
projectContents.createFile("src/main/resources/application.yml", "");
|
||||
};
|
||||
|
||||
@Test public void reconcilesWithMultiDocuments() throws Exception {
|
||||
//See: https://github.com/spring-projects/sts4/issues/533
|
||||
|
||||
defaultTestData();
|
||||
|
||||
//lowest bar: just disable the warning
|
||||
Editor editor = newEditor(
|
||||
"spring.config.activate.on-profile=foo\n" +
|
||||
"server.port=8888\n" +
|
||||
"#---\n" +
|
||||
"spring.config.activate.on-profile=bar\n" +
|
||||
"server.port=8080\n"
|
||||
);
|
||||
editor.assertProblems(/*NONE*/);
|
||||
|
||||
//better: still detect duplicates within same section
|
||||
editor = newEditor(
|
||||
"spring.application.name=frodo\n" +
|
||||
"spring.config.activate.on-profile=foo\n" +
|
||||
"server.port=8888\n" +
|
||||
"spring.application.name=frodo\n" +
|
||||
"#---\n" +
|
||||
"spring.config.activate.on-profile=bar\n" +
|
||||
"server.port=8080\n" +
|
||||
"server.port=9090\n"
|
||||
);
|
||||
editor.assertProblems(
|
||||
"spring.application.name|Duplicate",
|
||||
"spring.application.name|Duplicate",
|
||||
"server.port|Duplicate",
|
||||
"server.port|Duplicate"
|
||||
);
|
||||
|
||||
//nitpick 1: leading spaces before the marker means... it is not a marker
|
||||
editor = newEditor(
|
||||
"spring.config.activate.on-profile=foo\n" +
|
||||
"server.port=8888\n" +
|
||||
" #---\n" +
|
||||
"spring.config.activate.on-profile=bar\n" +
|
||||
"server.port=8080\n"
|
||||
);
|
||||
editor.assertProblems(
|
||||
"spring.config.activate.on-profile|Duplicate",
|
||||
"server.port|Duplicate",
|
||||
"spring.config.activate.on-profile|Duplicate",
|
||||
"server.port|Duplicate"
|
||||
);
|
||||
|
||||
//nitpick 2: trailing spaces after the marker are ignored
|
||||
editor = newEditor(
|
||||
"spring.config.activate.on-profile=foo\n" +
|
||||
"server.port=8888\n" +
|
||||
"#--- \t\n" +
|
||||
"spring.config.activate.on-profile=bar\n" +
|
||||
"server.port=8080\n"
|
||||
);
|
||||
editor.assertProblems(/*NONE*/);
|
||||
|
||||
}
|
||||
|
||||
@Test public void inheritedPojoProperties() throws Exception {
|
||||
//See https://github.com/spring-projects/sts4/issues/116
|
||||
|
||||
Reference in New Issue
Block a user