Package org.mule.tck.testmodels.mule

Examples of org.mule.tck.testmodels.mule.TestConnector


public class DispatcherPoolTestCase extends AbstractMuleTestCase
{

    public void testDefaultDispatcherPoolConfiguration() throws Exception
    {
        final TestConnector connector = createConnectorWithSingleObjectDispatcherPool(ThreadingProfile.WHEN_EXHAUSTED_RUN);

        // ThreadingProfile exhausted action default is RUN
        assertEquals(ThreadingProfile.WHEN_EXHAUSTED_RUN, connector.getDispatcherThreadingProfile()
            .getPoolExhaustedAction());
        assertEquals(2, connector.dispatchers.getMaxActive());
        // This must equal maxActive dispatchers because low maxIdle would result in
        // a lot of dispatcher churn
        assertEquals(2, connector.dispatchers.getMaxIdle());
View Full Code Here


        assertEquals(-1, connector.dispatchers.getMaxWait());
    }

    public void testDefaultDispatcherPoolConfigurationThreadingProfileWait() throws Exception
    {
        final TestConnector connector = createConnectorWithSingleObjectDispatcherPool(ThreadingProfile.WHEN_EXHAUSTED_WAIT);

        assertEquals(ThreadingProfile.WHEN_EXHAUSTED_WAIT, connector.getDispatcherThreadingProfile()
            .getPoolExhaustedAction());
        assertEquals(1, connector.dispatchers.getMaxActive());
        assertEquals(1, connector.dispatchers.getMaxIdle());
        assertEquals(GenericKeyedObjectPool.WHEN_EXHAUSTED_BLOCK,
            connector.dispatchers.getWhenExhaustedAction());
View Full Code Here

        assertEquals(-1, connector.dispatchers.getMaxWait());
    }

    public void testDispatcherPoolDefaultBlockExhaustedAction() throws Exception
    {
        final TestConnector connector = createConnectorWithSingleObjectDispatcherPool(ThreadingProfile.WHEN_EXHAUSTED_WAIT);
        connector.setDispatcherPoolMaxWait(100);

        assertEquals(1, connector.dispatchers.getMaxActive());
        assertEquals(100, connector.dispatchers.getMaxWait());

        final OutboundEndpoint endpoint = getTestOutboundEndpoint("test", "test://test");
View Full Code Here

    }

    public void testDispatcherPoolBlockTimeoutExhaustedAction() throws Exception
    {
        final TestConnector connector = createConnectorWithSingleObjectDispatcherPool(ThreadingProfile.WHEN_EXHAUSTED_WAIT);
        connector.setDispatcherPoolMaxWait(10);

        assertEquals(1, connector.dispatchers.getMaxActive());
        assertEquals(10, connector.dispatchers.getMaxWait());

        final OutboundEndpoint endpoint = getTestOutboundEndpoint("test", "test://test");
View Full Code Here

        }
    }

    public void testDispatcherPoolGrowExhaustedAction() throws Exception
    {
        final TestConnector connector = createConnectorWithSingleObjectDispatcherPool(ThreadingProfile.WHEN_EXHAUSTED_WAIT);
        connector.setDispatcherPoolWhenExhaustedAction(GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW);

        assertEquals(1, connector.dispatchers.getMaxActive());

        final OutboundEndpoint endpoint = getTestOutboundEndpoint("test", "test://test");
View Full Code Here

    }

    public void testDispatcherPoolFailExhaustedAction() throws Exception
    {
        final TestConnector connector = createConnectorWithSingleObjectDispatcherPool(ThreadingProfile.WHEN_EXHAUSTED_WAIT);
        connector.setDispatcherPoolWhenExhaustedAction(GenericKeyedObjectPool.WHEN_EXHAUSTED_FAIL);

        assertEquals(1, connector.dispatchers.getMaxActive());

        final OutboundEndpoint endpoint = getTestOutboundEndpoint("test", "test://test");
View Full Code Here

        }
    }

    private TestConnector createConnectorWithSingleObjectDispatcherPool(int exhaustedAction) throws Exception
    {
        TestConnector connector = new TestConnector(muleContext);
        ThreadingProfile threadingProfile = new ImmutableThreadingProfile(1, 1, 1, 1, 1, exhaustedAction,
            true, null, null);
        connector.setDispatcherThreadingProfile(threadingProfile);
        connector.createReceiver(getTestService(), getTestInboundEndpoint("test", "test://test"));
        muleContext.getRegistry().registerConnector(connector);
        return connector;
    }
View Full Code Here

        }
    }

    public void testConnectorURIParam() throws Exception
    {
        TestConnector tc = new TestConnector(muleContext);
        tc.setName("myTestConnector");
        muleContext.getRegistry().registerConnector(tc);

        OutboundEndpoint endpoint = createEndpoint("test://#[header:host]:#[header:port]?connectorName=myTestConnector");

        assertTrue(endpoint instanceof DynamicOutboundEndpoint);
View Full Code Here

        return getTestSession(null, context);
    }

    public static TestConnector getTestConnector(MuleContext context) throws Exception
    {
        final TestConnector testConnector = new TestConnector(context);
        testConnector.setName("testConnector");
        context.getRegistry().applyLifecycle(testConnector);
        return testConnector;
    }
View Full Code Here

{

    @Test
    public void testDefaultDispatcherPoolConfiguration() throws Exception
    {
        final TestConnector connector = createConnectorWithSingleObjectDispatcherPool(ThreadingProfile.WHEN_EXHAUSTED_RUN);

        // ThreadingProfile exhausted action default is RUN
        assertEquals(ThreadingProfile.WHEN_EXHAUSTED_RUN, connector.getDispatcherThreadingProfile()
            .getPoolExhaustedAction());
        assertEquals(2, connector.dispatchers.getMaxActive());
        // This must equal maxActive dispatchers because low maxIdle would result in
        // a lot of dispatcher churn
        assertEquals(2, connector.dispatchers.getMaxIdle());
View Full Code Here

TOP

Related Classes of org.mule.tck.testmodels.mule.TestConnector

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.