本文整理了Java中io.advantageous.boon.core.Exceptions.die()
方法的一些代码示例,展示了Exceptions.die()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Exceptions.die()
方法的具体详情如下:
包路径:io.advantageous.boon.core.Exceptions
类名称:Exceptions
方法名:die
暂无
代码示例来源:origin: advantageous/qbit
@Override
public Iterable<String> valueMulti() {
/* We could support this. */
//noinspection unchecked
return die(Iterable.class, "NOT SUPPORTED");
}
代码示例来源:origin: advantageous/qbit
@SuppressWarnings("NullableProblems")
@Override
public Collection<String> values() {
//noinspection unchecked
return die(Collection.class, "Not supported");
}
代码示例来源:origin: advantageous/qbit
private static String readErrorResponseBody(HttpURLConnection http, int status, String charset) {
InputStream errorStream = http.getErrorStream();
if (errorStream != null) {
String error = charset == null ? IO.read(errorStream) :
IO.read(errorStream, charset);
return Exceptions.die(String.class, "STATUS CODE =" + status + "\n\n" + error);
} else {
return Exceptions.die(String.class, "STATUS CODE =" + status);
}
}
代码示例来源:origin: advantageous/qbit
private Message<Object> parseMessageFromChars(final String returnAddress, char[] chars) {
final char messageType = chars[PROTOCOL_MESSAGE_TYPE_POSITION];
if (messageType == PROTOCOL_MESSAGE_TYPE_METHOD) {
return handleFastBodySubmissionVersion1Chars(returnAddress, chars);
} else if (messageType == PROTOCOL_MESSAGE_TYPE_RESPONSE) {
return parseResponseFromChars(chars, returnAddress);
} else {
die("Unsupported method call", new String(chars));
return null;
}
}
代码示例来源:origin: advantageous/qbit
public void validate() {
super.waitForTrigger(10, o -> requestReceived.get() && responseReceived.get());
if (!requestReceived.get()) {
die("Request not received");
}
if (!responseReceived.get()) {
die("Response not received");
}
}
}
代码示例来源:origin: advantageous/qbit
@After
public void tearDown() {
callCount = 0;
if (!ok) die();
}
代码示例来源:origin: advantageous/qbit
@Test
public void testStart() throws Exception {
client.start();
ok = httpPeriodicFlushCallbackCalled || die();
ok = httpStartCalled || die();
}
代码示例来源:origin: advantageous/qbit
@Test
public void testWriteString() throws Exception {
Buffer buffer = Buffer.buffer();
BufferUtils.writeString(buffer, "hi mom");
final short size = buffer.getShort(0);
ok = size == 6 || die();
final String utf_8 = buffer.getString(2, size + 2, StandardCharsets.UTF_8.displayName());
puts(utf_8);
ok = utf_8.equals("hi mom") || die();
}
代码示例来源:origin: advantageous/qbit
@Test
public void testStop() throws Exception {
client.stop();
ok = httpStopCalled || die();
}
代码示例来源:origin: advantageous/qbit
@Test
public void testReadString() throws Exception {
Buffer buffer = Buffer.buffer();
BufferUtils.writeString(buffer, "hi mom");
int[] location = new int[]{0};
String backOut = BufferUtils.readString(buffer, location);
ok = backOut.equals("hi mom") || die();
}
代码示例来源:origin: advantageous/qbit
@Test
public void testTimeOut() throws Exception {
timeOutCounter.set(0);
Sys.sleep(10);
final HttpRequest request = new HttpRequestBuilder().setUri("/services/mock/timeOut").setTextReceiver(new MockReceiver()).setBody("").build();
httpServer.sendRequest(request);
waitForTrigger(20, o -> timeOutCounter.get() >= 1);
ok |= responseCounter == 0 || die();
ok |= callMeCounter == 0 || die();
ok |= timeOutCounter.get() >= 1 || die(); //TODO fix
}
代码示例来源:origin: advantageous/qbit
@Test
public void testRecord() throws Exception {
statServiceClient.recordCount("mystat", 1);
serviceBundle.flush();
triggerLatchWhen(o -> replicator.count.get() == 1);
waitForLatch(20);
ok = replicator.count.get() == 1 || die();
}
代码示例来源:origin: advantageous/qbit
@Test
public void testLastSecond() throws Exception {
statServiceClient.recordCount("mystat", 1);
serviceBundle.flush();
triggerLatchWhen(o -> replicator.count.get() == 1);
waitForLatch(20);
ok = replicator.count.get() == 1 || die();
}
代码示例来源:origin: advantageous/qbit
@Test
public void testWriteMap() throws Exception {
Buffer buffer = Buffer.buffer();
MultiMap<String, String> map = new MultiMapImpl<>();
map.put("key", "value");
BufferUtils.writeMap(buffer, map);
int[] location = new int[]{0};
MultiMap<String, String> map2 = BufferUtils.readMap(buffer, location);
final String value = map2.get("key");
ok = value.equals("value") || die();
}
代码示例来源:origin: advantageous/qbit
@Test
public void test() {
proxy.method1();
proxy.clientProxyFlush();
Sys.sleep(1000);
ok = callCount == 1 || die();
}
代码示例来源:origin: advantageous/qbit
@Test
public void testRecordAll() throws Exception {
String[] names = Arry.array("stat1", "stat2");
long[] counts = Lng.array(1, 2);
statServiceClient.recordAll(Timer.timer().now(), names, counts);
serviceBundle.flush();
triggerLatchWhen(o -> replicator.count.get() == 3);
waitForLatch(20);
ok = replicator.count.get() == 3 || die(replicator.count);
}
代码示例来源:origin: advantageous/qbit
@Test
public void testWeSocketCallThatIsCrap() throws Exception {
httpServer.sendWebSocketServerMessage(new WebSocketMessageBuilder().setMessage("CRAP")
.setRemoteAddress("/crap/at/crap").setSender(new MockWebSocketSender()).build());
Sys.sleep(10);
serviceServerImpl.flush();
Sys.sleep(10);
waitForTrigger(20, o -> responseCounter == 1 && failureCounter == 1);
ok |= responseCounter == 1 || die();
ok |= failureCounter == 1 || die();
}
代码示例来源:origin: advantageous/qbit
@Test
public void testSimpleHTTPRequest() throws Exception {
final HttpRequest request = new HttpRequestBuilder().setUri("/services/mock/callme").setTextReceiver(new MockReceiver()).setBody("").build();
httpServer.sendRequest(request);
Sys.sleep(10);
serviceServerImpl.flush();
Sys.sleep(10);
waitForTrigger(20, o -> responseCounter == 1 && callMeCounter == 1);
ok |= responseCounter == 1 || die();
ok |= callMeCounter == 1 || die();
}
代码示例来源:origin: advantageous/qbit
@Test
public void test() {
serviceBundle.addService(new MockService());
proxy = serviceBundle.createLocalProxy(MockServiceInterface.class, "mockService");
serviceBundle.startReturnHandlerProcessor();
proxy.method1();
proxy.clientProxyFlush();
Sys.sleep(1000);
ok = callCount == 1 || die();
}
代码示例来源:origin: advantageous/qbit
@Test
public void testCallBack() throws Exception {
client.start();
Sys.sleep(100);
final ServiceMock mockService = client.createProxy(ServiceMock.class, "mockService");
mockService.sum(integer -> puts("SUM", integer));
((ClientProxy) mockService).clientProxyFlush();
Sys.sleep(100);
ok = httpSendWebSocketCalled || die();
}
内容来源于网络,如有侵权,请联系作者删除!