本文整理汇总了Java中org.vertx.testtools.VertxAssert.testComplete方法的典型用法代码示例。如果您正苦于以下问题:Java VertxAssert.testComplete方法的具体用法?Java VertxAssert.testComplete怎么用?Java VertxAssert.testComplete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.vertx.testtools.VertxAssert
的用法示例。
在下文中一共展示了VertxAssert.testComplete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handle
import org.vertx.testtools.VertxAssert; //导入方法依赖的package包/类
@Override
public void handle(final Long timerId) {
if (m_latch.getCount() == 0) {
if (m_counter++ > 80) {
// Stop test
VertxAssert.testComplete();
} else {
//
// Generate test events
//
for (JsonObject json : m_metrics) {
JsonObject event = EventCreator.createBatch("metrics", json.toMap(), 5);
vertx.eventBus().publish(FILTER_SOURCE_ADDRESS, event);
}
}
}
}
示例2: handle
import org.vertx.testtools.VertxAssert; //导入方法依赖的package包/类
@Override
public void handle(final Long timerId) {
if (m_counter++ > 50) {
// Stop test
vertx.cancelTimer(m_timer);
VertxAssert.testComplete();
m_cmd.destroy(true);
} else {
//
// Generate test events
//
Map<String, Object> nsqFields = new HashMap();
nsqFields.put(TOPIC_KEY, FILTER_NSQ_TOPIC);
JsonObject event = EventCreator.createBatch("NSQ", nsqFields);
vertx.eventBus().publish(FILTER_SOURCE_ADDRESS, event);
}
}
示例3: handle
import org.vertx.testtools.VertxAssert; //导入方法依赖的package包/类
@Override
public void handle(final Message<JsonObject> message) {
m_logger.info("Received message {}: {}", m_counter, message.body().toString());
if (++m_counter >= 100) {
// Forcefully stop processes
m_cmd1.destroy(true);
m_cmd2.destroy(true);
// Stop test
VertxAssert.testComplete();
}
}
示例4: handle
import org.vertx.testtools.VertxAssert; //导入方法依赖的package包/类
@Override
public void handle(final Long timerId) {
if (m_counter++ > 10) {
// Stop test
VertxAssert.testComplete();
} else {
//
// Generate test events
//
for (JsonObject json : m_metrics) {
JsonObject event = EventCreator.createBatch("metrics", json.toMap(), 5);
vertx.eventBus().publish(FILTER_SOURCE_ADDRESS, event);
}
}
}
示例5: testHttpWriter
import org.vertx.testtools.VertxAssert; //导入方法依赖的package包/类
@Test
public void testHttpWriter() throws Exception {
// We test collectd support on OS X and Linux
if (HostOs.isMac() || HostOs.isLinux()) {
// Start collectd
new CollectdThread("collectd-thread", "collectd.conf").start();
// Collectd listener configuration
JsonObject config = createBaseConfig();
config.mergeIn(loadCollectdConfig(config));
vertx.eventBus().registerLocalHandler(FILTER_DEST_ADDRESS, this);
// Start collectd listener
container.deployWorkerVerticle(Collectd.class.getName(), config, 1, false,
new AsyncResultHandler<String>() {
@Override
public void handle(final AsyncResult<String> ar) {
if (ar.failed()) {
m_logger.error("Failed to deploy verticle", ar.cause());
Assert.fail();
}
}
});
} else {
// Stop test
VertxAssert.testComplete();
}
}
示例6: handle
import org.vertx.testtools.VertxAssert; //导入方法依赖的package包/类
@Override
public void handle(final Message<JsonObject> message) {
m_logger.info("Received event: {}", message.body().toString());
if (++m_counter > 10) {
// Stop collectd
m_cmd.destroy(true);
// Stop test
VertxAssert.testComplete();
}
}
示例7: handle
import org.vertx.testtools.VertxAssert; //导入方法依赖的package包/类
@Override
public void handle(final Message<JsonObject> message) {
m_logger.info("Received event: {}", message.body().encodePrettily());
m_logger.info("======================================== {} =========================================", m_counter);
if (++m_counter > 26) {
// Stop test
VertxAssert.testComplete();
}
}
示例8: testGenerateMessages
import org.vertx.testtools.VertxAssert; //导入方法依赖的package包/类
@Test
public void testGenerateMessages() throws Exception {
// This test requires on OS X: brew install openssl
// NSQ supports OS X and Linux
if (HostOs.isMac() || HostOs.isLinux()) {
ClassLoader cl = ClassLoader.getSystemClassLoader();
URL[] urls = ((URLClassLoader) cl).getURLs();
m_logger.debug("CLASSPATH:");
for (URL url : urls) {
m_logger.debug(url.getFile());
}
JsonObject config = createBaseConfig();
config.mergeIn(loadNsqConfig(config));
new NsqThread().start();
container.deployWorkerVerticle(Nsq.class.getName(), config, 1, false,
new AsyncResultHandler<String>() {
@Override
public void handle(final AsyncResult<String> ar) {
if (ar.failed()) {
m_logger.error("Failed to deploy verticle", ar.cause());
Assert.fail();
}
}
});
m_timer = vertx.setPeriodic(150L, this); // Generate events once every 150 ms
} else {
// Stop test immediately
VertxAssert.testComplete();
}
}
示例9: testSharedSensorData
import org.vertx.testtools.VertxAssert; //导入方法依赖的package包/类
@Test
public void testSharedSensorData() {
ConcurrentSharedMap<String, Object> sensorData
= vertx.sharedData().getMap(SHARED_SENSORS_KEY);
JsonObject config = container.config();
Variables vars = new Variables(config, vertx);
sensorData.put("test.id", 10L);
Assert.assertEquals(Long.valueOf(10L), vars.translate("%{#sensor.test.id}"));
// Stop test
VertxAssert.testComplete();
}
示例10: handle
import org.vertx.testtools.VertxAssert; //导入方法依赖的package包/类
@Override
public void handle(final Message<JsonObject> message) {
m_logger.info("Received message: {}", message.body().toString());
// Stop test
VertxAssert.testComplete();
}
示例11: testGenerateMessages
import org.vertx.testtools.VertxAssert; //导入方法依赖的package包/类
@Test
public void testGenerateMessages() throws Exception {
// NSQ supports OS X and Linux
if (HostOs.isMac() || HostOs.isLinux()) {
ClassLoader cl = ClassLoader.getSystemClassLoader();
URL[] urls = ((URLClassLoader) cl).getURLs();
m_logger.debug("CLASSPATH:");
for (URL url : urls) {
m_logger.debug(url.getFile());
}
JsonObject config = createBaseConfig();
config.mergeIn(loadNsqConfig(config));
new NsqThread().start();
container.deployWorkerVerticle(NsqHttp.class.getName(), config, 1, false,
new AsyncResultHandler<String>() {
@Override
public void handle(final AsyncResult<String> ar) {
if (ar.failed()) {
m_logger.error("Failed to deploy verticle", ar.cause());
Assert.fail();
}
}
});
m_timer = vertx.setPeriodic(150L, this); // Generate events once every 150 ms
} else {
// Stop test immediately
VertxAssert.testComplete();
}
}
示例12: handle
import org.vertx.testtools.VertxAssert; //导入方法依赖的package包/类
@Override
public void handle(final Message<JsonObject> message) {
m_logger.info("Received message: {}", message.body().toString());
// Stop test
VertxAssert.testComplete();
}
示例13: testHttpWriter
import org.vertx.testtools.VertxAssert; //导入方法依赖的package包/类
@Test
public void testHttpWriter() throws Exception {
// We test collectd support on OS X and Linux
if (HostOs.isMac() || HostOs.isLinux()) {
// Start collectd
new CollectdThread("collectd-thread", "collectd-http.conf").start();
// Http server configuration
JsonObject config = createBaseConfig();
config.putArray("add-tags", new JsonArray(new String[]{"collectd"}));
config.putString("input-format", "collectd-json");
vertx.eventBus().registerLocalHandler(FILTER_DEST_ADDRESS, this);
// Start http server
container.deployWorkerVerticle(HttpServer.class.getName(), config, 1, false,
new AsyncResultHandler<String>() {
@Override
public void handle(final AsyncResult<String> ar) {
if (ar.failed()) {
m_logger.error("Failed to deploy verticle", ar.cause());
Assert.fail();
}
}
});
} else {
// Stop test
VertxAssert.testComplete();
}
}
示例14: handle
import org.vertx.testtools.VertxAssert; //导入方法依赖的package包/类
@Override
public void handle(final Message<JsonObject> message) {
m_logger.info("Received event: {}", message.body().toString());
if (++m_counter > 10) {
// Stop collectd
m_cmd.destroy(true);
// Stop test
VertxAssert.testComplete();
}
}
示例15: start
import org.vertx.testtools.VertxAssert; //导入方法依赖的package包/类
public void start() {
VertxAssert.initialize(vertx);
// You can also assert from other verticles!!
VertxAssert.assertEquals("foo", "foo");
// And complete tests from other verticles
VertxAssert.testComplete();
}