use of zipkin.internal.CallbackCaptor in project zipkin by openzipkin.
the class HttpBulkSpanIndexerTest method addsPipelineId.
@Test
public void addsPipelineId() throws Exception {
close();
indexer = new HttpBulkSpanIndexer(storage = ElasticsearchHttpStorage.builder().hosts(asList(es.url("").toString())).pipeline("zipkin").build());
es.enqueue(new MockResponse());
CallbackCaptor<Void> callback = new CallbackCaptor<>();
indexer.add("zipkin-2016-10-01", TestObjects.TRACE.get(0), (Long) null).execute(callback);
callback.get();
RecordedRequest request = es.takeRequest();
assertThat(request.getPath()).isEqualTo("/_bulk?pipeline=zipkin");
}
use of zipkin.internal.CallbackCaptor in project zipkin by openzipkin.
the class InternalForTests method writeDependencyLinks.
public static void writeDependencyLinks(ElasticsearchHttpStorage es, List<DependencyLink> links, long midnightUTC) {
String index = es.indexNameFormatter().indexNameForTimestamp(midnightUTC);
HttpBulkIndexer<DependencyLink> indexer = new HttpBulkIndexer<DependencyLink>(DEPENDENCY_LINK, es) {
@Override
byte[] toJsonBytes(DependencyLink link) {
return Codec.JSON.writeDependencyLink(link);
}
};
for (DependencyLink link : links) {
// Unique constraint
indexer.add(index, link, link.parent + "|" + link.child);
}
CallbackCaptor<Void> callback = new CallbackCaptor<>();
indexer.execute(callback);
callback.get();
}
Aggregations