@Before public void setUp() throws Exception { servlet.setRequestPipeline(pipeline); uriManager = new TestConcatUriManager(); servlet.setConcatUriManager(uriManager); expect(request.getHeader("Host")).andReturn(REQUEST_DOMAIN).anyTimes(); expect(lockedDomainService.isSafeForOpenProxy(REQUEST_DOMAIN)) .andReturn(true).anyTimes(); expectGetAndReturnData(URL1, SCRT1); expectGetAndReturnData(URL2, SCRT2); expectGetAndReturnData(URL3, SCRT3); }
@Before public void setUp() throws Exception { servlet.setRequestPipeline(pipeline); uriManager = new TestConcatUriManager(); servlet.setConcatUriManager(uriManager); expect(request.getHeader("Host")).andReturn(REQUEST_DOMAIN).anyTimes(); expect(lockedDomainService.isSafeForOpenProxy(REQUEST_DOMAIN)) .andReturn(true).anyTimes(); expectGetAndReturnData(URL1, SCRT1); expectGetAndReturnData(URL2, SCRT2); expectGetAndReturnData(URL3, SCRT3); }
@Before public void setUp() throws Exception { servlet.setRequestPipeline(pipeline); uriManager = new TestConcatUriManager(); servlet.setConcatUriManager(uriManager); expect(request.getHeader("Host")).andReturn(REQUEST_DOMAIN).anyTimes(); expect(lockedDomainService.isSafeForOpenProxy(REQUEST_DOMAIN)) .andReturn(true).anyTimes(); expectGetAndReturnData(URL1, SCRT1); expectGetAndReturnData(URL2, SCRT2); expectGetAndReturnData(URL3, SCRT3); }
@Test public void testDefaultCacheTtlCacheHeaderMissing() throws Exception { final Uri URL4 = Uri.parse("http://example.org/4.js"); final Uri URL5 = Uri.parse("http://example.org/5.js"); expectGetAndReturnData(URL4, ""); expectGetAndReturnData(URL5, ""); expectRequestWithUris(Lists.newArrayList(URL4, URL5)); servlet.doGet(request, recorder); verify(); int cacheValue = getCacheControlMaxAge(recorder); // HttpResponse.defaultTtl is in msec, division by 1000 is required to convert into sec. assertEquals((int) (HttpResponse.defaultTtl / 1000), cacheValue, 10); }
@Test public void testDefaultCacheTtlCacheHeaderMissing() throws Exception { final Uri URL4 = Uri.parse("http://example.org/4.js"); final Uri URL5 = Uri.parse("http://example.org/5.js"); expectGetAndReturnData(URL4, ""); expectGetAndReturnData(URL5, ""); expectRequestWithUris(Lists.newArrayList(URL4, URL5)); servlet.doGet(request, recorder); verify(); int cacheValue = getCacheControlMaxAge(recorder); // HttpResponse.defaultTtl is in msec, division by 1000 is required to convert into sec. assertEquals((int) (HttpResponse.defaultTtl / 1000), cacheValue, 10); }