/** setAllocationRetryInMilisec. */
 @Test
 public void setAllocationRetryInMilisec() {
   AbstractConnectionManager connectionManager = new MockConnectionManager();
   assertEquals(0L, connectionManager.getAllocationRetryWaitMillis());
   connectionManager.setAllocationRetryWaitMillis(5000L);
   assertEquals(5000L, connectionManager.getAllocationRetryWaitMillis());
 }
 /** testGetCachedConnectionManager. */
 @Test
 public void testGetCachedConnectionManager() {
   AbstractConnectionManager connectionManager = new MockConnectionManager();
   assertNull(connectionManager.getCachedConnectionManager());
   connectionManager.setCachedConnectionManager(new CachedConnectionManagerImpl(null, null, null));
   assertNotNull(connectionManager.getCachedConnectionManager());
 }
 /** testAllocationRetry. */
 @Test
 public void testGetAllocationRetry() {
   AbstractConnectionManager connectionManager = new MockConnectionManager();
   assertEquals(0, connectionManager.getAllocationRetry());
   connectionManager.setAllocationRetry(5);
   assertEquals(5, connectionManager.getAllocationRetry());
 }
 /** testSecDomain. */
 @Test
 public void testSecDomain() {
   AbstractConnectionManager connectionManager = new MockConnectionManager();
   assertNull(connectionManager.getSecurityDomain());
   connectionManager.setSecurityDomain("my_domain");
   assertNotNull(connectionManager.getSecurityDomain());
   assertEquals("my_domain", connectionManager.getSecurityDomain());
 }
 /** testJndiName. */
 @Test
 public void testJndiName() {
   AbstractConnectionManager connectionManager = new MockConnectionManager();
   assertNull(connectionManager.getJndiName());
   connectionManager.setJndiName("jndi_name");
   assertNotNull(connectionManager.getJndiName());
   assertEquals("jndi_name", connectionManager.getJndiName());
 }
  /**
   * testAllocateConnectionWrongMCF.
   *
   * @throws ResourceException for exception
   */
  @Test(expected = ResourceException.class)
  public void testAllocateConnectionWrongMCF() throws ResourceException {
    AbstractConnectionManager connectionManager = new MockConnectionManager();

    PoolConfiguration pc = new PoolConfiguration();
    PoolFactory pf = new PoolFactory();

    Pool pool =
        pf.create(PoolStrategy.ONE_POOL, new MockManagedConnectionFactory(), pc, false, true);
    pool.setConnectionListenerFactory(connectionManager);

    connectionManager.setPool(pool);
    connectionManager.allocateConnection(new MockManagedConnectionFactory(), null);
  }
  /** testPoolNotNull. */
  @Test
  public void testPoolNotNull() {
    AbstractConnectionManager connectionManager = new MockConnectionManager();
    assertNull(connectionManager.getPool());

    PoolConfiguration pc = new PoolConfiguration();
    PoolFactory pf = new PoolFactory();

    Pool pool =
        pf.create(PoolStrategy.ONE_POOL, new MockManagedConnectionFactory(), pc, false, true);
    pool.setConnectionListenerFactory(connectionManager);
    connectionManager.setPool(pool);

    assertNotNull(connectionManager.getPool());
  }
  /** testSubjectFactory. */
  @Test
  public void testSubjectFactory() {
    AbstractConnectionManager connectionManager = new MockConnectionManager();
    assertNull(connectionManager.getSubjectFactory());
    SubjectFactory fact =
        new SubjectFactory() {

          public Subject createSubject() {
            return null;
          }

          public Subject createSubject(String arg0) {
            return null;
          }
        };
    connectionManager.setSubjectFactory(fact);
    assertNotNull(connectionManager.getSubjectFactory());
    assertEquals(fact, connectionManager.getSubjectFactory());
  }
 /**
  * testAllocateConnectionPoolNull.
  *
  * @throws ResourceException for exception
  */
 @Test(expected = ResourceException.class)
 public void testAllocateConnectionPoolNull() throws ResourceException {
   AbstractConnectionManager connectionManager = new MockConnectionManager();
   connectionManager.setPool(null);
   connectionManager.allocateConnection(null, null);
 }
 /**
  * testGetManagedConnectionInShutdownedManager
  *
  * @throws ResourceException for exception
  */
 @Test(expected = ResourceException.class)
 public void testGetManagedConnectionInShutdownedManager() throws ResourceException {
   AbstractConnectionManager connectionManager = new MockConnectionManager();
   connectionManager.shutdown();
   connectionManager.getManagedConnection(null, null);
 }
 /** testGetManagedConnectionFactoryIsNull. */
 @Test
 public void testGetManagedConnectionFactoryIsNull() {
   AbstractConnectionManager connectionManager = new MockConnectionManager();
   connectionManager.setPool(null);
   assertNull(connectionManager.getManagedConnectionFactory());
 }
 /** testGetTransactionManagerInstance. */
 @Test
 public void testGetTransactionManagerInstance() {
   AbstractConnectionManager connectionManager = new MockConnectionManager();
   assertNull(connectionManager.getTransactionIntegration());
 }