Tabnine Logo
TestStaticUserWebFilter.mockConfig
Code IndexAdd Tabnine to your IDE (free)

How to use
mockConfig
method
in
org.apache.hadoop.http.lib.TestStaticUserWebFilter

Best Java code snippets using org.apache.hadoop.http.lib.TestStaticUserWebFilter.mockConfig (Showing top 2 results out of 315)

origin: ch.cern.hadoop/hadoop-common

@Test
public void testFilter() throws Exception {
 FilterConfig config = mockConfig("myuser");
 StaticUserFilter suf = new StaticUserFilter();
 suf.init(config);
 
 ArgumentCaptor<HttpServletRequestWrapper> wrapperArg =
  ArgumentCaptor.forClass(HttpServletRequestWrapper.class);
 FilterChain chain = mock(FilterChain.class);
 
 suf.doFilter(mock(HttpServletRequest.class), mock(ServletResponse.class),
   chain);
   
 Mockito.verify(chain).doFilter(wrapperArg.capture(), Mockito.<ServletResponse>anyObject());
 
 HttpServletRequestWrapper wrapper = wrapperArg.getValue();
 assertEquals("myuser", wrapper.getUserPrincipal().getName());
 assertEquals("myuser", wrapper.getRemoteUser());
 
 suf.destroy();
}

origin: com.github.jiayuhan-it/hadoop-common

@Test
public void testFilter() throws Exception {
 FilterConfig config = mockConfig("myuser");
 StaticUserFilter suf = new StaticUserFilter();
 suf.init(config);
 
 ArgumentCaptor<HttpServletRequestWrapper> wrapperArg =
  ArgumentCaptor.forClass(HttpServletRequestWrapper.class);
 FilterChain chain = mock(FilterChain.class);
 
 suf.doFilter(mock(HttpServletRequest.class), mock(ServletResponse.class),
   chain);
   
 Mockito.verify(chain).doFilter(wrapperArg.capture(), Mockito.<ServletResponse>anyObject());
 
 HttpServletRequestWrapper wrapper = wrapperArg.getValue();
 assertEquals("myuser", wrapper.getUserPrincipal().getName());
 assertEquals("myuser", wrapper.getRemoteUser());
 
 suf.destroy();
}

org.apache.hadoop.http.libTestStaticUserWebFiltermockConfig

Popular methods of TestStaticUserWebFilter

    Popular in Java

    • Reactive rest calls using spring rest template
    • addToBackStack (FragmentTransaction)
    • scheduleAtFixedRate (ScheduledExecutorService)
    • getResourceAsStream (ClassLoader)
    • SQLException (java.sql)
      An exception that indicates a failed JDBC operation. It provides the following information about pro
    • NoSuchElementException (java.util)
      Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
    • Manifest (java.util.jar)
      The Manifest class is used to obtain attribute information for a JarFile and its entries.
    • XPath (javax.xml.xpath)
      XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
    • Base64 (org.apache.commons.codec.binary)
      Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
    • Table (org.hibernate.mapping)
      A relational table
    • Top Sublime Text plugins
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Tabnine for your IDE now