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