Package org.cometd.javascript

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


        listener.reset();
        evaluateScript("var publishLatch = new Latch(1);");
        Latch publishLatch = get("publishLatch");
        evaluateScript("cometd.addListener('/meta/publish', publishLatch, 'countDown');");
        evaluateScript("cometd.publish('/echo', 'test');");
        Assert.assertTrue(publishLatch.await(5000));
        Assert.assertTrue(messageLatch.await(5000));
        Assert.assertEquals(1, listener.getOutgoingMessageCount()); // publish
        Assert.assertEquals(2, listener.getIncomingMessageCount()); // publish, message

        listener.reset();
View Full Code Here


        listener.reset();
        evaluateScript("var unsubscribeLatch = new Latch(1);");
        Latch unsubscribeLatch = get("unsubscribeLatch");
        evaluateScript("cometd.addListener('/meta/unsubscribe', unsubscribeLatch, 'countDown');");
        evaluateScript("cometd.unsubscribe(subscription);");
        Assert.assertTrue(unsubscribeLatch.await(5000));
        Assert.assertEquals(1, listener.getOutgoingMessageCount()); // unsubscribe
        Assert.assertEquals(1, listener.getIncomingMessageCount()); // unsubscribe

        readyLatch.reset(1);
        listener.reset();
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));

        Assert.assertTrue((Boolean)get("ok"));

        evaluateScript("cometd.disconnect(true);");
        // Wait for the connect to return
View Full Code Here

                       "    return message;" +
                       "} " +
                       "});");
        readyLatch.reset(1);
        evaluateScript("cometd.handshake();");
        Assert.assertTrue(readyLatch.await(5000));

        Assert.assertTrue((Boolean)get("ok"));

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

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

        // Wait that the long poll is established before reloading
        Thread.sleep(metaConnectPeriod / 2);

        evaluateScript("cometd.reload();");
View Full Code Here

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

        // Wait that the long poll is established before reloading
        Thread.sleep(metaConnectPeriod / 2);

        evaluateScript("cometd.reload();");
View Full Code Here

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

        evaluateScript("" +
                "window.assert(ext !== undefined, 'ext must be present');" +
                "window.assert(ext.reload === true, 'ext.reload must be true');" +
                "window.assert(ext.ack === true, 'ext.ack must be true');");
View Full Code Here

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

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

        // Wait that the long poll is established before reloading
View Full Code Here

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

        // Make sure that reloading will not expire the client on the server
        Assert.assertFalse(expireLatch.await(expirationPeriod + metaConnectPeriod));

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

    @Test
View Full Code Here

                "cometd.addListener('/meta/connect', function(message) " +
                "{ " +
                "   if (message.successful) 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

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.