Package org.cometd.javascript

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


                "cometd.addListener('/meta/connect', function(message) " +
                "{" +
                "   if (message.successful) readyLatch.countDown(); " +
                "});");
        evaluateScript("cometd.handshake();");
        Assert.assertTrue(readyLatch.await(5000));

        String newClientId = evaluateScript("cometd.getClientId();");
        Assert.assertEquals(clientId, newClientId);

        String transportType = evaluateScript("cometd.getTransport().getType();");
View Full Code Here


        String clientId = evaluateScript("cometd.getClientId();");

        // Stop the server
        int port = connector.getLocalPort();
        server.stop();
        Assert.assertTrue(stopLatch.await(5000));

        // Disconnect
        evaluateScript("cometd.disconnect();");

        // Restart the server
View Full Code Here

    public void testReloadWithSubscriptionAndPublish() throws Exception
    {
        defineClass(Latch.class);
        evaluateApplication();
        Latch latch = get("latch");
        Assert.assertTrue(latch.await(5000));

        // Calling reload() results in the cookie being written
        evaluateScript("cometd.reload();");

        // Reload the page
View Full Code Here

        initExtension();

        defineClass(Latch.class);
        evaluateApplication();
        latch = get("latch");
        Assert.assertTrue(latch.await(5000));

        // Check that handshake was faked
        evaluateScript("window.assert(extHandshake === null, 'extHandshake');");
        evaluateScript("window.assert(rcvHandshake !== null, 'rcvHandshake');");
        // Check that subscription went out
View Full Code Here

        evaluateScript("var readyLatch = new Latch(1);");
        Latch readyLatch = get("readyLatch");
        evaluateScript("cometd.addListener('/meta/handshake', function(message) { readyLatch.countDown(); });");
        evaluateScript("cometd.handshake();");

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

        Boolean clientSupportsAck = get("clientSupportsAck");
        Assert.assertTrue(clientSupportsAck);
        evaluateScript("cometd.unregisterExtension('test');");
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));

        Number inAckId = get("inAckId");
        // The server should have returned a non-negative value during the first connect call
        Assert.assertTrue(inAckId.intValue() >= 0);
View Full Code Here

        evaluateScript("cometd.subscribe('/echo', function(message) { ++msgCount; publishLatch.countDown(); });");
        Assert.assertTrue(subscribeLatch.await(5000));

        // The server receives an event and sends it to the client via the long poll
        ackService.emit("test acknowledgement");
        Assert.assertTrue(publishLatch.await(5000));

        inAckId = get("inAckId");
        Number outAckId = get("outAckId");
        Assert.assertTrue(inAckId.intValue() >= outAckId.intValue());
        Number msgCount = get("msgCount");
View Full Code Here

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

        // Both client and server should support timesync
        Object outTimeSync = get("outTimeSync");
        Assert.assertNotNull(outTimeSync);
        Object inTimeSync = get("inTimeSync");
View Full Code Here

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

        // Get the clientId
        String clientId = evaluateScript("cometd.getClientId();");

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

                "cometd.addListener('/meta/connect', function(message) " +
                "{ " +
                "   if (message.successful) readyLatch.countDown(); " +
                "});");
        evaluateScript("cometd.handshake();");
        Assert.assertTrue(readyLatch.await(5000));

        String newClientId = evaluateScript("cometd.getClientId();");
        Assert.assertEquals(clientId, newClientId);

        evaluateScript("cometd.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.