Changeset 18714 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/ValidatorCLI.java
r18366 r18714 431 431 if (pref instanceof MemoryPreferences) { 432 432 final MemoryPreferences memoryPreferences = (MemoryPreferences) pref; 433 tempPreferences.getAllSettings().entrySet().stream().filter(entry -> entry.getValue().isNew()) 434 .forEach(entry -> memoryPreferences.putSetting(entry.getKey(), entry.getValue())); 433 tempPreferences.getAllSettings().forEach(memoryPreferences::putSetting); 435 434 } else { 436 435 throw new JosmRuntimeException(tr("Preferences are not the expected type")); -
trunk/test/unit/org/openstreetmap/josm/data/validation/ValidatorCLITest.java
r18365 r18714 10 10 import java.io.File; 11 11 import java.io.IOException; 12 import java.io.OutputStream; 12 13 import java.io.PrintWriter; 13 14 import java.lang.reflect.InvocationTargetException; … … 46 47 import org.openstreetmap.josm.io.OsmWriterFactory; 47 48 import org.openstreetmap.josm.spi.lifecycle.Lifecycle; 49 import org.openstreetmap.josm.spi.preferences.Config; 48 50 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 49 51 import org.openstreetmap.josm.tools.Logging; … … 177 179 178 180 /** 181 * A non-regression test for #22898: Validator CLI errors out when is run with --load-preferences argument 182 */ 183 @Test 184 void testNonRegression22898(final @TempDir Path preferencesLocation) throws IOException { 185 final ValidatorCLI validatorCLI = new ValidatorCLI(); 186 final Path preferences = preferencesLocation.resolve("preferences.xml"); 187 try (OutputStream fos = Files.newOutputStream(preferences)) { 188 final String pref = "<config>\n" + 189 " <preferences operation=\"replace\">\n" + 190 " <list key='plugins'>\n" + 191 " <entry value='baz'/>\n" + 192 " </list>\n" + 193 " </preferences>\n" + 194 "</config>"; 195 fos.write(pref.getBytes(StandardCharsets.UTF_8)); 196 } 197 validatorCLI.processArguments(new String[]{"--load-preferences=" + preferences, 198 "--input", "resources/styles/standard/elemstyles.mapcss"}); 199 assertEquals(Collections.singletonList("baz"), Config.getPref().getList("plugins")); 200 } 201 202 /** 179 203 * Read json objects from a file 180 204 * @param path The file to read
Note:
See TracChangeset
for help on using the changeset viewer.