Package org.apache.felix.ipojo.extender.internal.queue.callable

Examples of org.apache.felix.ipojo.extender.internal.queue.callable.StringCallable


    }

    public void testNoEnforcement() throws Exception {
        when(m_selection.select(m_bundle)).thenReturn(Preference.DEFAULT);
        EnforcedQueueService queueService = new EnforcedQueueService(m_selection, delegate, Preference.ASYNC, m_log);
        queueService.submit(new StringCallable(m_bundle));
        verifyZeroInteractions(m_log);
    }
View Full Code Here


    }

    public void testIncompatibleEnforcement() throws Exception {
        when(m_selection.select(m_bundle)).thenReturn(Preference.SYNC);
        EnforcedQueueService queueService = new EnforcedQueueService(m_selection, delegate, Preference.ASYNC, m_log);
        queueService.submit(new StringCallable(m_bundle));

        verify(m_log).log(eq(Log.WARNING), anyString());
    }
View Full Code Here

    }

    public void testCompatibleEnforcement() throws Exception {
        when(m_selection.select(m_bundle)).thenReturn(Preference.ASYNC);
        EnforcedQueueService queueService = new EnforcedQueueService(m_selection, delegate, Preference.ASYNC, m_log);
        queueService.submit(new StringCallable(m_bundle));
        verifyZeroInteractions(m_log);
    }
View Full Code Here

    }

    public void testCall() throws Exception {
        Statistic stat = new Statistic();
        long mark = System.currentTimeMillis();
        JobInfoCallable<String> info = new JobInfoCallable<String>(m_notifier, stat, new StringCallable(), null, null);

        // Before execution
        assertTrue(info.getEnlistmentTime() >= mark);
        assertEquals(-1, info.getExecutionDuration());
        assertTrue(info.getWaitDuration() <= (System.currentTimeMillis() - mark));
View Full Code Here

        fail("Should have throw an Exception");

    }

    public void testJobInfoType() throws Exception {
        JobInfoCallable<String> info = new JobInfoCallable<String>(m_notifier, new Statistic(), new StringCallable("ipojo.testJobType", "hello"), null, null);
        assertEquals("ipojo.testJobType", info.getJobType());
    }
View Full Code Here

    public void testCallbackIsInvoked() throws Exception {
        ExecutorQueueService queueService = new ExecutorQueueService(m_bundleContext);
        queueService.start();

        Future<String> future = queueService.submit(new StringCallable(), m_callback, "hello");

        // Wait for callable to finish
        assertEquals("hello", future.get());
        verify(m_callback).success(any(JobInfo.class), eq("hello"));
        verify(m_callback, never()).error(any(JobInfo.class), any(Exception.class));
View Full Code Here

    public void testSubmitsAreSequential() throws Exception {

        SynchronousQueueService queueService = new SynchronousQueueService(m_bundleContext);

        queueService.submit(new StringCallable("one"), m_callback, null);
        queueService.submit(new StringCallable("two"), m_callback, null);

        InOrder order = inOrder(m_callback);
        order.verify(m_callback).success(infos.capture(), eq("one"));
        order.verify(m_callback).success(infos.capture(), eq("two"));
View Full Code Here

TOP

Related Classes of org.apache.felix.ipojo.extender.internal.queue.callable.StringCallable

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.