Search in sources :

Example 1 with PoolingProfile

use of org.mule.runtime.api.config.PoolingProfile in project mule by mulesoft.

the class PoolingConnectionManagementStrategyTestCase method exhaustion.

@Test
public void exhaustion() throws Exception {
    poolingProfile = new PoolingProfile(1, 1, DEFAULT_MAX_POOL_WAIT, WHEN_EXHAUSTED_FAIL, INITIALISE_NONE);
    initStrategy();
    ConnectionHandler<Object> connectionHandler = strategy.getConnectionHandler();
    try {
        strategy.getConnectionHandler();
        fail("Was expecting the pool to be exhausted");
    } catch (ConnectionException e) {
    // wiiiii
    }
    connectionHandler.release();
    assertThat(strategy.getConnectionHandler(), is(notNullValue()));
}
Also used : Matchers.anyObject(org.mockito.Matchers.anyObject) PoolingProfile(org.mule.runtime.api.config.PoolingProfile) ConnectionException(org.mule.runtime.api.connection.ConnectionException) Test(org.junit.Test)

Example 2 with PoolingProfile

use of org.mule.runtime.api.config.PoolingProfile in project mule by mulesoft.

the class AbstractPoolingTestCase method createDefaultPoolingProfile.

protected PoolingProfile createDefaultPoolingProfile() {
    PoolingProfile poolingProfile = new PoolingProfile();
    poolingProfile.setExhaustedAction(DEFAULT_EXHAUSTED_ACTION);
    poolingProfile.setInitialisationPolicy(DEFAULT_INITIALISATION_POLICY);
    poolingProfile.setMaxActive(MAX_ACTIVE);
    poolingProfile.setMaxIdle(MAX_IDLE);
    poolingProfile.setMaxWait(MAX_WAIT);
    return poolingProfile;
}
Also used : PoolingProfile(org.mule.runtime.api.config.PoolingProfile)

Aggregations

PoolingProfile (org.mule.runtime.api.config.PoolingProfile)2 Test (org.junit.Test)1 Matchers.anyObject (org.mockito.Matchers.anyObject)1 ConnectionException (org.mule.runtime.api.connection.ConnectionException)1