AbstractHttpTransport implements IHttpTransport, IConfigModifier, IShutdownListener, IDependenciesListener { protected String clientRegisterSyntheticModules() { final String methodName = "clientRegisterSyntheticModules"; boolean traceLogging = log.isLoggable(Level.FINER); if (traceLogging) { log.entering(sourceClass, methodName); } StringBuffer sb = new StringBuffer(); Map<String, Integer> map = getModuleIdMap(); if (map != null && getModuleIdRegFunctionName() != null) { Collection<String> names = getSyntheticModuleNames(); if (names != null && names.size() > 0) { sb.append(getModuleIdRegFunctionName()).append("([[["); int i = 0; for (String name : names) { if (map.get(name) != null) { sb.append(i++==0 ?"":",").append("\"").append(name).append("\""); } } sb.append("]],[["); i = 0; for (String name : names) { Integer id = map.get(name); if (id != null) { sb.append(i++==0?"":",").append(id.intValue()); } } sb.append("]]]);"); } } if (traceLogging) { log.exiting(sourceClass, methodName, sb.toString()); } return sb.toString(); } AbstractHttpTransport();   AbstractHttpTransport(CountDownLatch depsInitialized, List<String> dependentFeatures, long depsLastMod); @SuppressWarnings("deprecation") @Override void decorateRequest(HttpServletRequest request); @Override Map<String, Integer> getModuleIdMap(); @Override String getModuleIdRegFunctionName(); @Override void modifyConfig(IAggregator aggregator, Object configObj); @Override void initialize(IAggregator aggregator, IAggregatorExtension extension, IExtensionRegistrar reg); @Override void shutdown(IAggregator aggregator); @Override void contributeLoaderExtensionJavaScript(String contribution); @Override String getLayerContribution(HttpServletRequest request,
			LayerContributionType type, Object arg); abstract boolean isServerExpandable(HttpServletRequest request, String mid); @Override abstract List<ICacheKeyGenerator> getCacheKeyGenerators(); @Override void dependenciesLoaded(IDependencies deps, long sequence); static final String PATHS_PROPNAME; static final String REQUESTEDMODULES_REQPARAM; static final String REQUESTEDMODULEIDS_REQPARAM; static final String REQUESTEDMODULESCOUNT_REQPARAM; static final String EXCLUDEENC_REQPARAM; static final String EXCLUDEIDS_REQPARAM; static final String CONSOLE_WARNING_MSG_FMT; static final String SCRIPTS_REQPARAM; static final String DEPS_REQPARAM; static final String REQUIRED_REQPARAM; static final String PRELOADS_REQPARAM; static final String EXCLUDES_REQPARAM; static final String FEATUREMAP_REQPARAM; static final String FEATUREMAPHASH_REQPARAM; static final String FAILONVERSIONERR_REQPARAM; static final String[] INCLUDEREQUIREDEPS_REQPARAM; static final String[] INCLUDEUNDEFINEDFEATUREDEPS_REQPARAM; static final String[] ASSERTNONLS_REQPARAM; static final String[] OPTIMIZATIONLEVEL_REQPARAMS; static final String[] EXPANDREQUIRELISTS_REQPARAMS; static final String[] EXPORTMODULENAMES_REQPARAMS; static final String[] SHOWFILENAMES_REQPARAMS; static final String[] NOCACHE_REQPARAMS; static final String[] REQUESTEDLOCALES_REQPARAMS; static final String[] CACHEBUST_REQPARAMS; static final String[] SERVEREXPANDLAYERS_REQPARAMS; static final String[] DEPENDENCYEXPANSIONLOGGING_REQPARAMS; static final String[] GENERATESOURCEMAPS_REQPARAMS; static final String CONFIGVARNAME_REQPARAM; static final String LAYERCONTRIBUTIONSTATE_REQATTRNAME; static final String ENCODED_FEATURE_MAP_REQPARAM; static final String FEATURE_LIST_PRELUDE; static final String FEATURE_LIST_PROLOGUE; }
@Test public void testclientRegisterSyntheticModules() throws Exception { final Map<String, Integer> moduleIdMap = new HashMap<String, Integer>(); final Collection<String> syntheticModuleNames = new ArrayList<String>(); moduleIdMap.put("combo/text", 100); moduleIdMap.put("fooplugin", 200); TestHttpTransport transport = new TestHttpTransport(TestUtils.createMockAggregator()) { @Override public Map<String, Integer> getModuleIdMap() { return moduleIdMap; } @Override public String getModuleIdRegFunctionName() { return "reg"; } @Override public Collection<String> getSyntheticModuleNames() { return syntheticModuleNames; } }; String result = transport.clientRegisterSyntheticModules(); Assert.assertEquals("", result); syntheticModuleNames.add("combo/text"); result = transport.clientRegisterSyntheticModules(); Assert.assertEquals("reg([[[\"combo/text\"]],[[100]]]);", result); syntheticModuleNames.add("noid"); result = transport.clientRegisterSyntheticModules(); Assert.assertEquals("reg([[[\"combo/text\"]],[[100]]]);", result); syntheticModuleNames.add("fooplugin"); result = transport.clientRegisterSyntheticModules(); Assert.assertEquals("reg([[[\"combo/text\",\"fooplugin\"]],[[100,200]]]);", result); }