当前位置: 首页>>代码示例>>Java>>正文


Java GZIPResponseStream类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.rest.filter.GZIPResponseStream的典型用法代码示例。如果您正苦于以下问题:Java GZIPResponseStream类的具体用法?Java GZIPResponseStream怎么用?Java GZIPResponseStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GZIPResponseStream类属于org.apache.hadoop.hbase.rest.filter包,在下文中一共展示了GZIPResponseStream类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testResetBuffer

import org.apache.hadoop.hbase.rest.filter.GZIPResponseStream; //导入依赖的package包/类
@Test
public void testResetBuffer() throws IOException {
  when(response.isCommitted()).thenReturn(false);
  ServletOutputStream out = mock(ServletOutputStream.class);
  when(response.getOutputStream()).thenReturn(out);

  ServletOutputStream servletOutput = wrapper.getOutputStream();
  assertEquals(GZIPResponseStream.class, servletOutput.getClass());
  wrapper.resetBuffer();
  verify(response).setHeader("Content-Encoding", null);

  when(response.isCommitted()).thenReturn(true);
  servletOutput = wrapper.getOutputStream();
  assertEquals(out.getClass(), servletOutput.getClass());
  assertNotNull(wrapper.getWriter());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:17,代码来源:TestGZIPResponseWrapper.java

示例2: testReset

import org.apache.hadoop.hbase.rest.filter.GZIPResponseStream; //导入依赖的package包/类
@Test
public void testReset() throws IOException {
  when(response.isCommitted()).thenReturn(false);
  ServletOutputStream out = mock(ServletOutputStream.class);
  when(response.getOutputStream()).thenReturn(out);

  ServletOutputStream servletOutput = wrapper.getOutputStream();
  verify(response).addHeader("Content-Encoding", "gzip");
  assertEquals(GZIPResponseStream.class, servletOutput.getClass());
  wrapper.reset();
  verify(response).setHeader("Content-Encoding", null);

  when(response.isCommitted()).thenReturn(true);
  servletOutput = wrapper.getOutputStream();
  assertEquals(out.getClass(), servletOutput.getClass());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:17,代码来源:TestGZIPResponseWrapper.java

示例3: testResetBuffer

import org.apache.hadoop.hbase.rest.filter.GZIPResponseStream; //导入依赖的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

示例4: testReset

import org.apache.hadoop.hbase.rest.filter.GZIPResponseStream; //导入依赖的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

示例5: testGZIPResponseStream

import org.apache.hadoop.hbase.rest.filter.GZIPResponseStream; //导入依赖的package包/类
@Test
public void testGZIPResponseStream() throws IOException {
  HttpServletResponse httpResponce = mock(HttpServletResponse.class);
  ServletOutputStream out = mock(ServletOutputStream.class);

  when(httpResponce.getOutputStream()).thenReturn(out);
  GZIPResponseStream test = new GZIPResponseStream(httpResponce);
  verify(httpResponce).addHeader("Content-Encoding", "gzip");

  test.close();

  test.resetBuffer();
  verify(httpResponce).setHeader("Content-Encoding", null);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:15,代码来源:TestGZIPResponseWrapper.java


注:本文中的org.apache.hadoop.hbase.rest.filter.GZIPResponseStream类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。