@Test public void testReadConfigRequestMarkedInternal() throws Exception { JSONObject config = createConfig(); config.getJSONObject("default"). getJSONObject(DefaultServiceFetcher.GADGETS_FEATURES_CONFIG) .getJSONObject(DefaultServiceFetcher.OSAPI_FEATURE_CONFIG) .put(DefaultServiceFetcher.OSAPI_BASE_ENDPOINTS, new JSONArray(ImmutableList.of(endPoint1))); JsonContainerConfig containerConfig = new JsonContainerConfig(config, Expressions.forTesting(new Functions())); CapturingHttpFetcher httpFetcher = new CapturingHttpFetcher(); fetcher = new DefaultServiceFetcher(containerConfig, httpFetcher); fetcher.setSecurityTokenCodec( new BasicSecurityTokenCodec() ); Multimap<String, String> services = fetcher.getServicesForContainer("default", "dontcare"); assertEquals(configuredServices, services); assertNotNull( httpFetcher.request ); assertTrue( httpFetcher.request.isInternalRequest() ); }
@Test public void testReadConfigRequestMarkedInternal() throws Exception { JSONObject config = createConfig(); config.getJSONObject("default"). getJSONObject(DefaultServiceFetcher.GADGETS_FEATURES_CONFIG) .getJSONObject(DefaultServiceFetcher.OSAPI_FEATURE_CONFIG) .put(DefaultServiceFetcher.OSAPI_BASE_ENDPOINTS, new JSONArray(ImmutableList.of(endPoint1))); JsonContainerConfig containerConfig = new JsonContainerConfig(config, Expressions.forTesting(new Functions())); CapturingHttpFetcher httpFetcher = new CapturingHttpFetcher(); fetcher = new DefaultServiceFetcher(containerConfig, httpFetcher); fetcher.setSecurityTokenCodec( new BasicSecurityTokenCodec() ); Multimap<String, String> services = fetcher.getServicesForContainer("default", "dontcare"); assertEquals(configuredServices, services); assertNotNull( httpFetcher.request ); assertTrue( httpFetcher.request.isInternalRequest() ); }
@Test public void loadRequestMarkedInternal() throws Exception { String theUrl = "http://apache.org/resource.js"; Uri uri = Uri.parse(theUrl); Map<String, String> attribs = Maps.newHashMap(); attribs.put( "inline", "true" ); CapturingHttpFetcher fetcher = new CapturingHttpFetcher(); FeatureResourceLoader frLoader = new TestFeatureResourceLoader(fetcher, timeSource, new DefaultFeatureFileSystem()); FeatureResource resource = frLoader.load(uri, attribs); assertEquals(URL_JS, resource.getContent()); assertNotNull( fetcher.request ); assertTrue( fetcher.request.isInternalRequest() ); }
@Test public void loadRequestMarkedInternal() throws Exception { String theUrl = "http://apache.org/resource.js"; Uri uri = Uri.parse(theUrl); Map<String, String> attribs = Maps.newHashMap(); attribs.put( "inline", "true" ); CapturingHttpFetcher fetcher = new CapturingHttpFetcher(); FeatureResourceLoader frLoader = new TestFeatureResourceLoader(fetcher, timeSource, new DefaultFeatureFileSystem()); FeatureResource resource = frLoader.load(uri, attribs); assertEquals(URL_JS, resource.getContent()); assertNotNull( fetcher.request ); assertTrue( fetcher.request.isInternalRequest() ); }
public void testIncludedURLRequestMarkedInternal() throws Exception { CacheProvider lru = new LruCacheProvider(3); DefaultHtmlSerializer defaultSerializer = new DefaultHtmlSerializer(); CapturingPipeline pipeline = new CapturingPipeline(); rewriter = new CajaContentRewriter(lru, pipeline, defaultSerializer, proxyUriManager) { @Override protected PluginCompiler makePluginCompiler(PluginMeta m, MessageQueue q) { BuildInfo bi = EasyMock.createNiceMock(BuildInfo.class); expect(bi.getBuildInfo()).andReturn("bi").anyTimes(); expect(bi.getBuildTimestamp()).andReturn("0").anyTimes(); expect(bi.getBuildVersion()).andReturn("0").anyTimes(); expect(bi.getCurrentTime()).andReturn(0L).anyTimes(); replay(bi); return new PluginCompiler(bi, m, q); } }; // we don't really care what the result looks like, we just want to check the issued request String markup = "<script type=\"text/javascript\" src=\"http://www.example.com/scripts/scriptFile.js\"></script>"; String expected = ""; testMarkup( markup, expected ); assertNotNull( pipeline.request ); assertTrue( pipeline.request.isInternalRequest() ); }
public void testIncludedURLRequestMarkedInternal() throws Exception { CacheProvider lru = new LruCacheProvider(3); DefaultHtmlSerializer defaultSerializer = new DefaultHtmlSerializer(); CapturingPipeline pipeline = new CapturingPipeline(); rewriter = new CajaContentRewriter(lru, pipeline, defaultSerializer, proxyUriManager) { @Override protected PluginCompiler makePluginCompiler(PluginMeta m, MessageQueue q) { BuildInfo bi = EasyMock.createNiceMock(BuildInfo.class); expect(bi.getBuildInfo()).andReturn("bi").anyTimes(); expect(bi.getBuildTimestamp()).andReturn("0").anyTimes(); expect(bi.getBuildVersion()).andReturn("0").anyTimes(); expect(bi.getCurrentTime()).andReturn(0L).anyTimes(); replay(bi); return new PluginCompiler(bi, m, q); } }; // we don't really care what the result looks like, we just want to check the issued request String markup = "<script type=\"text/javascript\" src=\"http://www.example.com/scripts/scriptFile.js\"></script>"; String expected = ""; testMarkup( markup, expected ); assertNotNull( pipeline.request ); assertTrue( pipeline.request.isInternalRequest() ); }
assertEquals(AuthType.OAUTH, request.getAuthType()); assertFalse(request.getFollowRedirects()); assertTrue(request.isInternalRequest());
assertEquals(AuthType.OAUTH, request.getAuthType()); assertFalse(request.getFollowRedirects()); assertTrue(request.isInternalRequest());