Package org.cometd.javascript

Examples of org.cometd.javascript.Latch.await()


        defineClass(Latch.class);
        evaluateScript("var readyLatch = new Latch(1);");
        Latch readyLatch = get("readyLatch");
        evaluateScript("cometd.addListener('/meta/connect', function(message) { readyLatch.countDown(); });");
        evaluateScript("cometd.handshake();");
        Assert.assertTrue(readyLatch.await(5000));

        // Send a message so that the ack counter is initialized
        evaluateScript("var latch = new Latch(1);");
        Latch latch = get("latch");
        evaluateScript("" +
View Full Code Here


        evaluateScript("var latch = new Latch(1);");
        Latch latch = get("latch");
        evaluateScript("" +
                "cometd.subscribe('/test', function(message) { latch.countDown(); });" +
                "cometd.publish('/test', 'message1');");
        Assert.assertTrue(latch.await(5000));

        // Wait to allow the long poll to go to the server and tell it the ack id
        Thread.sleep(1000);

        // Calling reload() results in the cookie being written
View Full Code Here

                "});" +
                "cometd.handshake();");
        Assert.assertTrue(readyLatch.await(5000));

        ackService.emit("message3");
        Assert.assertTrue(latch.await(5000));

        evaluateScript("window.assert(testMessage.length === 2, 'testMessage.length');");
        evaluateScript("window.assert(testMessage[0].data == 'message2', 'message2');");
        evaluateScript("window.assert(testMessage[1].data == 'message3', 'message3');");
View Full Code Here

                "cometd2.addListener('/meta/handshake', handshakeLatch2, 'countDown');" +
                "" +
                "cometd.init({url: '" + cometdURL + "', logLevel: '" + getLogLevel() + "'});" +
                "");
        Assert.assertTrue(handshakeLatch.await(5000));
        Assert.assertFalse(handshakeLatch2.await(1000));

        String cometdURL2 = cometdURL.replace("localhost", "127.0.0.1");
        evaluateScript("" +
                "cometd2.init({url: '" + cometdURL2 + "', logLevel: '" + getLogLevel() + "'});" +
                "");
View Full Code Here

        String cometdURL2 = cometdURL.replace("localhost", "127.0.0.1");
        evaluateScript("" +
                "cometd2.init({url: '" + cometdURL2 + "', logLevel: '" + getLogLevel() + "'});" +
                "");
        Assert.assertTrue(handshakeLatch2.await(5000));

        String channelName = "/test";

        evaluateScript("var subscribeLatch = new Latch(1);");
        evaluateScript("var subscribeLatch2 = new Latch(1);");
View Full Code Here

        evaluateScript("" +
                "cometd.publish('" + channelName + "', {});" +
                "cometd2.publish('" + channelName + "', {});" +
                "");
        Assert.assertTrue(publishLatch.await(5000));
        Assert.assertTrue(publishLatch2.await(5000));

        evaluateScript("" +
                "cometd.disconnect(true);" +
                "cometd2.disconnect(true);" +
                "");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.