use of zipkin2.Callback in project Gradle-demo by Arisono.
the class testUASApi method saveFormData.
/**
* 动态表单保存 接口
*/
public static void saveFormData() {
String url = baseurl + "/mobile/oa/commonSaveAndSubmit.action";
OkhttpUtils.println(url);
RequestBody formBody = new FormBody.Builder().add("master", master).add("gridStore", "null").add("formStore", "{\"va_holidaytype\":\"按小时\",\"va_vacationtype\":\"事假\",\"va_status\":\"在录入\",\"va_emcode\":\"sunquan\",\"va_emname\":\"龚鹏明\",\"va_department\":\"测试\",\"va_position\":\"测试\",\"va_mankind\":\"副总及以上\",\"va_alldays\":\"12\",\"va_alltimes\":\"25\",\"va_startime\":\"2016-11-28 13:39:00\",\"va_remark\":\"测试\",\"va_recordor\":\"刘佳\",\"va_date\":\"2016-11-28 13:39:00\",\"va_endtime\":\"2016-12-28 13:39:00\"}").add("caller", "Ask4Leave").add("sessionId", sessionId).build();
Request request = new Request.Builder().url(url).header("cookie", "JSESSIONID=" + sessionId).addHeader("sessionUser", emcode).addHeader("content-type", "text/html;charset:utf-8").post(formBody).build();
OkhttpUtils.client.newCall(request).enqueue(new Callback() {
@Override
public void onResponse(Call call, Response response) throws IOException {
OkhttpUtils.println(OkhttpUtils.getResponseString(response));
}
@Override
public void onFailure(Call call, IOException e) {
OkhttpUtils.onFailurePrintln(e);
}
});
}
use of zipkin2.Callback in project Gradle-demo by Arisono.
the class testGithubApi method search_repositories.
/**
* 查询github repositories
*/
public static void search_repositories() {
search_repositories += "?q=" + q + "&sort=" + sort + "&order=" + order + "&page=" + page + "&per_page=" + per_page;
Request request = new Request.Builder().url(search_repositories).build();
OkhttpUtils.println(request.url().toString());
OkhttpUtils.client.newCall(request).enqueue(new Callback() {
@Override
public void onResponse(Call call, Response response) throws IOException {
OkhttpUtils.println(OkhttpUtils.getResponseString(response));
OkhttpUtils.println(search_repositories);
}
@Override
public void onFailure(Call call, IOException e) {
OkhttpUtils.onFailurePrintln(e);
}
});
}
use of zipkin2.Callback in project zipkin by openzipkin.
the class ScribeSpanConsumerTest method entriesWithoutSpansAreSkipped.
@Test
void entriesWithoutSpansAreSkipped() throws Exception {
SpanConsumer consumer = (callback) -> {
// as we shouldn't get here.
throw new AssertionError();
};
ScribeSpanConsumer scribe = newScribeSpanConsumer("zipkin", consumer);
LogEntry entry = new LogEntry();
entry.category = "notzipkin";
entry.message = "hello world";
expectSuccess(scribe, entry);
// Storage finishes after callback so wait for it.
await().untilAsserted(() -> assertThat(scribeMetrics.messages()).isEqualTo(1));
assertThat(scribeMetrics.messagesDropped()).isZero();
assertThat(scribeMetrics.bytes()).isZero();
assertThat(scribeMetrics.spans()).isZero();
assertThat(scribeMetrics.spansDropped()).isZero();
}
use of zipkin2.Callback in project zipkin by openzipkin.
the class ScribeSpanConsumerTest method consumerExceptionBeforeCallbackDoesntSetFutureException.
@Test
void consumerExceptionBeforeCallbackDoesntSetFutureException() {
consumer = (input) -> {
throw new NullPointerException("endpoint was null");
};
ScribeSpanConsumer scribe = newScribeSpanConsumer("zipkin", consumer);
LogEntry entry = new LogEntry();
entry.category = "zipkin";
entry.message = encodedSpan;
CaptureAsyncMethodCallback callback = new CaptureAsyncMethodCallback();
scribe.Log(asList(entry), callback);
// Storage related exceptions are not propagated to the caller. Only marshalling ones are.
assertThat(callback.error).isNull();
// Storage finishes after callback so wait for it.
await().untilAsserted(() -> assertThat(scribeMetrics.messages()).isEqualTo(1));
assertThat(scribeMetrics.messagesDropped()).isZero();
assertThat(scribeMetrics.bytes()).isEqualTo(bytes.length);
assertThat(scribeMetrics.spans()).isEqualTo(1);
assertThat(scribeMetrics.spansDropped()).isEqualTo(1);
}
use of zipkin2.Callback in project zipkin by openzipkin.
the class ScribeSpanConsumerTest method malformedDataIsDropped.
@Test
void malformedDataIsDropped() {
ScribeSpanConsumer scribe = newScribeSpanConsumer("zipkin", consumer);
LogEntry entry = new LogEntry();
entry.category = "zipkin";
entry.message = "notbase64";
CaptureAsyncMethodCallback callback = new CaptureAsyncMethodCallback();
scribe.Log(asList(entry), callback);
assertThat(callback.error).isInstanceOf(IllegalArgumentException.class);
// Storage finishes after callback so wait for it.
await().untilAsserted(() -> assertThat(scribeMetrics.messages()).isEqualTo(1));
assertThat(scribeMetrics.messagesDropped()).isEqualTo(1);
assertThat(scribeMetrics.bytes()).isZero();
assertThat(scribeMetrics.spans()).isZero();
assertThat(scribeMetrics.spansDropped()).isZero();
}
Aggregations