Package org.cometd.javascript

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


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

        Assert.assertTrue(connectLatch.await(5000));

        evaluateScript("cometd.disconnect(true);");
    }

    @Test
View Full Code Here


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

        Assert.assertTrue(connectLatch.await(5000));

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

        evaluateScript("cometd.configure({url: '" + cometdURL + "', logLevel: '" + getLogLevel() + "'});");
        evaluateScript("var handshakeLatch = new Latch(1);");
        Latch handshakeLatch = get("handshakeLatch");
        evaluateScript("cometd.addListener('/meta/handshake', handshakeLatch, 'countDown');");
        evaluateScript("cometd.handshake();");
        Assert.assertTrue(handshakeLatch.await(5000));

        evaluateScript("var latch1 = new Latch(1);");
        Latch latch1 = get("latch1");
        evaluateScript("cometd.subscribe('/test', dojo.hitch(latch1, 'countDown'), {});");
        evaluateScript("var latch2 = new Latch(1);");
View Full Code Here

        evaluateScript("var latch2 = new Latch(1);");
        Latch latch2 = get("latch2");
        evaluateScript("cometd.subscribe('/test', dojo.hitch(latch2, 'countDown'));");
        evaluateScript("cometd.publish('/test', {});");
        Assert.assertTrue(latch1.await(5000));
        Assert.assertTrue(latch2.await(5000));

        evaluateScript("cometd.disconnect(true);");
    }
}
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

        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));

        // Wait for the long poll to be established
        Thread.sleep(1000);

        Number inCount = get("inCount");
View Full Code Here

        evaluateScript("var publishLatch = new Latch(1);");
        Latch publishLatch = get("publishLatch");
        evaluateScript("cometd.addListener('/meta/publish', function(message) { publishLatch.countDown(); });");
        evaluateScript("cometd.publish('/echo', 'ping');");
        Assert.assertTrue(publishLatch.await(5000));

        inCount = get("inCount");
        outCount = get("outCount");
        Assert.assertEquals(2, inCount.intValue());
        Assert.assertEquals(3, outCount.intValue());
View Full Code Here

        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));

        // Wait for the long poll to be established
        // Cannot rely on latches for this, since we need to intercept the connect2
        Thread.sleep(1000);
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.