コード例 #1
0
  /** testGetManagedConnectionFactory. */
  @Test
  public void testGetManagedConnectionFactory() {
    AbstractConnectionManager connectionManager = new MockConnectionManager();
    assertNull(connectionManager.getManagedConnectionFactory());
    MockManagedConnectionFactory mcf = new MockManagedConnectionFactory();

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

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

    assertNotNull(connectionManager.getManagedConnectionFactory());
    assertEquals(mcf, connectionManager.getManagedConnectionFactory());
  }
コード例 #2
0
 /** testGetManagedConnectionFactoryIsNull. */
 @Test
 public void testGetManagedConnectionFactoryIsNull() {
   AbstractConnectionManager connectionManager = new MockConnectionManager();
   connectionManager.setPool(null);
   assertNull(connectionManager.getManagedConnectionFactory());
 }