@Test public void testTocContributionFromTwoServers() throws Exception { BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER); RemotePreferenceStore.setTwoMockRemoteServers(); HelpPlugin.getTocManager().clearCache(); Toc[] tocs = HelpPlugin.getTocManager().getTocs("en"); int enTocs = matchingTocs(tocs, "Mock Toc en"); assertEquals(1, enTocs); int deTocs = matchingTocs(tocs, "Mock Toc de"); assertEquals(0, deTocs); RemotePreferenceStore.disableRemoteHelp(); }
public synchronized ICriteriaDefinition getCriteriaDefinition(String locale) { CriteriaDefinition criteriaDefinition = criteriaDefinitionsByLocale.get(locale); if (null == criteriaDefinition) { HelpPlugin.getTocManager().getTocs(locale); long start = System.currentTimeMillis(); if (HelpPlugin.DEBUG_CRITERIA) { System.out.println( "Start to update criteria definition for locale " + locale); // $NON-NLS-1$ } List<CriteriaDefinitionContribution> contributions = new ArrayList<>(Arrays.asList(readCriteriaDefinitionContributions(locale))); CriteriaDefinitionAssembler assembler = new CriteriaDefinitionAssembler(); criteriaDefinition = assembler.assemble(contributions); criteriaDefinitionsByLocale.put(locale, criteriaDefinition); long stop = System.currentTimeMillis(); if (HelpPlugin.DEBUG_CRITERIA) { System.out.println( "Milliseconds to update criteria definition for locale " + locale + " = " + (stop - start)); // $NON-NLS-1$ //$NON-NLS-2$ } } return criteriaDefinition; }