Package org.apache.openejb.resource.jdbc.dbcp

Examples of org.apache.openejb.resource.jdbc.dbcp.DbcpManagedDataSource


// TODO: remove it and replace it with org.apache.openejb.resource.jdbc.dbcp.DbcpDataSourceCreator
public class DefaultDataSourceCreator extends DbcpDataSourceCreator {
    @Override
    public DataSource managed(final String name, final CommonDataSource ds) {
        return new DbcpManagedDataSource(name, ds);
    }
View Full Code Here


        return new DbcpManagedDataSource(name, ds);
    }

    @Override
    public DataSource poolManaged(final String name, final DataSource ds, final Properties properties) {
        return build(DbcpManagedDataSource.class, new DbcpManagedDataSource(name, ds), properties);
    }
View Full Code Here

    }

    private void check(final DataSource ds, final String name) throws SQLException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        // the first "cast part" is not important, we just want to check the jdbc url is ok
        assertThat(ds, instanceOf(DbcpManagedDataSource.class));
        final DbcpManagedDataSource dbcp = (DbcpManagedDataSource) ds;
        final Connection connection = dbcp.getConnection();
        assertThat(connection, instanceOf(ManagedConnection.class));
        final ManagedConnection mc = (ManagedConnection) connection;
        final Method getInnermostDelegateInternal = DelegatingConnection.class.getDeclaredMethod("getInnermostDelegateInternal");
        getInnermostDelegateInternal.setAccessible(true);
        final Connection delegate = (Connection) getInnermostDelegateInternal.invoke(mc);
View Full Code Here

        public DataSource getDs() {
            return ds;
        }

        public void validProperties() {
            final DbcpManagedDataSource dbcp = DbcpManagedDataSource.class.cast(ds);
            assertEquals(2, dbcp.getMinIdle());
            assertTrue(dbcp.isPoolPreparedStatements());
        }
View Full Code Here

    public void checkDs() throws SQLException {
        final DataSource ds = persister.getDs();
        assertNotNull(ds);
        assertThat(ds, instanceOf(DbcpManagedDataSource.class));

        final DbcpManagedDataSource castedDs = (DbcpManagedDataSource) ds;

        final String driver = castedDs.getDriverClassName();
        assertEquals("org.h2.jdbcx.JdbcDataSource", driver);

        final String user = castedDs.getUserName();
        assertEquals("sa", user);

        final String url = castedDs.getUrl();
        assertEquals("jdbc:h2:mem:persister", url);

        final int initPoolSize = castedDs.getInitialSize();
        assertEquals(1, initPoolSize);

        final int maxIdle = castedDs.getMaxIdle();
        assertEquals(3, maxIdle);

        final Connection connection = ds.getConnection();
        assertNotNull(connection);
View Full Code Here

    public void checkDs() throws SQLException {
        final DataSource ds = persister.getDs();
        assertNotNull(ds);
        assertThat(ds, instanceOf(DbcpManagedDataSource.class));

        final DbcpManagedDataSource castedDs = (DbcpManagedDataSource) ds;

        final String driver = castedDs.getDriverClassName();
        assertNull(null, driver);

        final String user = castedDs.getUserName();
        assertEquals("sa", user);

        final String url = castedDs.getUrl();
        assertEquals("jdbc:h2:mem:persister", url);

        final int initPoolSize = castedDs.getInitialSize();
        assertEquals(1, initPoolSize);

        final int maxIdle = castedDs.getMaxIdle();
        assertEquals(3, maxIdle);

        final Connection connection = ds.getConnection();
        assertNotNull(connection);
View Full Code Here

    }

    private void check(final DataSource ds, final String name) throws SQLException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        // the first "cast part" is not important, we just want to check the jdbc url is ok
        assertThat(ds, instanceOf(DbcpManagedDataSource.class));
        final DbcpManagedDataSource dbcp = (DbcpManagedDataSource) ds;
        final Connection connection = dbcp.getConnection();
        assertThat(connection, instanceOf(ManagedConnection.class));
        final ManagedConnection mc = (ManagedConnection) connection;
        final Method getInnermostDelegateInternal = DelegatingConnection.class.getDeclaredMethod("getInnermostDelegateInternal");
        getInnermostDelegateInternal.setAccessible(true);
        final Connection delegate = (Connection) getInnermostDelegateInternal.invoke(mc);
View Full Code Here

// TODO: remove it and replace it with org.apache.openejb.resource.jdbc.dbcp.DbcpDataSourceCreator
public class DefaultDataSourceCreator extends DbcpDataSourceCreator {
    @Override
    public DataSource managed(final String name, final CommonDataSource ds) {
        return new DbcpManagedDataSource(name, ds);
    }
View Full Code Here

        return new DbcpManagedDataSource(name, ds);
    }

    @Override
    public DataSource poolManaged(final String name, final DataSource ds, final Properties properties) {
        return build(DbcpManagedDataSource.class, new DbcpManagedDataSource(name, ds), properties);
    }
View Full Code Here

        public DataSource getDs() {
            return ds;
        }

        public void validProperties() {
            final DbcpManagedDataSource dbcp = DbcpManagedDataSource.class.cast(ds);
            assertEquals(2, dbcp.getMinIdle());
            assertTrue(dbcp.isPoolPreparedStatements());
        }
View Full Code Here

TOP

Related Classes of org.apache.openejb.resource.jdbc.dbcp.DbcpManagedDataSource

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.