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


Java BytesStream类代码示例

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


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

示例1: setUp

import org.elasticsearch.common.io.BytesStream; //导入依赖的package包/类
@Before
public void setUp() throws IOException {
  initMocks(this);
  BytesReference bytesReference = mock(BytesReference.class);
  BytesStream bytesStream = mock(BytesStream.class);

  when(nameBuilder.getIndexName(any(Event.class))).thenReturn("foo_index");
  when(bytesReference.toBytes()).thenReturn("{\"body\":\"test\"}".getBytes());
  when(bytesStream.bytes()).thenReturn(bytesReference);
  when(serializer.getContentBuilder(any(Event.class)))
      .thenReturn(bytesStream);
  when(elasticSearchClient.prepareIndex(anyString(), anyString()))
      .thenReturn(indexRequestBuilder);
  when(indexRequestBuilder.setSource(bytesReference)).thenReturn(
      indexRequestBuilder);

  fixture = new ElasticSearchTransportClient(elasticSearchClient, serializer);
  fixture.setBulkRequestBuilder(bulkRequestBuilder);
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:20,代码来源:TestElasticSearchTransportClient.java

示例2: setUp

import org.elasticsearch.common.io.BytesStream; //导入依赖的package包/类
@Before
public void setUp() throws IOException {
  initMocks(this);
  BytesReference bytesReference = mock(BytesReference.class);
  BytesStream bytesStream = mock(BytesStream.class);

  when(nameBuilder.getIndexName(any(Event.class))).thenReturn("foo_index");
  //when(bytesReference.toBytes()).thenReturn("{\"body\":\"test\"}".getBytes());
  when(bytesStream.bytes()).thenReturn(bytesReference);
  when(serializer.getContentBuilder(any(Event.class)))
      .thenReturn(bytesStream);
  when(elasticSearchClient.prepareIndex(anyString(), anyString()))
      .thenReturn(indexRequestBuilder);
  when(indexRequestBuilder.setSource(bytesReference)).thenReturn(
      indexRequestBuilder);

  fixture = new ElasticSearchTransportClient(elasticSearchClient, serializer);
  fixture.setBulkRequestBuilder(bulkRequestBuilder);
}
 
开发者ID:Redliver,项目名称:flume-ng-elasticsearch5-sink,代码行数:20,代码来源:TestElasticSearchTransportClient.java

示例3: setUp

import org.elasticsearch.common.io.BytesStream; //导入依赖的package包/类
@Before
 public void setUp() throws IOException {
   initMocks(this);
   BytesReference bytesReference = mock(BytesReference.class);
   BytesStream bytesStream = mock(BytesStream.class);

   when(nameBuilder.getIndexName(any(Event.class))).thenReturn(INDEX_NAME);
   when(bytesReference.toBytesArray()).thenReturn(new BytesArray(MESSAGE_CONTENT));
   when(bytesStream.bytes()).thenReturn(bytesReference);
   serializer = new ExtendedElasticSearchLogStashEventSerializer();
Map<String, String> headers = Maps.newHashMap();
String message = "body";
event = EventBuilder.withBody(message.getBytes(charset));
event.setHeaders(headers);
   fixture = new ElasticSearchRestClient(HOSTS, serializer, httpClient);
 }
 
开发者ID:gigya,项目名称:flume-ng-elasticsearch-ser-ex,代码行数:17,代码来源:TestElasticSearchRestClient.java

示例4: prepareIndexRequest

import org.elasticsearch.common.io.BytesStream; //导入依赖的package包/类
@Override
protected void prepareIndexRequest(IndexRequestBuilder indexRequest,
    String indexName, String indexType, Event event) throws IOException {
  BytesStream contentBuilder = serializer.getContentBuilder(event);
  indexRequest.setIndex(indexName)
      .setType(indexType)
      .setSource(contentBuilder.bytes());
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:9,代码来源:EventSerializerIndexRequestBuilderFactory.java

示例5: setUp

import org.elasticsearch.common.io.BytesStream; //导入依赖的package包/类
@Before
public void setUp() throws IOException {
  initMocks(this);
  BytesReference bytesReference = mock(BytesReference.class);
  BytesStream bytesStream = mock(BytesStream.class);

  when(nameBuilder.getIndexName(any(Event.class))).thenReturn(INDEX_NAME);
  when(bytesReference.toBytesArray()).thenReturn(new BytesArray(MESSAGE_CONTENT));
  when(bytesStream.bytes()).thenReturn(bytesReference);
  when(serializer.getContentBuilder(any(Event.class))).thenReturn(bytesStream);
  fixture = new ElasticSearchRestClient(HOSTS, serializer, httpClient);
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:13,代码来源:TestElasticSearchRestClient.java

示例6: setUp

import org.elasticsearch.common.io.BytesStream; //导入依赖的package包/类
@Before
public void setUp() throws IOException {
  initMocks(this);
  BytesReference bytesReference = mock(BytesReference.class);
  BytesStream bytesStream = mock(BytesStream.class);

  when(nameBuilder.getIndexName(any(Event.class))).thenReturn(INDEX_NAME);
  //when(bytesReference.toBytesArray()).thenReturn(new BytesArray(MESSAGE_CONTENT));
  when(bytesStream.bytes()).thenReturn(bytesReference);
  when(serializer.getContentBuilder(any(Event.class))).thenReturn(bytesStream);
  fixture = new ElasticSearchRestClient(HOSTS, serializer, httpClient);
}
 
开发者ID:Redliver,项目名称:flume-ng-elasticsearch5-sink,代码行数:13,代码来源:TestElasticSearchRestClient.java

示例7: setUp

import org.elasticsearch.common.io.BytesStream; //导入依赖的package包/类
@Before
public void setUp() throws IOException {
  initMocks(this);
  BytesStream bytesStream = mock(BytesStream.class);
  when(elasticSearchClient.prepareIndex(anyString(), anyString()))
          .thenReturn(indexRequestBuilder);
  when(indexRequestBuilder.setSource(document)).thenReturn(indexRequestBuilder);

  fixture = new TransportDocumentLoader(elasticSearchClient);
  fixture.setBulkRequestBuilder(bulkRequestBuilder);
}
 
开发者ID:sematext,项目名称:kite-morphlines-elasticsearch,代码行数:12,代码来源:TransportDocumentLoaderTest.java

示例8: prepareIndexRequest

import org.elasticsearch.common.io.BytesStream; //导入依赖的package包/类
@Override
protected void prepareIndexRequest(IndexRequestBuilder indexRequest, String indexName, String indexType, Event event) throws IOException {
	BytesStream contentBuilder = serializer.getContentBuilder(event);
	BytesReference contentBytes = contentBuilder.bytes();
	indexRequest.setIndex(indexName).setType(indexType).setSource(contentBytes);
	String hashId = docIdBuilder.getDocumentId(contentBytes);
	if (null != hashId && !hashId.isEmpty())
		indexRequest.setId(hashId.toString());
}
 
开发者ID:gigya,项目名称:flume-ng-elasticsearch-ser-ex,代码行数:10,代码来源:ExtendedElasticSearchIndexRequestBuilderFactory.java

示例9: getContentBuilder

import org.elasticsearch.common.io.BytesStream; //导入依赖的package包/类
@Override
public BytesStream getContentBuilder(final Event event) throws IOException {
	final XContentBuilder builder = jsonBuilder().startObject();
	appendBody(builder, event);
	appendHeaders(builder, event);
	return builder;
}
 
开发者ID:jaibeermalik,项目名称:searchanalytics-bigdata,代码行数:8,代码来源:ElasticSearchJsonBodyEventSerializer.java

示例10: prepareIndexRequest

import org.elasticsearch.common.io.BytesStream; //导入依赖的package包/类
@Override
protected void prepareIndexRequest(IndexRequestBuilder indexRequest, String indexName, String indexType, Event event)
        throws IOException {
    BytesStream contentBuilder = serializer.getContentBuilder(event);
    indexRequest.setIndex(indexName).setType(indexType).setSource(contentBuilder.bytes());
    setId(indexRequest, event);
}
 
开发者ID:DevOps-TangoMe,项目名称:flume-elasticsearch,代码行数:8,代码来源:LogstashEventSerializerIndexRequestBuilderFactory.java

示例11: bytes

import org.elasticsearch.common.io.BytesStream; //导入依赖的package包/类
@Override
public BytesReference bytes() {
    close();
    return ((BytesStream) bos).bytes();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:6,代码来源:XContentBuilder.java

示例12: getContentBuilder

import org.elasticsearch.common.io.BytesStream; //导入依赖的package包/类
@Override
public BytesStream getContentBuilder(Event event) throws IOException {
  BytesStreamOutput fbaos = new BytesStreamOutput(4);
  fbaos.write(FAKE_BYTES);
  return fbaos;
}
 
开发者ID:Redliver,项目名称:flume-ng-elasticsearch5-sink,代码行数:7,代码来源:TestElasticSearchSink.java

示例13: bytesStream

import org.elasticsearch.common.io.BytesStream; //导入依赖的package包/类
/**
 * Returns the actual stream used.
 */
public BytesStream bytesStream() throws IOException {
    close();
    return (BytesStream) bos;
}
 
开发者ID:jprante,项目名称:elasticsearch-xml,代码行数:8,代码来源:XmlXContentBuilder.java

示例14: getContentBuilder

import org.elasticsearch.common.io.BytesStream; //导入依赖的package包/类
@Override
public BytesStream getContentBuilder(Event event) throws IOException {
	return getXContentBuilder(event);
}
 
开发者ID:gigya,项目名称:flume-ng-elasticsearch-ser-ex,代码行数:5,代码来源:ExtendedElasticSearchLogStashEventSerializer.java

示例15: getContentBuilder

import org.elasticsearch.common.io.BytesStream; //导入依赖的package包/类
@Override
public BytesStream getContentBuilder(Event event) throws IOException {
  FastByteArrayOutputStream fbaos = new FastByteArrayOutputStream(4);
  fbaos.write(FAKE_BYTES);
  return fbaos;
}
 
开发者ID:Stratio,项目名称:ingestion,代码行数:7,代码来源:TestElasticSearchSink.java


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