Package org.mule.tck.testmodels.mule

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


    }

    @Test
    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


    }

    @Test
    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

    }

    @Test
    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

    }

    @Test
    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

    }

    @Test
    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

        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 testCreateEndpointByCustomizingEndpointBuilder() throws MuleException
    {
        // Create and register two connectors
        TestConnector testConnector1 = new TestConnector(muleContext);
        testConnector1.setName("testConnector1");
        TestConnector testConnector2 = new TestConnector(muleContext);
        testConnector2.setName("testConnector2");
        muleContext.getRegistry().registerConnector(testConnector1);
        muleContext.getRegistry().registerConnector(testConnector2);

        String globalEndpointName = "concreteEndpoint";
View Full Code Here

    public void testConnectorUsingDefaultDispatcherPoolFactory()
    {
        Connector connector = muleContext.getRegistry().lookupConnector("testConnectorWithDefaultFactory");

        assertTrue(connector instanceof TestConnector);
        TestConnector testConnector = (TestConnector) connector;
        assertEquals(DefaultConfigurableKeyedObjectPoolFactory.class, testConnector.getDispatcherPoolFactory().getClass());
        assertEquals(DefaultConfigurableKeyedObjectPool.class, testConnector.getDispatchers().getClass());
    }
View Full Code Here

    public void testConnectorUsingOverriddenDispatcherPoolFactory()
    {
        Connector connector = muleContext.getRegistry().lookupConnector("testConnectorWithOverriddenFactory");

        assertTrue(connector instanceof TestConnector);
        TestConnector testConnector = (TestConnector) connector;
        assertEquals(StubDispatcherPoolFactory.class, testConnector.getDispatcherPoolFactory().getClass());
        assertEquals(StubConfigurableKeyedObjectPool.class, testConnector.getDispatchers().getClass());
    }
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.