@Test public final void executeTestEvenifOneFails() { List<PluginDefinition> defs = new ArrayList<PluginDefinition>(); for (int i = 0; i < 2; i++) { defs.add(new PluginDefinition()); } final int total = 2; final PagedSet<PluginDefinition> firstPage = new PagedSet<PluginDefinition>(); firstPage.setTotal(total); firstPage.setFromIndex(0); firstPage.setToIndex(9); firstPage.setPagedSet(defs); final ValidationException ve = new ValidationException(); ve.addError("url", "its messed up"); context.checking(new Expectations() { { oneOf(pluginDefMapper).findAll(firstPage.getFromIndex(), firstPage.getToIndex()); will(returnValue(firstPage)); oneOf(populator).populate(with(any(PluginDefinition.class)), with(any(String.class))); will(returnValue(ve)); oneOf(populator).populate(with(any(PluginDefinition.class)), with(any(String.class))); oneOf(pluginDefMapper).refreshGadgetDefinitionUserCounts(); oneOf(pluginDefMapper).flush(); } }); sut.execute(); context.assertIsSatisfied(); }
public void execute() { stopWatch.reset(); stopWatch.start(); try { PagedSet<PluginDefinition> pluginDefs = null; BasicPager pager = new BasicPager(); pager.setPageSize(PAGE_SIZE); pager.setStartItem(0); pager.setEndItem(PAGE_SIZE - 1); pager.setMaxCount(PAGE_SIZE); int pluginsUpdatedCount = 0; while (true) { pluginDefs = pluginDefMapper.findAll(pager.getStartItem(), pager.getEndItem()); pager.setEndItem(pluginDefs.getToIndex()); pager.setMaxCount(pluginDefs.getTotal()); pager.setPageSize(PAGE_SIZE); for (PluginDefinition def : pluginDefs.getPagedSet()) { pluginsUpdatedCount++; try { populator.populate(def, def.getUrl()); } catch (ValidationException ve) { logger.warn("Plugin:'" + def.getUrl() + "' failed to validate and did not update.", ve); } catch (Exception ex) { logger.error("Plugin Update failures", ex); } } if (pager.isNextPageable()) { pager.nextPage(); } else { break; } } logger.info("Total Plugins updated: " + pluginsUpdatedCount); } catch (Exception ex) { logger.error("Error occurred refreshing the Plugin Definition meta data", ex); } pluginDefMapper.flush(); pluginDefMapper.refreshGadgetDefinitionUserCounts(); stopWatch.stop(); logger.info("Plugin Definition update Job: elapsed time: " + DurationFormatUtils.formatDurationHMS(stopWatch.getTime())); }
PluginDefinitionMetaUpdateTask { public void execute() { stopWatch.reset(); stopWatch.start(); try { PagedSet<PluginDefinition> pluginDefs = null; BasicPager pager = new BasicPager(); pager.setPageSize(PAGE_SIZE); pager.setStartItem(0); pager.setEndItem(PAGE_SIZE - 1); pager.setMaxCount(PAGE_SIZE); int pluginsUpdatedCount = 0; while (true) { pluginDefs = pluginDefMapper.findAll(pager.getStartItem(), pager.getEndItem()); pager.setEndItem(pluginDefs.getToIndex()); pager.setMaxCount(pluginDefs.getTotal()); pager.setPageSize(PAGE_SIZE); for (PluginDefinition def : pluginDefs.getPagedSet()) { pluginsUpdatedCount++; try { populator.populate(def, def.getUrl()); } catch (ValidationException ve) { logger.warn("Plugin:'" + def.getUrl() + "' failed to validate and did not update.", ve); } catch (Exception ex) { logger.error("Plugin Update failures", ex); } } if (pager.isNextPageable()) { pager.nextPage(); } else { break; } } logger.info("Total Plugins updated: " + pluginsUpdatedCount); } catch (Exception ex) { logger.error("Error occurred refreshing the Plugin Definition meta data", ex); } pluginDefMapper.flush(); pluginDefMapper.refreshGadgetDefinitionUserCounts(); stopWatch.stop(); logger.info("Plugin Definition update Job: elapsed time: " + DurationFormatUtils.formatDurationHMS(stopWatch.getTime())); } }
PluginDefinitionMetaUpdateTask { public void execute() { stopWatch.reset(); stopWatch.start(); try { PagedSet<PluginDefinition> pluginDefs = null; BasicPager pager = new BasicPager(); pager.setPageSize(PAGE_SIZE); pager.setStartItem(0); pager.setEndItem(PAGE_SIZE - 1); pager.setMaxCount(PAGE_SIZE); int pluginsUpdatedCount = 0; while (true) { pluginDefs = pluginDefMapper.findAll(pager.getStartItem(), pager.getEndItem()); pager.setEndItem(pluginDefs.getToIndex()); pager.setMaxCount(pluginDefs.getTotal()); pager.setPageSize(PAGE_SIZE); for (PluginDefinition def : pluginDefs.getPagedSet()) { pluginsUpdatedCount++; try { populator.populate(def, def.getUrl()); } catch (ValidationException ve) { logger.warn("Plugin:'" + def.getUrl() + "' failed to validate and did not update.", ve); } catch (Exception ex) { logger.error("Plugin Update failures", ex); } } if (pager.isNextPageable()) { pager.nextPage(); } else { break; } } logger.info("Total Plugins updated: " + pluginsUpdatedCount); } catch (Exception ex) { logger.error("Error occurred refreshing the Plugin Definition meta data", ex); } pluginDefMapper.flush(); pluginDefMapper.refreshGadgetDefinitionUserCounts(); stopWatch.stop(); logger.info("Plugin Definition update Job: elapsed time: " + DurationFormatUtils.formatDurationHMS(stopWatch.getTime())); } PluginDefinitionMetaUpdateTask();  PluginDefinitionMetaUpdateTask(final PluginDefinitionMapper inPluginDefMapper,
            final PluginDefinitionPopulator inPopulator); }
