Package org.drools.guvnor.client.rpc

Examples of org.drools.guvnor.client.rpc.PushResponse


    public void testSimple() throws Exception {

            final Backchannel bc = new Backchannel();

        bc.push("mic", new PushResponse("m", "b"));
        bc.push("dave", new PushResponse("d", "b"));
        List<PushResponse> r = bc.await("mic");
        assertEquals(1, r.size());
        assertEquals("m", r.get(0).messageType);
        r = bc.await("dave");
        assertEquals(1, r.size());
        assertEquals("d", r.get(0).messageType);


        final boolean[] check = new boolean[1];

        Thread t = new Thread(new Runnable() {
            public void run() {
                try {
                    List<PushResponse> list = bc.await("mic");
                    /*
                    for (PushResponse resp: list) {
                                       System.err.println(resp.messageType + "," + resp.message);
                    }
                    */
                    check[0] = true;
                } catch (InterruptedException e) {
                    fail("Should not interrupt");
                }
            }
        });

        t.setDaemon(true);
        t.start();


        Thread.sleep(400);

        assertFalse(check[0]);
        bc.push("dave", new PushResponse("x", "y"));
        //bc.push("mic", new PushResponse("Q", "W"));
        t.join();



       

        check[0] = false;
        bc.push("mic", new PushResponse("R", "T"));
        bc.push("mic", new PushResponse("Q", "A"));


        final List<List<PushResponse>> container = new ArrayList();

        t = new Thread(new Runnable() {
View Full Code Here


    public void testManyConcurrent() throws Exception {
        final Backchannel bc = new Backchannel();
        for (int i =0; i < 1000; i++) {
            spinup(bc, i);
        }
        bc.push("mic", new PushResponse("yo", "yo"));
        bc.push("mic", new PushResponse("yo", "yo"));

        //for (int i=0; i< 1000; i++) {
        List<PushResponse> res = bc.await("mic");
        assertEquals(2, res.size());

        res = bc.await("mic");
        assertEquals(0, res.size());
        //assertNull(res); //as other concurrent things will be unlatching...

        Thread.sleep(20);

        for (int i = 0; i < 20000; i++) {
            bc.push("mic", new PushResponse("yo", "yo"));
            bc.push("mic", new PushResponse("yo", "yo"));

            res = bc.await("mic");
            assertEquals(2, res.size());
        }
    }
View Full Code Here

                try {
                    Thread.sleep(i / 2);
                } catch (InterruptedException e) {
                    fail("should not interrupt");
                }
                bc.push(i + "user", new PushResponse(i + "type", "message"));
            }
        });

        t.setDaemon(true);
View Full Code Here

        return repositoryAssetOperations.getAssetCount(request);
    }

    private void push(String messageType,
                      String message) {
        Backchannel.getInstance().publish(new PushResponse(messageType,
                message));
    }
View Full Code Here

        return repositoryAssetOperations.getAssetCount( request );
    }

    private void push(String messageType,
                      String message) {
        backchannel.publish( new PushResponse( messageType,
                                               message ) );
    }
View Full Code Here

    /**
     * Pushes a message back to (all) clients.
     */
    private void push(String messageType,
                      String message) {
        backchannel.publish( new PushResponse( messageType,
                                                             message ) );
    }
View Full Code Here

        return iterator;
    }

    private void push(String messageType,
            String message) {
        backchannel.publish(new PushResponse(messageType,
                message));
    }
View Full Code Here

        return iterator;
    }

    private void push(String messageType,
            String message) {
        backchannel.publish(new PushResponse(messageType,
                message));
    }
View Full Code Here

        return repositoryAssetOperations.getAssetCount( request );
    }

    private void push(String messageType,
                      String message) {
        backchannel.publish( new PushResponse( messageType,
                                               message ) );
    }
View Full Code Here

    /**
     * Pushes a message back to (all) clients.
     */
    private void push(String messageType,
                      String message) {
        backchannel.publish( new PushResponse( messageType,
                                               message ) );
    }
View Full Code Here

TOP

Related Classes of org.drools.guvnor.client.rpc.PushResponse

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.