Java Code Examples for org.apache.tomcat.dbcp.dbcp.BasicDataSource#setUrl()
The following examples show how to use
org.apache.tomcat.dbcp.dbcp.BasicDataSource#setUrl() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestJdbcWrapper.java From javamelody with Apache License 2.0 | 6 votes |
/** Test. * @throws Exception e */ @Test public void testRewrapDataSource() throws Exception { final BasicDataSource tomcatDataSource = new BasicDataSource(); tomcatDataSource.setUrl(H2_DATABASE_URL); rewrapDataSource(tomcatDataSource); final org.apache.commons.dbcp.BasicDataSource dbcpDataSource = new org.apache.commons.dbcp.BasicDataSource(); dbcpDataSource.setUrl(H2_DATABASE_URL); rewrapDataSource(dbcpDataSource); final org.apache.tomcat.dbcp.dbcp2.BasicDataSource tomcat2DataSource = new org.apache.tomcat.dbcp.dbcp2.BasicDataSource(); tomcat2DataSource.setUrl(H2_DATABASE_URL); rewrapDataSource(tomcat2DataSource); final org.apache.commons.dbcp2.BasicDataSource dbcp2DataSource = new org.apache.commons.dbcp2.BasicDataSource(); dbcp2DataSource.setUrl(H2_DATABASE_URL); rewrapDataSource(dbcp2DataSource); final DataSource dataSource = createNiceMock(DataSource.class); rewrapDataSource(dataSource); }
Example 2
Source File: PersistenceConfig.java From tutorials with MIT License | 5 votes |
@Bean public DataSource restDataSource() { final BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url"))); dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); return dataSource; }
Example 3
Source File: Cause5NonTransientConfig.java From tutorials with MIT License | 5 votes |
@Bean public DataSource restDataSource() { final BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url"))); dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); return dataSource; }
Example 4
Source File: Cause4NonTransientConfig.java From tutorials with MIT License | 5 votes |
@Bean public DataSource restDataSource() { final BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url"))); dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); return dataSource; }
Example 5
Source File: Cause1NonTransientConfig.java From tutorials with MIT License | 5 votes |
@Bean public DataSource restDataSource() { final BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url"))); dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); return dataSource; }
Example 6
Source File: Cause1PersistenceConfig.java From tutorials with MIT License | 5 votes |
@Bean public DataSource restDataSource() { final BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url"))); dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); return dataSource; }
Example 7
Source File: Cause2PersistenceConfig.java From tutorials with MIT License | 5 votes |
@Bean public DataSource restDataSource() { final BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url"))); dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); return dataSource; }
Example 8
Source File: Cause3PersistenceConfig.java From tutorials with MIT License | 5 votes |
@Bean public DataSource restDataSource() { final BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName(Preconditions.checkNotNull(env.getProperty("jdbc.driverClassName"))); dataSource.setUrl(Preconditions.checkNotNull(env.getProperty("jdbc.url"))); dataSource.setUsername(Preconditions.checkNotNull(env.getProperty("jdbc.user"))); dataSource.setPassword(Preconditions.checkNotNull(env.getProperty("jdbc.pass"))); return dataSource; }
Example 9
Source File: TestJdbcWrapper.java From javamelody with Apache License 2.0 | 4 votes |
/** Test. * @throws Exception e */ @Test public void testCreateDataSourceProxy() throws Exception { // on fait le ménage au cas où TestMonitoringSpringInterceptor ait été exécuté juste avant cleanUp(); assertTrue("getBasicDataSourceProperties0", JdbcWrapper.getBasicDataSourceProperties().isEmpty()); assertEquals("getMaxConnectionCount0", -1, JdbcWrapper.getMaxConnectionCount()); final org.apache.tomcat.jdbc.pool.DataSource tomcatJdbcDataSource = new org.apache.tomcat.jdbc.pool.DataSource(); tomcatJdbcDataSource.setUrl(H2_DATABASE_URL); tomcatJdbcDataSource.setDriverClassName("org.h2.Driver"); tomcatJdbcDataSource.setMaxActive(123); final DataSource tomcatJdbcProxy = jdbcWrapper.createDataSourceProxy("test2", tomcatJdbcDataSource); assertNotNull("createDataSourceProxy1", tomcatJdbcProxy); tomcatJdbcProxy.getConnection().close(); assertFalse("getBasicDataSourceProperties1", JdbcWrapper.getBasicDataSourceProperties().isEmpty()); assertEquals("getMaxConnectionCount1", 123, JdbcWrapper.getMaxConnectionCount()); final org.apache.commons.dbcp.BasicDataSource dbcpDataSource = new org.apache.commons.dbcp.BasicDataSource(); dbcpDataSource.setUrl(H2_DATABASE_URL); dbcpDataSource.setMaxActive(456); final DataSource dbcpProxy = jdbcWrapper.createDataSourceProxy(dbcpDataSource); assertNotNull("createDataSourceProxy2", dbcpProxy); assertFalse("getBasicDataSourceProperties2", JdbcWrapper.getBasicDataSourceProperties().isEmpty()); assertEquals("getMaxConnectionCount2", 456, JdbcWrapper.getMaxConnectionCount()); final BasicDataSource tomcatDataSource = new BasicDataSource(); tomcatDataSource.setUrl(H2_DATABASE_URL); tomcatDataSource.setMaxActive(789); final DataSource tomcatProxy = jdbcWrapper.createDataSourceProxy("test", tomcatDataSource); assertNotNull("createDataSourceProxy3", tomcatProxy); assertNotNull("getLogWriter2", tomcatProxy.getLogWriter()); tomcatProxy.getConnection().close(); assertFalse("getBasicDataSourceProperties3", JdbcWrapper.getBasicDataSourceProperties().isEmpty()); assertEquals("getMaxConnectionCount3", 789, JdbcWrapper.getMaxConnectionCount()); final org.apache.commons.dbcp2.BasicDataSource dbcp2DataSource = new org.apache.commons.dbcp2.BasicDataSource(); dbcp2DataSource.setUrl(H2_DATABASE_URL); dbcp2DataSource.setMaxTotal(456); final DataSource dbcp2Proxy = jdbcWrapper.createDataSourceProxy(dbcp2DataSource); assertNotNull("createDataSourceProxy2b", dbcp2Proxy); final org.apache.tomcat.dbcp.dbcp2.BasicDataSource tomcat2DataSource = new org.apache.tomcat.dbcp.dbcp2.BasicDataSource(); tomcat2DataSource.setUrl(H2_DATABASE_URL); tomcat2DataSource.setMaxTotal(789); final DataSource tomcat2Proxy = jdbcWrapper.createDataSourceProxy("test", tomcat2DataSource); assertNotNull("createDataSourceProxy3b", tomcat2Proxy); final DataSource dataSource2 = new MyDataSource(tomcatDataSource); jdbcWrapper.createDataSourceProxy(dataSource2); }