コード例 #1
0
 /** setAllocationRetryInMilisec. */
 @Test
 public void setAllocationRetryInMilisec() {
   AbstractConnectionManager connectionManager = new MockConnectionManager();
   assertEquals(0L, connectionManager.getAllocationRetryWaitMillis());
   connectionManager.setAllocationRetryWaitMillis(5000L);
   assertEquals(5000L, connectionManager.getAllocationRetryWaitMillis());
 }
コード例 #2
0
 /** testGetCachedConnectionManager. */
 @Test
 public void testGetCachedConnectionManager() {
   AbstractConnectionManager connectionManager = new MockConnectionManager();
   assertNull(connectionManager.getCachedConnectionManager());
   connectionManager.setCachedConnectionManager(new CachedConnectionManagerImpl(null, null, null));
   assertNotNull(connectionManager.getCachedConnectionManager());
 }
コード例 #3
0
 /** testAllocationRetry. */
 @Test
 public void testGetAllocationRetry() {
   AbstractConnectionManager connectionManager = new MockConnectionManager();
   assertEquals(0, connectionManager.getAllocationRetry());
   connectionManager.setAllocationRetry(5);
   assertEquals(5, connectionManager.getAllocationRetry());
 }
コード例 #4
0
 /** testSecDomain. */
 @Test
 public void testSecDomain() {
   AbstractConnectionManager connectionManager = new MockConnectionManager();
   assertNull(connectionManager.getSecurityDomain());
   connectionManager.setSecurityDomain("my_domain");
   assertNotNull(connectionManager.getSecurityDomain());
   assertEquals("my_domain", connectionManager.getSecurityDomain());
 }
コード例 #5
0
 /** testJndiName. */
 @Test
 public void testJndiName() {
   AbstractConnectionManager connectionManager = new MockConnectionManager();
   assertNull(connectionManager.getJndiName());
   connectionManager.setJndiName("jndi_name");
   assertNotNull(connectionManager.getJndiName());
   assertEquals("jndi_name", connectionManager.getJndiName());
 }
コード例 #6
0
  /**
   * 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);
  }
コード例 #7
0
  /** 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());
  }
コード例 #8
0
  /** 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());
  }
コード例 #9
0
 /**
  * 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);
 }
コード例 #10
0
 /**
  * testGetManagedConnectionInShutdownedManager
  *
  * @throws ResourceException for exception
  */
 @Test(expected = ResourceException.class)
 public void testGetManagedConnectionInShutdownedManager() throws ResourceException {
   AbstractConnectionManager connectionManager = new MockConnectionManager();
   connectionManager.shutdown();
   connectionManager.getManagedConnection(null, null);
 }
コード例 #11
0
 /** testGetManagedConnectionFactoryIsNull. */
 @Test
 public void testGetManagedConnectionFactoryIsNull() {
   AbstractConnectionManager connectionManager = new MockConnectionManager();
   connectionManager.setPool(null);
   assertNull(connectionManager.getManagedConnectionFactory());
 }
コード例 #12
0
 /** testGetTransactionManagerInstance. */
 @Test
 public void testGetTransactionManagerInstance() {
   AbstractConnectionManager connectionManager = new MockConnectionManager();
   assertNull(connectionManager.getTransactionIntegration());
 }