Package org.jacorb.notification.engine

Examples of org.jacorb.notification.engine.DefaultTaskProcessor$DeferedStartTask


    {
        controlMessageSupplier_ = MockControl.createControl(MessageSupplier.class);
        mockMessageSupplier_ = (MessageSupplier) controlMessageSupplier_.getMock();
        final DefaultTaskFactory _defaultTaskFactory = new DefaultTaskFactory(getConfiguration());
        addDisposable(_defaultTaskFactory);
        taskProcessor_ = new DefaultTaskProcessor(getConfiguration(), _defaultTaskFactory);
        addDisposable(taskProcessor_);
        objectUnderTest_ = new PullMessagesUtility(taskProcessor_ , mockMessageSupplier_);   
    }
View Full Code Here


        final Object lock = new Object();

        // TODO check if MockTaskProcessor can be used here
        final DefaultTaskFactory _defaultTaskFactory = new DefaultTaskFactory(getConfiguration());
        addDisposable(_defaultTaskFactory);
        DefaultTaskProcessor _taskProcessor = new DefaultTaskProcessor(getConfiguration(), _defaultTaskFactory)
        {
            public void processMessageInternal(Message event)
            {
                synchronized (lock)
                {
                    try
                    {
                        long _recvTime = System.currentTimeMillis();
                        assertEquals("unexpected event", event, _event);
                        assertTrue("received too late", _recvTime <= _time.getTime());
                        _received.add(event);
                    } finally
                    {
                        lock.notifyAll();
                    }
                }
            }
        };

        _taskProcessor.processMessage(_event);

        long timeoutF = System.currentTimeMillis() + timeout;
        synchronized(lock)
        {
            while (!_received.contains(_event) && System.currentTimeMillis() < timeoutF)
            {
                lock.wait(timeout);
            }
        }

        if (receive)
        {
            assertTrue("should have received something", _received.contains(_event));
        }
        else
        {
            assertTrue("shouldn't", !_received.contains(_event));
        }

        _taskProcessor.dispose();
    }
View Full Code Here

        final CountDownLatch _latch = new CountDownLatch(1);

        // TODO check if MockTaskProcessor can be used here
        final DefaultTaskFactory _defaultTaskFactory = new DefaultTaskFactory(getConfiguration());
        addDisposable(_defaultTaskFactory);
        DefaultTaskProcessor _taskProcessor = new DefaultTaskProcessor(getConfiguration(), _defaultTaskFactory)
        {
            public void processMessageInternal(Message event)
            {
                try
                {
                    long _recvTime = System.currentTimeMillis();
                    assertEquals(event, _event);
                    assertTrue(_recvTime >= _startTime.getTime());
                   
                    failed.set(false);
                } finally
                {
                    _latch.countDown();
                }
            }
        };

        _taskProcessor.processMessage(_event);

        _latch.await();

        assertFalse(failed.get());
       
        _taskProcessor.dispose();
    }
View Full Code Here

        final CountDownLatch _latch = new CountDownLatch(1);

        // TODO check if MockTaskProcessor can be used here
        final DefaultTaskFactory _defaultTaskFactory = new DefaultTaskFactory(getConfiguration());
        addDisposable(_defaultTaskFactory);
        DefaultTaskProcessor _taskProcessor = new DefaultTaskProcessor(getConfiguration(), _defaultTaskFactory)
        {
            public void processMessageInternal(Message event)
            {
                try
                {
                    long _recvTime = System.currentTimeMillis();
                    assertEquals(event, _event);
                    assertTrue(_recvTime >= _startTime.getTime());

                    failed.set(false);
                } finally
                {
                    _latch.countDown();
                }
            }
        };

        _taskProcessor.processMessage(_event);

        _latch.await();

        assertFalse(failed.get());

        _taskProcessor.dispose();
    }
