Package com.jetdrone.vertx.yoke

Examples of com.jetdrone.vertx.yoke.Yoke


*/
public class Issue88Test extends TestVerticle {

    @Test
    public void testIssue88() {
        Yoke yoke = new Yoke(this)
                .set("title", "Yoke 1.0.7: Issue #88")
                .engine("hbs", new HandlebarsEngine("issue88/"))
                .use(new ErrorHandler(true))
                .use("/$", new Middleware() {
                            @Override
View Full Code Here


public class VHost extends TestVerticle {

    @Test
    public void testLimit() {
        Yoke yoke = new Yoke(this);
        yoke.use(new Vhost("*.com", new Handler<HttpServerRequest>() {
            @Override
            public void handle(HttpServerRequest request) {
                request.response().end();
                testComplete();
            }
        }));
        yoke.use(new Handler<YokeRequest>() {
            @Override
            public void handle(YokeRequest request) {
                request.response().end();
                fail();
            }
View Full Code Here

    @Test
    public void testJsonBodyParser() {

        final JsonObject json = new JsonObject().putString("key", "value");

        Yoke yoke = new Yoke(this);
        yoke.use(new com.jetdrone.vertx.yoke.middleware.BodyParser());
        yoke.use(new Handler<YokeRequest>() {
            @Override
            public void handle(YokeRequest request) {
                assertNotNull(request.body());
                assertEquals(((JsonObject) request.body()).encode(), json.encode());
                request.response().end();
View Full Code Here

public class TooBusyTest extends TestVerticle {

    @Test
    public void testIsTooBusy() throws Exception {

        final Yoke yoke = new Yoke(this);
        final TooBusy tooBusy = new TooBusy();
        yoke.use(tooBusy);
        yoke.use(new Middleware() {
            double cnt = 0;
            final SecureRandom rand = new SecureRandom();

            @Override
            public void handle(@NotNull YokeRequest request, @NotNull Handler<Object> next) {
View Full Code Here

    }

    @Test
    public void testMapBodyParser() {

        Yoke yoke = new Yoke(this);
        yoke.use(new Handler<YokeRequest>() {
            @Override
            public void handle(YokeRequest request) {
                MultiMap body = request.formAttributes();
                assertEquals("value", body.get("param"));
                request.response().end();
View Full Code Here

    }

    @Test
    public void testTextBodyParser() {

        Yoke yoke = new Yoke(this);
        yoke.use(new com.jetdrone.vertx.yoke.middleware.BodyParser());
        yoke.use(new Handler<YokeRequest>() {
            @Override
            public void handle(YokeRequest request) {
                Buffer body = request.body();
                assertEquals("hello-world", body.toString());
                request.response().end();
View Full Code Here

    }

    @Test
    public void testBodyParserWithEmptyBody() {

        Yoke yoke = new Yoke(this);
        yoke.use(new Handler<YokeRequest>() {
            @Override
            public void handle(YokeRequest request) {
                request.response().end();
            }
        });
View Full Code Here

    }

    @Test
    public void testJsonBodyLengthLimit() {

        Yoke yoke = new Yoke(this);
        yoke.use(new Limit(5L));
        yoke.use(new com.jetdrone.vertx.yoke.middleware.BodyParser());
        yoke.use(new Handler<YokeRequest>() {
            @Override
            public void handle(YokeRequest request) {
                fail("Body should have been too long");
            }
        });
View Full Code Here

    }

    @Test
    public void testTextBodyLengthLimit() {

        Yoke yoke = new Yoke(this);
        yoke.use(new Limit(5L));
        yoke.use(new com.jetdrone.vertx.yoke.middleware.BodyParser());
        yoke.use(new Handler<YokeRequest>() {
            @Override
            public void handle(YokeRequest request) {
                fail("Body should have been too long");
            }
        });
View Full Code Here

        // deploy mongo module
        container.deployModule("io.vertx~mod-mongo-persistor~2.0.0-final", dbConfig);

        // create the yoke app
        new Yoke(this)
                // register the MVEL engine
                .engine("mvel", new MVELEngine("views"))

                // Test 1: JSON serialization
                .use("/json", new Middleware() {
View Full Code Here

TOP

Related Classes of com.jetdrone.vertx.yoke.Yoke

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.