Changeset 10123 in josm for trunk/test/unit/org
- Timestamp:
- 2016-04-09T01:35:58+02:00 (9 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/MainApplicationTest.java
r10122 r10123 6 6 import static org.junit.Assert.assertNull; 7 7 8 import java.util.Arrays; 8 9 import java.util.Collection; 9 10 … … 16 17 import org.openstreetmap.josm.gui.SplashScreen.SplashProgressMonitor; 17 18 import org.openstreetmap.josm.plugins.PluginHandler; 19 import org.openstreetmap.josm.plugins.PluginHandlerTestIT; 18 20 import org.openstreetmap.josm.plugins.PluginInformation; 21 import org.openstreetmap.josm.plugins.PluginListParseException; 22 import org.openstreetmap.josm.plugins.PluginListParser; 19 23 20 24 /** … … 33 37 /** 34 38 * Test of {@link MainApplication#updateAndLoadEarlyPlugins} and {@link MainApplication#loadLatePlugins} methods. 39 * @throws PluginListParseException if an error occurs 35 40 */ 36 41 @Test 37 public void testUpdateAndLoadPlugins() {42 public void testUpdateAndLoadPlugins() throws PluginListParseException { 38 43 final String old = System.getProperty("josm.plugins"); 39 44 try { … … 46 51 }); 47 52 Collection<PluginInformation> plugins = MainApplication.updateAndLoadEarlyPlugins(null, monitor); 53 if (plugins.isEmpty()) { 54 PluginHandlerTestIT.downloadPlugins(Arrays.asList( 55 newPluginInformation("buildings_tools"), 56 newPluginInformation("plastic_laf"))); 57 plugins = MainApplication.updateAndLoadEarlyPlugins(null, monitor); 58 } 48 59 assertEquals(2, plugins.size()); 49 60 assertNotNull(PluginHandler.getPlugin("plastic_laf")); … … 59 70 } 60 71 } 72 73 private static PluginInformation newPluginInformation(String plugin) throws PluginListParseException { 74 //return new PluginInformation(new File(TestUtils.getTestDataRoot()+File.separator+"plugin"+File.separator+plugin+".jar")); 75 return PluginListParser.createInfo(plugin+".jar", "https://svn.openstreetmap.org/applications/editors/josm/dist/"+plugin+".jar", 76 ""); 77 } 61 78 } -
trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTestIT.java
r9815 r10123 7 7 8 8 import java.util.Arrays; 9 import java.util.Collection; 9 10 import java.util.Iterator; 10 11 import java.util.List; … … 66 67 System.out.println("Filtered plugin list contains " + plugins.size() + " plugins"); 67 68 68 // Update the locally installed plugins 69 PluginDownloadTask pluginDownloadTask = new PluginDownloadTask(NullProgressMonitor.INSTANCE, plugins, null); 70 pluginDownloadTask.run(); 71 assertTrue(pluginDownloadTask.getFailedPlugins().toString(), pluginDownloadTask.getFailedPlugins().isEmpty()); 72 assertEquals(plugins.size(), pluginDownloadTask.getDownloadedPlugins().size()); 73 74 // Update Plugin info for downloaded plugins 75 PluginHandler.refreshLocalUpdatedPluginInfo(pluginDownloadTask.getDownloadedPlugins()); 69 // Download plugins 70 downloadPlugins(plugins); 76 71 77 72 // Load early plugins … … 83 78 assertTrue(PluginHandler.pluginLoadingExceptions.toString(), PluginHandler.pluginLoadingExceptions.isEmpty()); 84 79 } 80 81 /** 82 * Download plugins 83 * @param plugins plugins to download 84 */ 85 public static void downloadPlugins(Collection<PluginInformation> plugins) { 86 // Update the locally installed plugins 87 PluginDownloadTask pluginDownloadTask = new PluginDownloadTask(NullProgressMonitor.INSTANCE, plugins, null); 88 pluginDownloadTask.run(); 89 assertTrue(pluginDownloadTask.getFailedPlugins().toString(), pluginDownloadTask.getFailedPlugins().isEmpty()); 90 assertEquals(plugins.size(), pluginDownloadTask.getDownloadedPlugins().size()); 91 92 // Update Plugin info for downloaded plugins 93 PluginHandler.refreshLocalUpdatedPluginInfo(pluginDownloadTask.getDownloadedPlugins()); 94 } 85 95 }
Note:
See TracChangeset
for help on using the changeset viewer.