AbstractHttpTransport implements IHttpTransport, IConfigModifier, IShutdownListener, IDependenciesListener { protected FeatureListResourceFactory newFeatureListResourceFactory(URI resourceUri) { final String methodName = "newFeatureMapJSResourceFactory"; boolean traceLogging = log.isLoggable(Level.FINER); if (traceLogging) { log.entering(sourceClass, methodName, new Object[]{resourceUri}); } FeatureListResourceFactory factory = new FeatureListResourceFactory(resourceUri); if (traceLogging) { log.exiting(sourceClass, methodName); } return factory; } 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 testFeatureListResourceFactory_newResource() throws IOException { URI uri = URI.create("namedbundleresource: StringBuffer expected = new StringBuffer(AbstractHttpTransport.FEATURE_LIST_PRELUDE + "["); for (int i = 0; i < featureList.size(); i++) { expected.append(i == 0 ? "" : ",").append("\"").append(featureList.get(i)).append("\""); } expected.append("]" + AbstractHttpTransport.FEATURE_LIST_PROLOGUE); final IAggregator mockAggregator = EasyMock.createMock(IAggregator.class); IDependencies mockDependencies = EasyMock.createMock(IDependencies.class); EasyMock.expect(mockDependencies.getLastModified()).andReturn(10L).anyTimes(); EasyMock.expect(mockAggregator.getDependencies()).andReturn(mockDependencies).anyTimes(); EasyMock.replay(mockAggregator, mockDependencies); AbstractHttpTransport transport = new TestHttpTransport(new CountDownLatch(0), featureList, 10L) { @Override protected IAggregator getAggregator() { return mockAggregator; } }; AbstractHttpTransport.FeatureListResourceFactory factory = transport.newFeatureListResourceFactory(uri); IResource resourceOut = factory.newResource(uri); Assert.assertEquals(10L, resourceOut.lastModified()); StringWriter writer = new StringWriter(); CopyUtil.copy(resourceOut.getReader(), writer); Assert.assertEquals(expected.toString(), writer.toString()); resourceOut = factory.newResource(URI.create("namedbundleresource: writer = new StringWriter(); try { CopyUtil.copy(resourceOut.getReader(), writer); Assert.fail(); } catch (IOException e) { } }