本文整理汇总了Java中io.vertx.docgen.Source类的典型用法代码示例。如果您正苦于以下问题:Java Source类的具体用法?Java Source怎么用?Java Source使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Source类属于io.vertx.docgen包,在下文中一共展示了Source类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: asyncAssertSuccess_02
import io.vertx.docgen.Source; //导入依赖的package包/类
@Source(translate = false)
public static void asyncAssertSuccess_02(Vertx vertx, TestContext context) {
AtomicBoolean started = new AtomicBoolean();
Async async = context.async();
vertx.deployVerticle(new AbstractVerticle() {
public void start() throws Exception {
started.set(true);
}
}, ar -> {
if (ar.succeeded()) {
context.assertTrue(started.get());
async.complete();
} else {
context.fail(ar.cause());
}
});
// Can be replaced by
vertx.deployVerticle("my.verticle", context.asyncAssertSuccess(id -> {
context.assertTrue(started.get());
}));
}
示例2: asyncAssertSuccess_03
import io.vertx.docgen.Source; //导入依赖的package包/类
@Source(translate = false)
public static void asyncAssertSuccess_03(Vertx vertx, TestContext context) {
Async async = context.async();
vertx.deployVerticle("my.verticle", ar1 -> {
if (ar1.succeeded()) {
vertx.deployVerticle("my.otherverticle", ar2 -> {
if (ar2.succeeded()) {
async.complete();
} else {
context.fail(ar2.cause());
}
});
} else {
context.fail(ar1.cause());
}
});
// Can be replaced by
vertx.deployVerticle("my.verticle", context.asyncAssertSuccess(id ->
vertx.deployVerticle("my_otherverticle", context.asyncAssertSuccess())
));
}
示例3: asyncAssertFailure_02
import io.vertx.docgen.Source; //导入依赖的package包/类
@Source(translate = false)
public static void asyncAssertFailure_02(Vertx vertx, TestContext context) {
Async async = context.async();
vertx.deployVerticle("my.verticle", ar -> {
if (ar.succeeded()) {
context.fail();
} else {
context.assertTrue(ar.cause() instanceof IllegalArgumentException);
async.complete();
}
});
// Can be replaced by
vertx.deployVerticle("my.verticle", context.asyncAssertFailure(cause -> {
context.assertTrue(cause instanceof IllegalArgumentException);
}));
}
示例4: example14_01_dl
import io.vertx.docgen.Source; //导入依赖的package包/类
@Source(translate = false)
public void example14_01_dl(MongoClient mongoService) {
//This could be a serialized object or the contents of a pdf file, etc, in real life
byte[] binaryObject = new byte[40];
JsonObject document = new JsonObject()
.put("name", "Alan Turing")
.put("binaryStuff", new JsonObject().put("$binary", binaryObject));
mongoService.save("smartPeople", document, res -> {
if (res.succeeded()) {
String id = res.result();
mongoService.findOne("smartPeople", new JsonObject().put("_id", id), null, res2 -> {
if (res2.succeeded()) {
byte[] reconstitutedBinaryObject = res2.result().getJsonObject("binaryStuff").getBinary("$binary");
//This could now be de-serialized into an object in real life
} else {
res2.cause().printStackTrace();
}
});
} else {
res.cause().printStackTrace();
}
});
}
示例5: asyncAssertSuccess_01
import io.vertx.docgen.Source; //导入依赖的package包/类
@Source(translate = false)
public static void asyncAssertSuccess_01(Vertx vertx, TestContext context) {
Async async = context.async();
vertx.deployVerticle("my.verticle", ar -> {
if (ar.succeeded()) {
async.complete();
} else {
context.fail(ar.cause());
}
});
// Can be replaced by
vertx.deployVerticle("my.verticle", context.asyncAssertSuccess());
}
示例6: asyncAssertFailure_01
import io.vertx.docgen.Source; //导入依赖的package包/类
@Source(translate = false)
public static void asyncAssertFailure_01(Vertx vertx, TestContext context) {
Async async = context.async();
vertx.deployVerticle("my.verticle", ar -> {
if (ar.succeeded()) {
context.fail();
} else {
async.complete();
}
});
// Can be replaced by
vertx.deployVerticle("my.verticle", context.asyncAssertFailure());
}
示例7: someMethod
import io.vertx.docgen.Source; //导入依赖的package包/类
@Source
public void someMethod() {
int a = 0;
}