Changeset 12842 in josm for trunk/test/unit
- Timestamp:
- 2017-09-13T16:32:24+02:00 (7 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/actions/MergeNodesActionTest.java
r12562 r12842 43 43 @Test(expected = IllegalStateException.class) 44 44 public void testSelectTargetLocationNodeInvalidMode() { 45 Main.pref.putInt eger("merge-nodes.mode", -1);45 Main.pref.putInt("merge-nodes.mode", -1); 46 46 MergeNodesAction.selectTargetLocationNode(Arrays.asList(new Node(0), new Node(1))); 47 47 } … … 52 52 @Test 53 53 public void testSelectTargetLocationNode() { 54 Main.pref.putInt eger("merge-nodes.mode", 0);54 Main.pref.putInt("merge-nodes.mode", 0); 55 55 assertEquals(1, MergeNodesAction.selectTargetLocationNode(Arrays.asList(new Node(0), new Node(1))).getId()); 56 56 57 Main.pref.putInt eger("merge-nodes.mode", 1);57 Main.pref.putInt("merge-nodes.mode", 1); 58 58 assertEquals(LatLon.ZERO, MergeNodesAction.selectTargetLocationNode( 59 59 Arrays.asList(new Node(LatLon.NORTH_POLE), new Node(LatLon.SOUTH_POLE))).getCoor()); 60 60 61 Main.pref.putInt eger("merge-nodes.mode", 2);61 Main.pref.putInt("merge-nodes.mode", 2); 62 62 assertEquals(LatLon.NORTH_POLE, MergeNodesAction.selectTargetLocationNode( 63 63 Arrays.asList(new Node(LatLon.NORTH_POLE))).getCoor()); -
trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/RecentTagCollectionTest.java
r12659 r12842 14 14 import org.openstreetmap.josm.data.osm.search.SearchParseError; 15 15 import org.openstreetmap.josm.data.osm.search.SearchSetting; 16 import org.openstreetmap.josm.data.preferences. CollectionProperty;16 import org.openstreetmap.josm.data.preferences.ListProperty; 17 17 import org.openstreetmap.josm.testutils.JOSMTestRules; 18 18 … … 53 53 assertEquals(Arrays.asList(foo, baz), recentTags.toList()); 54 54 55 final CollectionProperty pref = new CollectionProperty("properties.recent-tags", Collections.<String>emptyList());55 final ListProperty pref = new ListProperty("properties.recent-tags", Collections.<String>emptyList()); 56 56 recentTags.saveToPreference(pref); 57 57 assertEquals(Arrays.asList("name", "foo", "name", "baz"), pref.get()); -
trunk/test/unit/org/openstreetmap/josm/gui/io/CustomConfiguratorTest.java
r12826 r12842 44 44 File tmp = File.createTempFile("josm.testExportPreferencesKeysToFile.lorem_ipsum", ".xml"); 45 45 46 Main.pref.put Collection("lorem_ipsum", Arrays.asList(46 Main.pref.putList("lorem_ipsum", Arrays.asList( 47 47 "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", 48 48 "Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor.", … … 57 57 String xml = Utils.join("\n", Files.readAllLines(tmp.toPath(), StandardCharsets.UTF_8)); 58 58 assertTrue(xml.contains("<preferences operation=\"replace\">")); 59 for (String entry : Main.pref.get Collection("lorem_ipsum")) {59 for (String entry : Main.pref.getList("lorem_ipsum")) { 60 60 assertTrue(entry + "\nnot found in:\n" + xml, xml.contains(entry)); 61 61 } 62 62 63 Main.pref.put Collection("test", Arrays.asList("11111111", "2222222", "333333333"));63 Main.pref.putList("test", Arrays.asList("11111111", "2222222", "333333333")); 64 64 CustomConfigurator.exportPreferencesKeysByPatternToFile(tmp.getAbsolutePath(), true, "test"); 65 65 xml = Utils.join("\n", Files.readAllLines(tmp.toPath(), StandardCharsets.UTF_8)); 66 66 assertTrue(xml.contains("<preferences operation=\"append\">")); 67 for (String entry : Main.pref.get Collection("test")) {67 for (String entry : Main.pref.getList("test")) { 68 68 assertTrue(entry + "\nnot found in:\n" + xml, xml.contains(entry)); 69 69 } … … 79 79 public void testReadXML() throws IOException { 80 80 // Test 1 - read(dir, file) + append 81 Main.pref.put Collection("test", Collections.<String>emptyList());82 assertTrue(Main.pref.get Collection("test").isEmpty());81 Main.pref.putList("test", Collections.<String>emptyList()); 82 assertTrue(Main.pref.getList("test").isEmpty()); 83 83 CustomConfigurator.readXML(TestUtils.getTestDataRoot() + "customconfigurator", "append.xml"); 84 84 String log = PreferencesUtils.getLog(); 85 85 assertFalse(log, log.contains("Error")); 86 assertFalse(Main.pref.get Collection("test").isEmpty());86 assertFalse(Main.pref.getList("test").isEmpty()); 87 87 88 88 // Test 2 - read(file, pref) + replace … … 90 90 // avoid messing up preferences file (that makes all following unit tests fail) 91 91 pref.enableSaveOnPut(false); 92 pref.put Collection("lorem_ipsum", Arrays.asList("only 1 string"));93 assertEquals(1, pref.get Collection("lorem_ipsum").size());92 pref.putList("lorem_ipsum", Arrays.asList("only 1 string")); 93 assertEquals(1, pref.getList("lorem_ipsum").size()); 94 94 CustomConfigurator.readXML(new File(TestUtils.getTestDataRoot() + "customconfigurator", "replace.xml"), pref); 95 95 log = PreferencesUtils.getLog(); 96 96 assertFalse(log, log.contains("Error")); 97 assertEquals(9, pref.get Collection("lorem_ipsum").size());97 assertEquals(9, pref.getList("lorem_ipsum").size()); 98 98 } 99 99 } -
trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelperTest.java
r12564 r12842 42 42 @Test 43 43 public void testTicket12312() throws FileNotFoundException, IOException, SAXException { 44 Main.pref.put ("draw.rawgps.colors.dynamic.layer 12312", true);45 Main.pref.putInt eger("draw.rawgps.colors.layer 12312", GpxDrawHelper.ColorMode.VELOCITY.toIndex());44 Main.pref.putBoolean("draw.rawgps.colors.dynamic.layer 12312", true); 45 Main.pref.putInt("draw.rawgps.colors.layer 12312", GpxDrawHelper.ColorMode.VELOCITY.toIndex()); 46 46 final List<String> colors = calculateColors(TestUtils.getRegressionDataFile(12312, "single_trackpoint.gpx"), "12312", 1); 47 47 assertEquals("[#FF00FF]", colors.toString()); … … 68 68 @Test 69 69 public void testVelocity() throws IOException, SAXException { 70 Main.pref.putInt eger("draw.rawgps.colors.layer 001", GpxDrawHelper.ColorMode.VELOCITY.toIndex());70 Main.pref.putInt("draw.rawgps.colors.layer 001", GpxDrawHelper.ColorMode.VELOCITY.toIndex()); 71 71 final List<String> colors = calculateColors("data_nodist/2094047.gpx", "001", 10); 72 72 assertEquals("[#FF00FF, #FFAD00, #FFA800, #FFA800, #FF9E00, #FF9400, #FF7000, #FF7000, #FF8000, #FF9400]", colors.toString()); … … 81 81 @Test 82 82 public void testVelocityDynamic() throws IOException, SAXException { 83 Main.pref.putInt eger("draw.rawgps.colors.layer 002", GpxDrawHelper.ColorMode.VELOCITY.toIndex());84 Main.pref.put ("draw.rawgps.colors.dynamic.layer 002", true);83 Main.pref.putInt("draw.rawgps.colors.layer 002", GpxDrawHelper.ColorMode.VELOCITY.toIndex()); 84 Main.pref.putBoolean("draw.rawgps.colors.dynamic.layer 002", true); 85 85 final List<String> colors = calculateColors("data_nodist/2094047.gpx", "002", 10); 86 86 assertEquals("[#FF00FF, #00FFE0, #00FFC2, #00FFC2, #00FF75, #00FF3D, #99FF00, #94FF00, #38FF00, #00FF38]", colors.toString()); … … 95 95 @Test 96 96 public void testDirection() throws IOException, SAXException { 97 Main.pref.putInt eger("draw.rawgps.colors.layer 003", GpxDrawHelper.ColorMode.DIRECTION.toIndex());97 Main.pref.putInt("draw.rawgps.colors.layer 003", GpxDrawHelper.ColorMode.DIRECTION.toIndex()); 98 98 final List<String> colors = calculateColors("data_nodist/2094047.gpx", "003", 10); 99 99 assertEquals("[#FF00FF, #EAEC25, #EDEA26, #EDE525, #ECD322, #EBB81D, #E85A0D, #E73708, #E84D0B, #EA8A15]", colors.toString()); … … 108 108 @Test 109 109 public void testTime() throws IOException, SAXException { 110 Main.pref.putInt eger("draw.rawgps.colors.layer 003", GpxDrawHelper.ColorMode.TIME.toIndex());110 Main.pref.putInt("draw.rawgps.colors.layer 003", GpxDrawHelper.ColorMode.TIME.toIndex()); 111 111 final List<String> colors = calculateColors("data_nodist/2094047.gpx", "003", 10); 112 112 assertEquals("[#FF00FF, #FF0000, #FF0000, #FF0500, #FF0500, #FF0A00, #FF0A00, #FF1F00, #FF2E00, #FF3300]", colors.toString()); -
trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayerTest.java
r12636 r12842 40 40 @Before 41 41 public void setUp() { 42 Main.pref.put ("marker.traceaudio", true);42 Main.pref.putBoolean("marker.traceaudio", true); 43 43 } 44 44 -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/audio/AudioPreferenceTest.java
r10378 r12842 36 36 @Test 37 37 public void testAddGui() { 38 Main.pref.put ("audio.menuinvisible", true);38 Main.pref.putBoolean("audio.menuinvisible", true); 39 39 PreferencesTestUtils.doTestPreferenceSettingAddGui(new AudioPreference.Factory(), null); 40 Main.pref.put ("audio.menuinvisible", false);40 Main.pref.putBoolean("audio.menuinvisible", false); 41 41 PreferencesTestUtils.doTestPreferenceSettingAddGui(new AudioPreference.Factory(), null); 42 42 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTest.java
r12632 r12842 42 42 public void testAddGui() { 43 43 String fileUrl = new File(TestUtils.getTestDataRoot()+"__files/imagery/maps.xml").toURI().toString(); 44 Main.pref.put Collection("imagery.layers.sites", Arrays.asList(fileUrl));44 Main.pref.putList("imagery.layers.sites", Arrays.asList(fileUrl)); 45 45 PreferencesTestUtils.doTestPreferenceSettingAddGui(new ImageryPreference.Factory(), null); 46 46 } -
trunk/test/unit/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreferenceTestIT.java
r12649 r12842 58 58 assertFalse(sources.isEmpty()); 59 59 // Double traditional timeouts to avoid random problems 60 Main.pref.putInt eger("socket.timeout.connect", 30);61 Main.pref.putInt eger("socket.timeout.read", 60);60 Main.pref.putInt("socket.timeout.connect", 30); 61 Main.pref.putInt("socket.timeout.read", 60); 62 62 Map<Object, Throwable> allErrors = new HashMap<>(); 63 63 Set<String> allMessages = new HashSet<>(); -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RemoteControlTest.java
r12620 r12842 52 52 RemoteControl.start(); 53 53 disableCertificateValidation(); 54 httpBase = "http://127.0.0.1:"+Main.pref.getInt eger("remote.control.port", 8111);55 httpsBase = "https://127.0.0.1:"+Main.pref.getInt eger("remote.control.https.port", 8112);54 httpBase = "http://127.0.0.1:"+Main.pref.getInt("remote.control.port", 8111); 55 httpsBase = "https://127.0.0.1:"+Main.pref.getInt("remote.control.https.port", 8112); 56 56 } 57 57 -
trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTestIT.java
r12754 r12842 148 148 PluginDownloadTask pluginDownloadTask = new PluginDownloadTask(NullProgressMonitor.INSTANCE, plugins, null); 149 149 // Increase default timeout to avoid random network errors on big jar files 150 int defTimeout = Main.pref.getInt eger("socket.timeout.read", 30);151 Main.pref.putInt eger("socket.timeout.read", 2 * defTimeout);150 int defTimeout = Main.pref.getInt("socket.timeout.read", 30); 151 Main.pref.putInt("socket.timeout.read", 2 * defTimeout); 152 152 pluginDownloadTask.run(); 153 153 // Restore default timeout 154 Main.pref.putInt eger("socket.timeout.read", defTimeout);154 Main.pref.putInt("socket.timeout.read", defTimeout); 155 155 assertTrue(pluginDownloadTask.getFailedPlugins().toString(), pluginDownloadTask.getFailedPlugins().isEmpty()); 156 156 assertEquals(plugins.size(), pluginDownloadTask.getDownloadedPlugins().size());
Note:
See TracChangeset
for help on using the changeset viewer.