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


Java VertxAssert类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:clidev,项目名称:spike.x,代码行数:20,代码来源:NsqOutTest.java

示例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);
        }
    }
}
 
开发者ID:clidev,项目名称:spike.x,代码行数:19,代码来源:TailFileTest.java

示例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();
    }
 
开发者ID:clidev,项目名称:spike.x,代码行数:26,代码来源:JolokiaTest.java

示例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);
    }
}
 
开发者ID:clidev,项目名称:spike.x,代码行数:18,代码来源:NsqHttpOutTest.java

示例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();
                        }
                    }
                });
    }
 
开发者ID:clidev,项目名称:spike.x,代码行数:22,代码来源:CommandTest.java

示例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);
            }
        }
    }
}
 
开发者ID:clidev,项目名称:spike.x,代码行数:18,代码来源:InfluxDbTest.java

示例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();
                }
            });
}
 
开发者ID:clidev,项目名称:spike.x,代码行数:19,代码来源:ActivatorTest.java

示例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();
                    }
                }
            });
}
 
开发者ID:clidev,项目名称:spike.x,代码行数:22,代码来源:OshiTest.java

示例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();
        }
    });
}
 
开发者ID:santo74,项目名称:vertx-arangodb,代码行数:17,代码来源:BaseIntegrationTest.java

示例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();
        }
    });
}
 
开发者ID:santo74,项目名称:vertx-arangodb,代码行数:25,代码来源:GraphIntegrationTest.java

示例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();
        }
    });
}
 
开发者ID:santo74,项目名称:vertx-arangodb,代码行数:26,代码来源:GraphIntegrationTest.java

示例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();
        }
    });
}
 
开发者ID:santo74,项目名称:vertx-arangodb,代码行数:26,代码来源:GraphIntegrationTest.java

示例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();
        }
    });
}
 
开发者ID:santo74,项目名称:vertx-arangodb,代码行数:26,代码来源:GraphIntegrationTest.java

示例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();
        }
    });
}
 
开发者ID:santo74,项目名称:vertx-arangodb,代码行数:27,代码来源:GraphIntegrationTest.java

示例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();
        }
    });
}
 
开发者ID:santo74,项目名称:vertx-arangodb,代码行数:27,代码来源:GraphIntegrationTest.java


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