本文整理汇总了Java中org.apache.hadoop.hbase.rest.filter.GZIPResponseWrapper类的典型用法代码示例。如果您正苦于以下问题:Java GZIPResponseWrapper类的具体用法?Java GZIPResponseWrapper怎么用?Java GZIPResponseWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GZIPResponseWrapper类属于org.apache.hadoop.hbase.rest.filter包,在下文中一共展示了GZIPResponseWrapper类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testResetBuffer
import org.apache.hadoop.hbase.rest.filter.GZIPResponseWrapper; //导入依赖的package包/类
@Test
public void testResetBuffer() throws IOException {
HttpServletResponse response = mock(HttpServletResponse.class);
when(response.isCommitted()).thenReturn(false);
ServletOutputStream out = mock(ServletOutputStream.class);
when(response.getOutputStream()).thenReturn(out);
GZIPResponseWrapper test = new GZIPResponseWrapper(response);
ServletOutputStream servletOutput = test.getOutputStream();
assertEquals(org.apache.hadoop.hbase.rest.filter.GZIPResponseStream.class,
servletOutput.getClass());
test.resetBuffer();
verify(response).setHeader("Content-Encoding", null);
when(response.isCommitted()).thenReturn(true);
servletOutput = test.getOutputStream();
assertEquals(out.getClass(), servletOutput.getClass());
assertNotNull(test.getWriter());
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:21,代码来源:TestGZIPResponseWrapper.java
示例2: testReset
import org.apache.hadoop.hbase.rest.filter.GZIPResponseWrapper; //导入依赖的package包/类
@Test
public void testReset() throws IOException {
HttpServletResponse response = mock(HttpServletResponse.class);
when(response.isCommitted()).thenReturn(false);
ServletOutputStream out = mock(ServletOutputStream.class);
when(response.getOutputStream()).thenReturn(out);
GZIPResponseWrapper test = new GZIPResponseWrapper(response);
ServletOutputStream servletOutput = test.getOutputStream();
assertEquals(org.apache.hadoop.hbase.rest.filter.GZIPResponseStream.class,
servletOutput.getClass());
test.reset();
verify(response).setHeader("Content-Encoding", null);
when(response.isCommitted()).thenReturn(true);
servletOutput = test.getOutputStream();
assertEquals(out.getClass(), servletOutput.getClass());
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:19,代码来源:TestGZIPResponseWrapper.java
示例3: testHeader
import org.apache.hadoop.hbase.rest.filter.GZIPResponseWrapper; //导入依赖的package包/类
/**
* headers function should be called in response except header "content-length"
*
* @throws IOException
*/
@Test
public void testHeader() throws IOException {
HttpServletResponse response = mock(HttpServletResponse.class);
GZIPResponseWrapper test = new GZIPResponseWrapper(response);
test.setStatus(200);
verify(response).setStatus(200);
test.addHeader("header", "header value");
verify(response).addHeader("header", "header value");
test.addHeader("content-length", "header value2");
verify(response, never()).addHeader("content-length", "header value");
test.setIntHeader("header", 5);
verify(response).setIntHeader("header", 5);
test.setIntHeader("content-length", 4);
verify(response, never()).setIntHeader("content-length", 4);
test.setHeader("set-header", "new value");
verify(response).setHeader("set-header", "new value");
test.setHeader("content-length", "content length value");
verify(response, never()).setHeader("content-length", "content length value");
test.sendRedirect("location");
verify(response).sendRedirect("location");
test.flushBuffer();
verify(response).flushBuffer();
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:36,代码来源:TestGZIPResponseWrapper.java
示例4: testSendError
import org.apache.hadoop.hbase.rest.filter.GZIPResponseWrapper; //导入依赖的package包/类
@Test
public void testSendError() throws IOException {
HttpServletResponse response = mock(HttpServletResponse.class);
GZIPResponseWrapper test = new GZIPResponseWrapper(response);
test.sendError(404);
verify(response).sendError(404);
test.sendError(404, "error message");
verify(response).sendError(404, "error message");
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:13,代码来源:TestGZIPResponseWrapper.java
注:本文中的org.apache.hadoop.hbase.rest.filter.GZIPResponseWrapper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论