PluginDefinitionMetaUpdateTask { public void execute() { stopWatch.reset(); stopWatch.start(); try { PagedSet<PluginDefinition> pluginDefs = null; BasicPager pager = new BasicPager(); pager.setPageSize(PAGE_SIZE); pager.setStartItem(0); pager.setEndItem(PAGE_SIZE - 1); pager.setMaxCount(PAGE_SIZE); int pluginsUpdatedCount = 0; while (true) { pluginDefs = pluginDefMapper.findAll(pager.getStartItem(), pager.getEndItem()); pager.setEndItem(pluginDefs.getToIndex()); pager.setMaxCount(pluginDefs.getTotal()); pager.setPageSize(PAGE_SIZE); for (PluginDefinition def : pluginDefs.getPagedSet()) { pluginsUpdatedCount++; try { populator.populate(def, def.getUrl()); } catch (ValidationException ve) { logger.warn("Plugin:'" + def.getUrl() + "' failed to validate and did not update.", ve); } catch (Exception ex) { logger.error("Plugin Update failures", ex); } } if (pager.isNextPageable()) { pager.nextPage(); } else { break; } } logger.info("Total Plugins updated: " + pluginsUpdatedCount); } catch (Exception ex) { logger.error("Error occurred refreshing the Plugin Definition meta data", ex); } pluginDefMapper.flush(); pluginDefMapper.refreshGadgetDefinitionUserCounts(); stopWatch.stop(); logger.info("Plugin Definition update Job: elapsed time: " + DurationFormatUtils.formatDurationHMS(stopWatch.getTime())); } PluginDefinitionMetaUpdateTask();  PluginDefinitionMetaUpdateTask(final PluginDefinitionMapper inPluginDefMapper,
            final PluginDefinitionPopulator inPopulator); void execute(); }
PluginDefinitionMetaUpdateTask { public void execute() { stopWatch.reset(); stopWatch.start(); try { PagedSet<PluginDefinition> pluginDefs = null; BasicPager pager = new BasicPager(); pager.setPageSize(PAGE_SIZE); pager.setStartItem(0); pager.setEndItem(PAGE_SIZE - 1); pager.setMaxCount(PAGE_SIZE); int pluginsUpdatedCount = 0; while (true) { pluginDefs = pluginDefMapper.findAll(pager.getStartItem(), pager.getEndItem()); pager.setEndItem(pluginDefs.getToIndex()); pager.setMaxCount(pluginDefs.getTotal()); pager.setPageSize(PAGE_SIZE); for (PluginDefinition def : pluginDefs.getPagedSet()) { pluginsUpdatedCount++; try { populator.populate(def, def.getUrl()); } catch (ValidationException ve) { logger.warn("Plugin:'" + def.getUrl() + "' failed to validate and did not update.", ve); } catch (Exception ex) { logger.error("Plugin Update failures", ex); } } if (pager.isNextPageable()) { pager.nextPage(); } else { break; } } logger.info("Total Plugins updated: " + pluginsUpdatedCount); } catch (Exception ex) { logger.error("Error occurred refreshing the Plugin Definition meta data", ex); } pluginDefMapper.flush(); pluginDefMapper.refreshGadgetDefinitionUserCounts(); stopWatch.stop(); logger.info("Plugin Definition update Job: elapsed time: " + DurationFormatUtils.formatDurationHMS(stopWatch.getTime())); } PluginDefinitionMetaUpdateTask();  PluginDefinitionMetaUpdateTask(final PluginDefinitionMapper inPluginDefMapper,
            final PluginDefinitionPopulator inPopulator); void execute();  }