|
|
@ -1,5 +1,5 @@
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Copyright 2012-2019 the original author or authors.
|
|
|
|
* Copyright 2012-2022 the original author or authors.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
@ -18,6 +18,7 @@ package org.springframework.boot.context.properties.migrator;
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
@ -144,6 +145,15 @@ class PropertiesMigrationReporterTests {
|
|
|
|
assertThat(report).doesNotContain("null");
|
|
|
|
assertThat(report).doesNotContain("null");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
void invalidNameHandledGracefully() {
|
|
|
|
|
|
|
|
this.environment.getPropertySources()
|
|
|
|
|
|
|
|
.addFirst(new MapPropertySource("first", Collections.singletonMap("invalid.property-name", "value")));
|
|
|
|
|
|
|
|
String report = createWarningReport(loadRepository("metadata/sample-metadata-invalid-name.json"));
|
|
|
|
|
|
|
|
assertThat(report).isNotNull();
|
|
|
|
|
|
|
|
assertThat(report).contains("Key: invalid.PropertyName").contains("Replacement: valid.property-name");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private List<String> mapToNames(PropertySources sources) {
|
|
|
|
private List<String> mapToNames(PropertySources sources) {
|
|
|
|
List<String> names = new ArrayList<>();
|
|
|
|
List<String> names = new ArrayList<>();
|
|
|
|
for (PropertySource<?> source : sources) {
|
|
|
|
for (PropertySource<?> source : sources) {
|
|
|
|