Example usage for org.apache.commons.dbcp.datasources PerUserPoolDataSource getDataSourceName

List of usage examples for org.apache.commons.dbcp.datasources PerUserPoolDataSource getDataSourceName

Introduction

In this page you can find the example usage for org.apache.commons.dbcp.datasources PerUserPoolDataSource getDataSourceName.

Prototype

public String getDataSourceName() 

Source Link

Document

Get the name of the ConnectionPoolDataSource which backs this pool.

Usage

From source file:org.mybatis.guice.datasource.dbcp.PerUserPoolDataSourceProviderTest.java

@Test
public void get_DataSourceName() throws Throwable {
    final String name = "test_name";
    Injector injector = Guice.createInjector(new AbstractModule() {
        @Override//  w ww. j  a  v  a  2s.c  o  m
        protected void configure() {
            bindConstant().annotatedWith(Names.named("DBCP.name")).to(name);
        }
    });
    PerUserPoolDataSourceProvider provider = injector.getInstance(PerUserPoolDataSourceProvider.class);

    PerUserPoolDataSource dataSource = (PerUserPoolDataSource) provider.get();

    assertEquals(name, dataSource.getDataSourceName());
}