Changeset 8938 in josm for trunk/test/unit/org/openstreetmap
- Timestamp:
- 2015-10-24T14:58:06+02:00 (9 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTest.java
r8937 r8938 2 2 package org.openstreetmap.josm.plugins; 3 3 4 import static org.junit.Assert.assertEquals; 4 5 import static org.junit.Assert.assertFalse; 6 import static org.junit.Assert.assertTrue; 5 7 8 import java.util.Iterator; 6 9 import java.util.List; 10 import java.util.Set; 7 11 8 12 import org.junit.BeforeClass; … … 10 14 import org.openstreetmap.josm.JOSMFixture; 11 15 import org.openstreetmap.josm.Main; 16 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 12 17 13 18 /** 14 * Unit tests of {@link ReadRemotePluginInformationTask} class.19 * Unit tests of {@link PluginHandler} class. 15 20 */ 16 public class ReadRemotePluginInformationTaskTest {21 public class PluginHandlerTest { 17 22 18 23 /** … … 21 26 @BeforeClass 22 27 public static void setUp() { 23 JOSMFixture.createUnitTestFixture().init( );28 JOSMFixture.createUnitTestFixture().init(true); 24 29 } 25 30 26 31 /** 27 * Test of plugin list download.32 * Test that available plugins rules can be loaded. 28 33 */ 29 34 @Test 30 public void testDownloadPluginList() { 35 public void testValidityOfAvailablePlugins() { 36 // Download complete list of plugins 31 37 ReadRemotePluginInformationTask pluginInfoDownloadTask = new ReadRemotePluginInformationTask( 32 38 Main.pref.getOnlinePluginSites()); 33 39 pluginInfoDownloadTask.run(); 34 List<PluginInformation> list = pluginInfoDownloadTask.getAvailablePlugins(); 35 assertFalse(list.isEmpty()); 36 PluginInformation info = list.get(0); 40 List<PluginInformation> plugins = pluginInfoDownloadTask.getAvailablePlugins(); 41 System.out.println("Original plugin list contains " + plugins.size() + " plugins"); 42 assertFalse(plugins.isEmpty()); 43 PluginInformation info = plugins.get(0); 37 44 assertFalse(info.getName().isEmpty()); 38 45 assertFalse(info.getClass().getName().isEmpty()); 46 47 // Filter deprecated and unmaintained ones 48 Set<String> deprecatedPlugins = PluginHandler.getDeprecatedAndUnmaintainedPlugins(); 49 for (Iterator<PluginInformation> it = plugins.iterator(); it.hasNext();) { 50 PluginInformation pi = it.next(); 51 if (deprecatedPlugins.contains(pi.name)) { 52 it.remove(); 53 } 54 } 55 System.out.println("Filtered plugin list contains " + plugins.size() + " plugins"); 56 57 // Update the locally installed plugins 58 PluginDownloadTask pluginDownloadTask = new PluginDownloadTask(NullProgressMonitor.INSTANCE, plugins, null); 59 pluginDownloadTask.run(); 60 assertTrue(pluginDownloadTask.getFailedPlugins().toString(), pluginDownloadTask.getFailedPlugins().isEmpty()); 61 assertEquals(plugins.size(), pluginDownloadTask.getDownloadedPlugins().size()); 62 63 // Update Plugin info for downloaded plugins 64 PluginHandler.refreshLocalUpdatedPluginInfo(pluginDownloadTask.getDownloadedPlugins()); 65 66 // Load early plugins 67 PluginHandler.loadEarlyPlugins(null, plugins, null); 68 69 // Load late plugins 70 PluginHandler.loadLatePlugins(null, plugins, null); 71 72 assertTrue(PluginHandler.pluginLoadingExceptions.toString(), PluginHandler.pluginLoadingExceptions.isEmpty()); 39 73 } 40 74 }
Note:
See TracChangeset
for help on using the changeset viewer.