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


Java Source类代码示例

本文整理汇总了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());
  }));
}
 
开发者ID:vert-x3,项目名称:vertx-unit,代码行数:24,代码来源:Examples.java

示例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())
  ));
}
 
开发者ID:vert-x3,项目名称:vertx-unit,代码行数:24,代码来源:Examples.java

示例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);
  }));
}
 
开发者ID:vert-x3,项目名称:vertx-unit,代码行数:19,代码来源:Examples.java

示例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();
    }
  });
}
 
开发者ID:vert-x3,项目名称:vertx-mongo-client,代码行数:24,代码来源:Examples.java

示例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());
}
 
开发者ID:vert-x3,项目名称:vertx-unit,代码行数:16,代码来源:Examples.java

示例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());
}
 
开发者ID:vert-x3,项目名称:vertx-unit,代码行数:16,代码来源:Examples.java

示例7: someMethod

import io.vertx.docgen.Source; //导入依赖的package包/类
@Source
public void someMethod() {
  int a = 0;
}
 
开发者ID:vert-x3,项目名称:vertx-docgen,代码行数:5,代码来源:TheExample.java


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