@Test
  public void testAcquireInvokesFilterChain() throws Exception {
    Configuration configuration = m_injector.getInstance(Configuration.class);
    EasyMock.expect(configuration.getViewRequestThreadPoolMaxSize()).andReturn(1).atLeastOnce();
    EasyMock.expect(configuration.getViewRequestThreadPoolTimeout()).andReturn(2000).atLeastOnce();
    EasyMock.expect(configuration.getClientThreadPoolSize()).andReturn(25).atLeastOnce();

    // servlet mocks
    HttpServletRequest request = createNiceMock(HttpServletRequest.class);
    HttpServletResponse response = createStrictMock(HttpServletResponse.class);
    FilterChain filterChain = createStrictMock(FilterChain.class);

    // semaphore
    EasyMock.expect(m_mockSemaphore.tryAcquire(2000, TimeUnit.MILLISECONDS)).andReturn(true);

    // filter chain
    filterChain.doFilter(request, response);
    EasyMock.expectLastCall().once();

    // semaphore release
    m_mockSemaphore.release();
    EasyMock.expectLastCall().once();

    replayAll();

    ViewThrottleFilter filter = new ViewThrottleFilter();
    m_injector.injectMembers(filter);
    filter.init(null);
    filter.doFilter(request, response, filterChain);

    verifyAll();
  }
Tests that acquiring the {@link Semaphore} ensures that the
{@link FilterChain} is invoked and that the {@link Semaphore} is eventually
released.

@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/view/ViewThrottleFilterTest.java