本文整理汇总了Java中org.vertx.testtools.VertxAssert类的典型用法代码示例。如果您正苦于以下问题:Java VertxAssert类的具体用法?Java VertxAssert怎么用?Java VertxAssert使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VertxAssert类属于org.vertx.testtools包,在下文中一共展示了VertxAssert类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handle
import org.vertx.testtools.VertxAssert; //导入依赖的package包/类
@Override
public void handle(final Long timerId) {
if (m_counter++ > 50) {
// Stop test
m_logger.info("Stopping 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);
m_logger.info("Publishing batch: {}", m_counter);
vertx.eventBus().publish(FILTER_SOURCE_ADDRESS, event);
}
}
示例2: handle
import org.vertx.testtools.VertxAssert; //导入依赖的package包/类
@Override
public void handle(final Long event) {
if (m_deployed.get()) {
for (int i = 0; i < 10; i++) {
int n = m_rand.nextInt(LOG_LINES.length);
m_tailLogger.info("[" + m_iter++ + "] {}", LOG_LINES[n]);
}
if (m_iter >= m_maxIterCount) {
// Stop test
VertxAssert.testComplete();
// Success, if we caught more than 300 log lines
m_logger.info("Caught {} log lines...", m_count);
Assert.assertTrue("Received less than 300 log line events", m_count > 300);
}
}
}
示例3: testJolokia
import org.vertx.testtools.VertxAssert; //导入依赖的package包/类
@Test
public void testJolokia() throws ResourceException {
/*
vertx.eventBus().registerLocalHandler(FILTER_DEST_ADDRESS, this);
JsonObject config = createBaseConfig();
config.mergeIn(loadJolokiaConfig(config));
// Update interval (how often to read the Jolokia values)
config.putNumber(CONF_KEY_UPDATE_INTERVAL, 1500L);
m_logger.info("Update interval: {}", config.getLong(CONF_KEY_UPDATE_INTERVAL));
container.deployWorkerVerticle(Jolokia.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();
}
}
});
*/
VertxAssert.testComplete();
}
示例4: 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);
}
}
示例5: execOutputCommand
import org.vertx.testtools.VertxAssert; //导入依赖的package包/类
private void execOutputCommand(final JsonObject config) {
container.deployVerticle(Command.class.getName(), config, 1,
new AsyncResultHandler<String>() {
@Override
public void handle(final AsyncResult<String> ar) {
if (ar.succeeded()) {
// Emit event
JsonObject event = EventCreator.create("Command");
vertx.eventBus().publish(EVENT_SRC_ADDRESS, event);
//
// Stop test
//
VertxAssert.testComplete();
} else {
m_logger.error("Failed to deploy verticle", ar.cause());
Assert.fail();
}
}
});
}
示例6: 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);
}
}
}
}
示例7: undeployVerticle
import org.vertx.testtools.VertxAssert; //导入依赖的package包/类
private void undeployVerticle(final String deploymentId) {
Commands.call(
eventBus(),
LOCAL_ADDRESS,
Commands.cmdUndeployVerticle(deploymentId),
new Handler<Message<JsonObject>>() {
@Override
public void handle(Message<JsonObject> message) {
Result result = new Result(message.body());
if (!result.isOk()) {
throw new IllegalStateException(result.getReason());
}
// Stop test
VertxAssert.testComplete();
}
});
}
示例8: testActivator
import org.vertx.testtools.VertxAssert; //导入依赖的package包/类
@Test
public void testActivator() {
JsonObject config = createBaseConfig();
container.deployWorkerVerticle(Activator.class.getName(), config, 1, false,
new AsyncResultHandler<String>() {
@Override
public void handle(final AsyncResult<String> ar) {
if (ar.succeeded()) {
// Stop test
VertxAssert.testComplete();
} else {
m_logger.error("Failed to deploy verticle", ar.cause());
Assert.fail();
}
}
});
}
示例9: deployVerticle
import org.vertx.testtools.VertxAssert; //导入依赖的package包/类
private void deployVerticle(final String vertName, JsonObject vertConfig, int vertInstances) {
logger.trace(logPrefix + "(deployVerticle) vertName: " + vertName);
if (vertName == null || vertConfig == null) {
logger.error(logPrefix + "Unable to deploy the requested verticle because one of the parameters is invalid: " + "Name=" + vertName + ",Config=" + vertConfig);
return;
}
container.deployVerticle(vertName, vertConfig, vertInstances, new AsyncResultHandler<String>() {
@Override
public void handle(AsyncResult<String> asyncResult) {
logger.info(logPrefix + "verticle " + vertName + (asyncResult.succeeded() ? " was deployed successfully !" : " failed to deploy"));
VertxAssert.assertTrue(asyncResult.succeeded());
VertxAssert.assertNotNull("Persistor deployment failed", asyncResult.result());
startTests();
}
});
}
示例10: test02GetGraph
import org.vertx.testtools.VertxAssert; //导入依赖的package包/类
@Test
public void test02GetGraph() {
System.out.println("*** test02GetGraph ***");
JsonObject requestObject = new JsonObject();
requestObject.putString(ArangoPersistor.MSG_PROPERTY_TYPE, ArangoPersistor.MSG_TYPE_GRAPH);
requestObject.putString(GraphAPI.MSG_PROPERTY_ACTION, GraphAPI.MSG_ACTION_READ);
requestObject.putString(GraphAPI.MSG_PROPERTY_GRAPH_NAME, "testgraph");
vertx.eventBus().send(address, requestObject, new Handler<Message<JsonObject>>() {
@Override
public void handle(Message<JsonObject> reply) {
try {
JsonObject response = reply.body();
System.out.println("response: " + response);
JsonObject arangoResult = response.getObject("result");
VertxAssert.assertEquals("The graph operation resulted in an error: " + response.getString("message"), "ok", response.getString("status"));
System.out.println("graph details: " + arangoResult);
}
catch (Exception e) {
VertxAssert.fail("test02GetGraph");
}
VertxAssert.testComplete();
}
});
}
示例11: test04GetVertex
import org.vertx.testtools.VertxAssert; //导入依赖的package包/类
@Test
public void test04GetVertex() {
System.out.println("*** test04GetVertex ***");
JsonObject requestObject = new JsonObject();
requestObject.putString(ArangoPersistor.MSG_PROPERTY_TYPE, ArangoPersistor.MSG_TYPE_GRAPH);
requestObject.putString(GraphAPI.MSG_PROPERTY_ACTION, GraphAPI.MSG_ACTION_READ_VERTEX);
requestObject.putString(GraphAPI.MSG_PROPERTY_GRAPH_NAME, "testgraph");
requestObject.putString(GraphAPI.MSG_PROPERTY_VERTEX_NAME, "testvertex");
vertx.eventBus().send(address, requestObject, new Handler<Message<JsonObject>>() {
@Override
public void handle(Message<JsonObject> reply) {
try {
JsonObject response = reply.body();
System.out.println("response: " + response);
JsonObject arangoResult = response.getObject("result");
VertxAssert.assertEquals("The graph operation resulted in an error: " + response.getString("message"), "ok", response.getString("status"));
System.out.println("vertex details: " + arangoResult);
}
catch (Exception e) {
VertxAssert.fail("test04GetVertex");
}
VertxAssert.testComplete();
}
});
}
示例12: test07DeleteVertex
import org.vertx.testtools.VertxAssert; //导入依赖的package包/类
@Test
public void test07DeleteVertex() {
System.out.println("*** test07DeleteVertex ***");
JsonObject requestObject = new JsonObject();
requestObject.putString(ArangoPersistor.MSG_PROPERTY_TYPE, ArangoPersistor.MSG_TYPE_GRAPH);
requestObject.putString(GraphAPI.MSG_PROPERTY_ACTION, GraphAPI.MSG_ACTION_DELETE_VERTEX);
requestObject.putString(GraphAPI.MSG_PROPERTY_GRAPH_NAME, "testgraph");
requestObject.putString(GraphAPI.MSG_PROPERTY_VERTEX_NAME, "testvertex");
vertx.eventBus().send(address, requestObject, new Handler<Message<JsonObject>>() {
@Override
public void handle(Message<JsonObject> reply) {
try {
JsonObject response = reply.body();
System.out.println("response: " + response);
JsonObject arangoResult = response.getObject("result");
VertxAssert.assertEquals("The graph operation resulted in an error: " + response.getString("message"), "ok", response.getString("status"));
System.out.println("response details: " + arangoResult);
}
catch (Exception e) {
VertxAssert.fail("test07DeleteVertex");
}
VertxAssert.testComplete();
}
});
}
示例13: test09GetEdge
import org.vertx.testtools.VertxAssert; //导入依赖的package包/类
@Test
public void test09GetEdge() {
System.out.println("*** test09GetEdge ***");
JsonObject requestObject = new JsonObject();
requestObject.putString(ArangoPersistor.MSG_PROPERTY_TYPE, ArangoPersistor.MSG_TYPE_GRAPH);
requestObject.putString(GraphAPI.MSG_PROPERTY_ACTION, GraphAPI.MSG_ACTION_READ_EDGE);
requestObject.putString(GraphAPI.MSG_PROPERTY_GRAPH_NAME, "testgraph");
requestObject.putString(GraphAPI.MSG_PROPERTY_EDGE_NAME, "testedgegraph");
vertx.eventBus().send(address, requestObject, new Handler<Message<JsonObject>>() {
@Override
public void handle(Message<JsonObject> reply) {
try {
JsonObject response = reply.body();
System.out.println("response: " + response);
JsonObject arangoResult = response.getObject("result");
VertxAssert.assertEquals("The graph operation resulted in an error: " + response.getString("message"), "ok", response.getString("status"));
System.out.println("edge details: " + arangoResult);
}
catch (Exception e) {
VertxAssert.fail("test09GetEdge");
}
VertxAssert.testComplete();
}
});
}
示例14: test12GetEdges
import org.vertx.testtools.VertxAssert; //导入依赖的package包/类
@Test
public void test12GetEdges() {
System.out.println("*** test12GetEdges ***");
JsonObject requestObject = new JsonObject();
requestObject.putString(ArangoPersistor.MSG_PROPERTY_TYPE, ArangoPersistor.MSG_TYPE_GRAPH);
requestObject.putString(GraphAPI.MSG_PROPERTY_ACTION, GraphAPI.MSG_ACTION_GET_EDGES);
requestObject.putString(GraphAPI.MSG_PROPERTY_GRAPH_NAME, "testgraph");
requestObject.putString(GraphAPI.MSG_PROPERTY_VERTEX_ID, idVertex01);
requestObject.putObject(GraphAPI.MSG_PROPERTY_DOCUMENT, new JsonObject());
vertx.eventBus().send(address, requestObject, new Handler<Message<JsonObject>>() {
@Override
public void handle(Message<JsonObject> reply) {
try {
JsonObject response = reply.body();
System.out.println("response: " + response);
JsonObject arangoResult = response.getObject("result");
VertxAssert.assertEquals("The graph operation resulted in an error: " + response.getString("message"), "ok", response.getString("status"));
System.out.println("result details: " + arangoResult);
}
catch (Exception e) {
VertxAssert.fail("test12GetEdges");
}
VertxAssert.testComplete();
}
});
}
示例15: test13GetVertices
import org.vertx.testtools.VertxAssert; //导入依赖的package包/类
@Test
public void test13GetVertices() {
System.out.println("*** test13GetVertices ***");
JsonObject requestObject = new JsonObject();
requestObject.putString(ArangoPersistor.MSG_PROPERTY_TYPE, ArangoPersistor.MSG_TYPE_GRAPH);
requestObject.putString(GraphAPI.MSG_PROPERTY_ACTION, GraphAPI.MSG_ACTION_GET_VERTICES);
requestObject.putString(GraphAPI.MSG_PROPERTY_GRAPH_NAME, "testgraph");
requestObject.putString(GraphAPI.MSG_PROPERTY_VERTEX_ID, idVertex01);
requestObject.putObject(GraphAPI.MSG_PROPERTY_DOCUMENT, new JsonObject());
vertx.eventBus().send(address, requestObject, new Handler<Message<JsonObject>>() {
@Override
public void handle(Message<JsonObject> reply) {
try {
JsonObject response = reply.body();
System.out.println("response: " + response);
JsonObject arangoResult = response.getObject("result");
VertxAssert.assertEquals("The graph operation resulted in an error: " + response.getString("message"), "ok", response.getString("status"));
System.out.println("result details: " + arangoResult);
}
catch (Exception e) {
VertxAssert.fail("test13GetVertices");
}
VertxAssert.testComplete();
}
});
}