Package com.jolbox.bonecp.hooks

Examples of com.jolbox.bonecp.hooks.CustomHook


    reset(mockConfig);
    ConnectionPartition mockPartition = createNiceMock(ConnectionPartition.class);
    expect(mockPartition.getQueryExecuteTimeLimitinNanoSeconds()).andReturn(1L).anyTimes();
    expect(mockConnection.getOriginatingPartition()).andReturn(mockPartition).anyTimes();
//    expect(mockConfig.getQueryExecuteTimeLimit()).andReturn(1).anyTimes();
    CustomHook hook = new CustomHook();
    expect(mockConfig.getConnectionHook()).andReturn(hook).anyTimes();
    mockStatement.execute((String)EasyMock.anyObject());
    expectLastCall().andAnswer(new IAnswer<Object>() {
     
      @SuppressWarnings("unqualified-field-access")
View Full Code Here


    DataSource mockDataSourceBean = EasyMock.createNiceMock(DataSource.class);
    expect(this.mockConfig.getDatasourceBean()).andReturn(mockDataSourceBean).anyTimes();

    expect(mockConfig.getJdbcUrl()).andReturn("jdbc:mock:driver").anyTimes();
    mockConfig.setAcquireRetryDelayInMs(1);
    CustomHook testHook = new CustomHook();
    expect(mockConfig.getConnectionHook()).andReturn(testHook).anyTimes();
    // make it fail the first time and succeed the second time
    expect(this.mockPool.getDbIsDown()).andReturn(new AtomicBoolean()).anyTimes();
    expect(mockDataSourceBean.getConnection()).andThrow(new SQLException()).once().andReturn(null).once(); // a call in obtainRaw
    expect(mockConnection.getInternalConnection()).andReturn(new MockConnection()).anyTimes(); // a call in obtainRaw
View Full Code Here

TOP

Related Classes of com.jolbox.bonecp.hooks.CustomHook

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.