View Javadoc

1   /*
2    * $Id: AbstractPoolingTestCase.java 22387 2011-07-12 03:53:36Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.util.pool;
12  
13  import org.mule.config.PoolingProfile;
14  import org.mule.tck.junit4.AbstractMuleContextTestCase;
15  
16  public abstract class AbstractPoolingTestCase extends AbstractMuleContextTestCase
17  {
18      protected static final int DEFAULT_EXHAUSTED_ACTION = PoolingProfile.WHEN_EXHAUSTED_FAIL;
19      protected static final int DEFAULT_INITIALISATION_POLICY = PoolingProfile.INITIALISE_NONE;
20      protected static final int MAX_ACTIVE = 3;
21      protected static final int MAX_IDLE = -1;
22      protected static final long MAX_WAIT = 1500;
23  
24      protected PoolingProfile createDefaultPoolingProfile()
25      {
26          PoolingProfile poolingProfile = new PoolingProfile();
27          poolingProfile.setExhaustedAction(DEFAULT_EXHAUSTED_ACTION);
28          poolingProfile.setInitialisationPolicy(DEFAULT_INITIALISATION_POLICY);
29          poolingProfile.setMaxActive(MAX_ACTIVE);
30          poolingProfile.setMaxIdle(MAX_IDLE);
31          poolingProfile.setMaxWait(MAX_WAIT);
32          return poolingProfile;
33      }
34  }