Package org.apache.commons.dbcp

Examples of org.apache.commons.dbcp.BasicDataSource


        String dbFolder =  "target/advjdbctest";
        if ((new File(dbFolder)).exists()) {
            deleteDir(new File(dbFolder));
        }

      BasicDataSource ds = new BasicDataSource();
        ds.setDriverClassName(UserCoreTestConstants.DB_DRIVER);
        ds.setUrl(TEST_URL);

        DatabaseCreator creator = new DatabaseCreator(ds);
        creator.createRegistryDatabase();

        realm = new DefaultRealm();
View Full Code Here


        String maxActive = databaseConnectionPoolConfig.getMaxActive();
        String minIdle = databaseConnectionPoolConfig.getMinIdle();
        String maxIdle = databaseConnectionPoolConfig.getMaxIdle();
        String maxWait = databaseConnectionPoolConfig.getMaxWait();
        dataSource = new BasicDataSource();

        dataSource.setDriverClassName(databaseConnectionPoolConfig.getDriverClassName());
        dataSource.setUrl(databaseConnectionPoolConfig.getDatabaseUrl());
        dataSource.setUsername(databaseConnectionPoolConfig.getUserName());
        dataSource.setPassword(databaseConnectionPoolConfig.getPassword());
View Full Code Here

     * @param config the database configuration.
     *
     * @return the built data source.
     */
    public static DataSource buildDataSource(DataBaseConfiguration config) {
        BasicDataSource basicDataSource = new BasicDataSource();
        basicDataSource.setUrl(config.getDbUrl());
        basicDataSource.setDriverClassName(config.getDriverName());
        basicDataSource.setUsername(config.getUserName());
        basicDataSource.setPassword(config.getResolvedPassword());

        if (config.getMaxActive() != null) {
            basicDataSource.setMaxActive(Integer.parseInt(config.getMaxActive()));
        } else {
            basicDataSource.setMaxActive(DatabaseConstants.DEFAULT_MAX_ACTIVE);
        }

        if (config.getMaxWait() != null) {
            basicDataSource.setMaxWait(Integer.parseInt(config.getMaxWait()));
        } else {
            basicDataSource.setMaxWait(DatabaseConstants.DEFAULT_MAX_WAIT);
        }

        if (config.getMaxIdle() != null) {
            basicDataSource.setMaxIdle(Integer.parseInt(config.getMaxIdle()));
        }

        if (config.getMinIdle() != null) {
            basicDataSource.setMinIdle(Integer.parseInt(config.getMinIdle()));
        } else {
            basicDataSource.setMinIdle(DatabaseConstants.DEFAULT_MIN_IDLE);
        }

        if (config.getValidationQuery() != null) {
            basicDataSource.setValidationQuery(config.getValidationQuery());
        }

        return basicDataSource;
    }
View Full Code Here

                    + "Could not create the database for the user manager.";
            log.error(msg, e);
            throw new RegistryException(msg, e);
        }

        dataSource = new BasicDataSource();
        String connectionUrl = "jdbc:h2:" + derbyDBName;
        dataSource.setUrl(connectionUrl);
        dataSource.setDriverClassName("org.h2.Driver");

        try {
View Full Code Here

        this.dataSource = dataSource;
    }

    public RegistryDataSource(DataBaseConfiguration config) {

        BasicDataSource basicDataSource = new BasicDataSource();
        basicDataSource.setUrl(config.getDbUrl());
        basicDataSource.setDriverClassName(config.getDriverName());
        basicDataSource.setUsername(config.getUserName());
        basicDataSource.setPassword(config.getResolvedPassword());

        if (config.getMaxActive() != null) {
            basicDataSource.setMaxActive(Integer.parseInt(config.getMaxActive()));
        } else {
            basicDataSource.setMaxActive(DEFAULT_MAX_ACTIVE);
        }

        if (config.getMaxWait() != null) {
            basicDataSource.setMaxWait(Integer.parseInt(config.getMaxWait()));
        } else {
            basicDataSource.setMaxWait(DEFAULT_MAX_WAIT);
        }

        if (config.getMaxIdle() != null) {
            basicDataSource.setMaxIdle(Integer.parseInt(config.getMaxIdle()));
        }

        if (config.getMinIdle() != null) {
            basicDataSource.setMinIdle(Integer.parseInt(config.getMinIdle()));
        } else {
            basicDataSource.setMinIdle(DEFAULT_MIN_IDLE);
        }

        this.dataSource = basicDataSource;
    }
View Full Code Here

        String dbFolder = "target/hybridroletest";
        if ((new File(dbFolder)).exists()) {
            deleteDir(new File(dbFolder));
        }

        BasicDataSource ds = new BasicDataSource();
        ds.setDriverClassName(UserCoreTestConstants.DB_DRIVER);
        ds.setUrl("jdbc:h2:target/HybridRoleTest/CARBON_TEST");

        DatabaseCreator creator = new DatabaseCreator(ds);
        creator.createRegistryDatabase();
        // taking the tenant id = 0
     //   hybridRoleMan = new HybridRoleManager(ds, 0);
View Full Code Here

        String dbFolder = "target/hybridroletest";
        if ((new File(dbFolder)).exists()) {
            deleteDir(new File(dbFolder));
        }

        BasicDataSource ds = new BasicDataSource();
        ds.setDriverClassName(UserCoreTestConstants.DB_DRIVER);
        ds.setUrl("jdbc:h2:target/hybridroletest/UM_ADV_TEST");

        DatabaseCreator creator = new DatabaseCreator(ds);
        creator.createRegistryDatabase();
//       hybridRoleMan = new HybridRoleManager(ds, 0);
    }
View Full Code Here

        String dbFolder = "target/claimtest";
        if ((new File(dbFolder)).exists()) {
            deleteDir(new File(dbFolder));
        }

        ds = new BasicDataSource();
        ds.setDriverClassName(UserCoreTestConstants.DB_DRIVER);
        ds.setUrl("jdbc:h2:target/claimtest/CARBON_TEST");

        DatabaseCreator creator = new DatabaseCreator(ds);
        creator.createRegistryDatabase();
View Full Code Here

        String dbFolder = "target/ReadOnlyTest";
        if ((new File(dbFolder)).exists()) {
            deleteDir(new File(dbFolder));
        }

        BasicDataSource ds = new BasicDataSource();
        ds.setDriverClassName(UserCoreTestConstants.DB_DRIVER);
        ds.setUrl("jdbc:h2:target/ReadOnlyTest/CARBON_TEST");

        DatabaseCreator creator = new DatabaseCreator(ds);
        creator.createRegistryDatabase();
       
        this.addIntialData(ds);
View Full Code Here

        String dbFolder = "target/ClaimTestDatabase";
        if ((new File(dbFolder)).exists()) {
            deleteDir(new File(dbFolder));
        }

        BasicDataSource ds = new BasicDataSource();
       // ds.setDriverClassName("org.apache.derby.jdbc.EmbeddedDriver");
       // ds.setUrl("jdbc:derby:target/ClaimTestDatabase/CARBON_TEST;create=true");

        ds.setDriverClassName(UserCoreTestConstants.DB_DRIVER);
        ds.setUrl("jdbc:h2:target/ClaimTestDatabase/CARBON_TEST");
        DatabaseCreator creator = new DatabaseCreator(ds);
        creator.createRegistryDatabase();      
       
        claims = ClaimTestUtil.getClaimTestData();
        profConfigs = ClaimTestUtil.getProfileTestData();
View Full Code Here

TOP

Related Classes of org.apache.commons.dbcp.BasicDataSource

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.