Ignore:
Timestamp:
2018-05-20T21:19:27+02:00 (7 years ago)
Author:
Don-vip
Message:

see #16288 - replace similar i18n strings (script update for plugins)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTestIT.java

    r12849 r13793  
    5050    @Test
    5151    public void testValidityOfAvailablePlugins() {
     52        loadAllPlugins();
     53
     54        Map<String, Throwable> loadingExceptions = PluginHandler.pluginLoadingExceptions.entrySet().stream()
     55                .collect(Collectors.toMap(e -> e.getKey(), e -> ExceptionUtils.getRootCause(e.getValue())));
     56
     57        // Add/remove layers twice to test basic plugin good behaviour
     58        Map<String, Throwable> layerExceptions = new HashMap<>();
     59        List<PluginInformation> loadedPlugins = PluginHandler.getPlugins();
     60        for (int i = 0; i < 2; i++) {
     61            OsmDataLayer layer = new OsmDataLayer(new DataSet(), "Layer "+i, null);
     62            testPlugin(MainApplication.getLayerManager()::addLayer, layer, layerExceptions, loadedPlugins);
     63            testPlugin(MainApplication.getLayerManager()::removeLayer, layer, layerExceptions, loadedPlugins);
     64        }
     65        for (int i = 0; i < 2; i++) {
     66            GpxLayer layer = new GpxLayer(new GpxData());
     67            testPlugin(MainApplication.getLayerManager()::addLayer, layer, layerExceptions, loadedPlugins);
     68            testPlugin(MainApplication.getLayerManager()::removeLayer, layer, layerExceptions, loadedPlugins);
     69        }
     70
     71        MapUtils.debugPrint(System.out, null, loadingExceptions);
     72        MapUtils.debugPrint(System.out, null, layerExceptions);
     73        String msg = Arrays.toString(loadingExceptions.entrySet().toArray()) + '\n' +
     74                     Arrays.toString(layerExceptions.entrySet().toArray());
     75        assertTrue(msg, loadingExceptions.isEmpty() && layerExceptions.isEmpty());
     76    }
     77
     78    /**
     79     * Downloads and loads all JOSM plugins.
     80     */
     81    public static void loadAllPlugins() {
    5282        // Download complete list of plugins
    5383        ReadRemotePluginInformationTask pluginInfoDownloadTask = new ReadRemotePluginInformationTask(
     
    81111        // Load late plugins
    82112        PluginHandler.loadLatePlugins(null, plugins, null);
    83 
    84         Map<String, Throwable> loadingExceptions = PluginHandler.pluginLoadingExceptions.entrySet().stream()
    85                 .collect(Collectors.toMap(e -> e.getKey(), e -> ExceptionUtils.getRootCause(e.getValue())));
    86 
    87         // Add/remove layers twice to test basic plugin good behaviour
    88         Map<String, Throwable> layerExceptions = new HashMap<>();
    89         List<PluginInformation> loadedPlugins = PluginHandler.getPlugins();
    90         for (int i = 0; i < 2; i++) {
    91             OsmDataLayer layer = new OsmDataLayer(new DataSet(), "Layer "+i, null);
    92             testPlugin(MainApplication.getLayerManager()::addLayer, layer, layerExceptions, loadedPlugins);
    93             testPlugin(MainApplication.getLayerManager()::removeLayer, layer, layerExceptions, loadedPlugins);
    94         }
    95         for (int i = 0; i < 2; i++) {
    96             GpxLayer layer = new GpxLayer(new GpxData());
    97             testPlugin(MainApplication.getLayerManager()::addLayer, layer, layerExceptions, loadedPlugins);
    98             testPlugin(MainApplication.getLayerManager()::removeLayer, layer, layerExceptions, loadedPlugins);
    99         }
    100 
    101         MapUtils.debugPrint(System.out, null, loadingExceptions);
    102         MapUtils.debugPrint(System.out, null, layerExceptions);
    103         String msg = Arrays.toString(loadingExceptions.entrySet().toArray()) + '\n' +
    104                      Arrays.toString(layerExceptions.entrySet().toArray());
    105         assertTrue(msg, loadingExceptions.isEmpty() && layerExceptions.isEmpty());
    106113    }
    107114
Note: See TracChangeset for help on using the changeset viewer.