Package org.jacorb.test.notification

Examples of org.jacorb.test.notification.StructuredPushSender


    public void testLoad() throws Exception
    {
        final List received = new ArrayList();

        StructuredPushSender sender = new StructuredPushSender(getClientORB());

        StructuredPushReceiver receiver = new StructuredPushReceiver(getClientORB())
        {
            public void push_structured_event(StructuredEvent event)
                    throws org.omg.CosEventComm.Disconnected
            {
                try
                {
                    Thread.sleep(1000);
                } catch (InterruptedException e)
                {
                    e.printStackTrace();
                }
               
                System.out.println("Received ...");
               
                super.push_structured_event(event);
            }
        };

        System.out.println("connect sender");
        sender.connect(channel, true);
        System.out.println("connect receiver");
        receiver.connect(channel, true);

        boolean _active = active;
View Full Code Here


       
        final StructuredPushReceiver receiver = new StructuredPushReceiver(getClientORB());
       
        receiver.connect(channel_, false);

        final StructuredPushSender sender = new StructuredPushSender(getClientORB());

        sender.connect(channel_, false);
       
        while (active.get())
        {
            final StructuredEvent[] data = new StructuredEvent[1000];

            for (int x = 0; x < data.length; ++x)
            {
                data[x] = testUtils_.getStructuredEvent();
            }
           
            final CountDownLatch latch = new CountDownLatch(1);
            new Thread()
            {
                public void run()
                {
                    System.out.println("Begin to send");

                    try
                    {
                        sender.pushEvents(data);
                    } catch (Disconnected e)
                    {
                        active.set(false);
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }

                    System.out.println("Sent " + data.length);

                    latch.countDown();
                }
            }.start();

            latch.await();

            System.out.println(receiver);

            Thread.sleep(60000);

            System.out.println(receiver);           
        }
       
        sender.shutdown();
       
        receiver.shutdown();
    }
View Full Code Here

        fixedHeader.event_name = "TEST";
        fixedHeader.event_type = new EventType("TESTING", "TESTING");
        EventHeader header = new EventHeader(fixedHeader, new Property[0]);

        StructuredPushReceiver _receiver = new StructuredPushReceiver(getClientORB(), testSize);
        StructuredPushSender _sender = new StructuredPushSender(getClientORB());

        _receiver.setTimeOut(testSize * 100);

        _sender.connect(objectUnderTest_, false);
        _receiver.connect(objectUnderTest_, false);

        _receiver.start();

        for (int x = 0; x < events.length; ++x)
        {
            Any any = getClientORB().create_any();
            any.insert_long(x);
            events[x] = new StructuredEvent(header, new Property[0], any);
        }

        _sender.pushEvents(events);

        _receiver.join();

        assertTrue(_receiver.toString(), _receiver.isEventHandled());
    }
View Full Code Here

    public void XXXtestLoad() throws Exception
    {
        final List received = new ArrayList();

        StructuredPushSender sender = new StructuredPushSender(getClientORB());

        StructuredPushReceiver receiver = new StructuredPushReceiver(getClientORB())
        {
            public void push_structured_event(StructuredEvent event)
                    throws org.omg.CosEventComm.Disconnected
            {
                try
                {
                    Thread.sleep(1000);
                } catch (InterruptedException e)
                {
                    e.printStackTrace();
                }
               
                System.out.println("Received ...");
               
                super.push_structured_event(event);
            }
        };

        System.out.println("connect sender");
        sender.connect(channel, true);
        System.out.println("connect receiver");
        receiver.connect(channel, true);

        boolean _active = active;
View Full Code Here

       
        final StructuredPushReceiver receiver = new StructuredPushReceiver(getClientORB());
       
        receiver.connect(channel_, false);

        final StructuredPushSender sender = new StructuredPushSender(getClientORB());

        sender.connect(channel_, false);
       
        while (active.get())
        {
            final StructuredEvent[] data = new StructuredEvent[1000];

            for (int x = 0; x < data.length; ++x)
            {
                data[x] = testUtils_.getStructuredEvent();
            }
           
            final CountDownLatch latch = new CountDownLatch(1);
            new Thread()
            {
                public void run()
                {
                    System.out.println("Begin to send");

                    try
                    {
                        sender.pushEvents(data);
                    } catch (Disconnected e)
                    {
                        active.set(false);
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }

                    System.out.println("Sent " + data.length);

                    latch.countDown();
                }
            }.start();

            latch.await();

            System.out.println(receiver);

            Thread.sleep(60000);

            System.out.println(receiver);           
        }
       
        sender.shutdown();
       
        receiver.shutdown();
    }
View Full Code Here

        fixedHeader.event_name = "TEST";
        fixedHeader.event_type = new EventType("TESTING", "TESTING");
        EventHeader header = new EventHeader(fixedHeader, new Property[0]);

        StructuredPushReceiver _receiver = new StructuredPushReceiver(setup.getClientOrb(), testSize);
        StructuredPushSender _sender = new StructuredPushSender(setup.getClientOrb());

        _receiver.setTimeOut(testSize * 100);

        _sender.connect(objectUnderTest_, false);
        _receiver.connect(objectUnderTest_, false);

        _receiver.start();

        for (int x = 0; x < events.length; ++x)
        {
            Any any = setup.getClientOrb().create_any();
            any.insert_long(x);
            events[x] = new StructuredEvent(header, new Property[0], any);
        }

        _sender.pushEvents(events);

        _receiver.join();

        assertTrue(_receiver.toString(), _receiver.isEventHandled());
    }
View Full Code Here

        final StructuredPushReceiver receiver = new StructuredPushReceiver(setup.getClientOrb());

        receiver.connect(channel_, false);

        final StructuredPushSender sender = new StructuredPushSender(setup.getClientOrb());

        sender.connect(channel_, false);

        while (active.get())
        {
            final StructuredEvent[] data = new StructuredEvent[1000];

            for (int x = 0; x < data.length; ++x)
            {
                data[x] = testUtils_.getStructuredEvent();
            }

            final CountDownLatch latch = new CountDownLatch(1);
            new Thread()
            {
                @Override
                public void run()
                {
                    TestUtils.getLogger().debug("Begin to send");

                    try
                    {
                        sender.pushEvents(data);
                    } catch (Disconnected e)
                    {
                        active.set(false);
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }

                    TestUtils.getLogger().debug("Sent " + data.length);

                    latch.countDown();
                }
            }.start();

            latch.await();

            TestUtils.getLogger().debug(receiver.toString());

            Thread.sleep(60000);

            TestUtils.getLogger().debug(receiver.toString());
        }

        sender.shutdown();

        receiver.shutdown();
    }
View Full Code Here

    }

    @Test
    public void testLoad() throws Exception
    {
        StructuredPushSender sender = new StructuredPushSender(setup.getClientOrb());

        StructuredPushReceiver receiver = new StructuredPushReceiver(setup.getClientOrb())
        {
            @Override
            public void push_structured_event(StructuredEvent event)
                    throws org.omg.CosEventComm.Disconnected
            {
                try
                {
                    Thread.sleep(1000);
                } catch (InterruptedException e)
                {
                    e.printStackTrace();
                }

                TestUtils.getLogger().debug("Received ...");

                super.push_structured_event(event);
            }
        };

        TestUtils.getLogger().debug("connect sender");
        sender.connect(channel, true);
        TestUtils.getLogger().debug("connect receiver");
        receiver.connect(channel, true);

        boolean _active = active;
View Full Code Here

TOP

Related Classes of org.jacorb.test.notification.StructuredPushSender

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.