Skip to content

Commit

Permalink
modernize: add exclusionPatterns
Browse files Browse the repository at this point in the history
  • Loading branch information
youzipi committed Sep 7, 2022
1 parent 957bea5 commit 1ba1ba0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions pulsar-broker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,9 @@
<ignorePackage>org.apache.pulsar.broker.stats</ignorePackage>
<ignorePackage>org.apache.pulsar.client</ignorePackage>
</ignorePackages>
<exclusionPatterns>
<exclusionPattern>java/lang/StringBuffer."&lt;init&gt;":.*</exclusionPattern>
</exclusionPatterns>
</configuration>
<executions>
<execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void testFilterOutForPreInterceptFilter() throws Exception {
Mockito.doNothing().when(chain).doFilter(Mockito.any(), Mockito.any());
HttpServletRequestWrapper mockInputStream = new MockRequestWrapper(request);
Mockito.doReturn(mockInputStream.getInputStream()).when(request).getInputStream();
Mockito.doReturn(new StringBuilder("http://127.0.0.1:8080")).when(request).getRequestURL();
Mockito.doReturn(new StringBuffer("http://127.0.0.1:8080")).when(request).getRequestURL();

// "application/json" should be intercepted
Mockito.doReturn("application/json").when(request).getContentType();
Expand Down Expand Up @@ -103,7 +103,7 @@ public void testOnFilter() throws Exception {
Mockito.doNothing().when(chain).doFilter(Mockito.any(), Mockito.any());
HttpServletRequestWrapper mockInputStream = new MockRequestWrapper(request);
Mockito.doReturn(mockInputStream.getInputStream()).when(request).getInputStream();
Mockito.doReturn(new StringBuilder("http://127.0.0.1:8080")).when(request).getRequestURL();
Mockito.doReturn(new StringBuffer("http://127.0.0.1:8080")).when(request).getRequestURL();
// "application/json" should be intercepted
Mockito.doReturn("application/json").when(request).getContentType();

Expand All @@ -129,7 +129,7 @@ public void testFilterOutForResponseInterceptFilter() throws Exception {
Mockito.doNothing().when(chain).doFilter(Mockito.any(), Mockito.any());
HttpServletRequestWrapper mockInputStream = new MockRequestWrapper(request);
Mockito.doReturn(mockInputStream.getInputStream()).when(request).getInputStream();
Mockito.doReturn(new StringBuilder("http://127.0.0.1:8080")).when(request).getRequestURL();
Mockito.doReturn(new StringBuffer("http://127.0.0.1:8080")).when(request).getRequestURL();

// "application/json" should be intercepted
Mockito.doReturn("application/json").when(request).getContentType();
Expand Down Expand Up @@ -161,7 +161,7 @@ public void testShouldNotInterceptWhenInterceptorDisabled() throws Exception {
Mockito.doNothing().when(chain).doFilter(Mockito.any(), Mockito.any());
HttpServletRequestWrapper mockInputStream = new MockRequestWrapper(request);
Mockito.doReturn(mockInputStream.getInputStream()).when(request).getInputStream();
Mockito.doReturn(new StringBuilder("http://127.0.0.1:8080")).when(request).getRequestURL();
Mockito.doReturn(new StringBuffer("http://127.0.0.1:8080")).when(request).getRequestURL();

// Should not be intercepted since the broker interceptor disabled.
Mockito.doReturn("application/json").when(request).getContentType();
Expand Down

0 comments on commit 1ba1ba0

Please sign in to comment.