View Full Code Here

        final Object lock = new Object();

        // TODO check if MockTaskProcessor can be used here
        final DefaultTaskFactory _defaultTaskFactory = new DefaultTaskFactory(getConfiguration());
        addDisposable(_defaultTaskFactory);
        DefaultTaskProcessor _taskProcessor = new DefaultTaskProcessor(getConfiguration(), _defaultTaskFactory)
        {
            public void processMessageInternal(Message event)
            {
                synchronized (lock)
                {
                    try
                    {
                        long _recvTime = System.currentTimeMillis();
                        assertEquals("unexpected event", event, _event);
                        assertTrue("received too late", _recvTime <= _time.getTime());
                        _received.add(event);
                    } finally
                    {
                        lock.notifyAll();
                    }
                }
            }
        };

        _taskProcessor.processMessage(_event);

        long timeoutF = System.currentTimeMillis() + timeout;
        synchronized(lock)
        {
            while (!_received.contains(_event) && System.currentTimeMillis() < timeoutF)
            {
                lock.wait(timeout);
            }
        }

        if (receive)
        {
            assertTrue("should have received something", _received.contains(_event));
        }
        else
        {
            assertTrue("shouldn't", !_received.contains(_event));
        }

        _taskProcessor.dispose();
    }
View Full Code Here

        final Object lock = new Object();

        // TODO check if MockTaskProcessor can be used here
        final DefaultTaskFactory _defaultTaskFactory = new DefaultTaskFactory(getConfiguration());
        addDisposable(_defaultTaskFactory);
        DefaultTaskProcessor _taskProcessor = new DefaultTaskProcessor(getConfiguration(), _defaultTaskFactory)
        {
            public void processMessageInternal(Message event)
            {
                synchronized (lock)
                {
                    try
                    {
                        long _recvTime = System.currentTimeMillis();
                        assertEquals("unexpected event", event, _event);
                        assertTrue("received too late", _recvTime <= _time.getTime());
                        _received.add(event);
                    } finally
                    {
                        lock.notifyAll();
                    }
                }
            }
        };

        _taskProcessor.processMessage(_event);

        long timeoutF = System.currentTimeMillis() + timeout;
        synchronized(lock)
        {
            while (!_received.contains(_event) && System.currentTimeMillis() < timeoutF)
            {
                lock.wait(timeout);
            }
        }

        if (receive)
        {
            assertTrue("should have received something", _received.contains(_event));
        }
        else
        {
            assertTrue("shouldn't", !_received.contains(_event));
        }

        _taskProcessor.dispose();
    }
View Full Code Here

    {
        controlMessageSupplier_ = MockControl.createControl(MessageSupplier.class);
        mockMessageSupplier_ = (MessageSupplier) controlMessageSupplier_.getMock();
        final DefaultTaskFactory _defaultTaskFactory = new DefaultTaskFactory(getConfiguration());
        addDisposable(_defaultTaskFactory);
        taskProcessor_ = new DefaultTaskProcessor(getConfiguration(), _defaultTaskFactory);
        addDisposable(taskProcessor_);
        objectUnderTest_ = new PullMessagesUtility(taskProcessor_ , mockMessageSupplier_);   
    }
View Full Code Here

        final CountDownLatch _latch = new CountDownLatch(1);

        // TODO check if MockTaskProcessor can be used here
        final DefaultTaskFactory _defaultTaskFactory = new DefaultTaskFactory(getConfiguration());
        addDisposable(_defaultTaskFactory);
        DefaultTaskProcessor _taskProcessor = new DefaultTaskProcessor(getConfiguration(), _defaultTaskFactory)
        {
            public void processMessageInternal(Message event)
            {
                try
                {
                    long _recvTime = System.currentTimeMillis();
                    assertEquals(event, _event);
                    assertTrue(_recvTime >= _startTime.getTime());

                    failed.set(false);
                } finally
                {
                    _latch.countDown();
                }
            }
        };

        _taskProcessor.processMessage(_event);

        _latch.await();

        assertFalse(failed.get());

        _taskProcessor.dispose();
    }
View Full Code Here

TOP

Related Classes of org.jacorb.notification.engine.DefaultTaskProcessor$DeferedStartTask

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.