Examples of DruidDataSourceFactory


Examples of com.alibaba.druid.pool.DruidDataSourceFactory

    protected void tearDown() throws Exception {
        JdbcUtils.close(dataSource);
    }

    public void test_factory() throws Exception {
        DruidDataSourceFactory factory = new DruidDataSourceFactory();

        Reference ref = new Reference(DataSource.class.getName());
        ref.add(new StringRefAddr(DruidDataSourceFactory.PROP_REMOVEABANDONED, "true"));
        ref.add(new StringRefAddr(DruidDataSourceFactory.PROP_MAXACTIVE, "20"));

        Hashtable<String, String> env = new Hashtable<String, String>();

        dataSource = (DruidDataSource) factory.getObjectInstance(ref, null, null, env);

        Assert.assertTrue(dataSource.isRemoveAbandoned());
        Assert.assertEquals(20, dataSource.getMaxActive());
    }
View Full Code Here

Examples of com.alibaba.druid.pool.DruidDataSourceFactory

public class DruidDataSourceFactoryTest extends TestCase {

    @SuppressWarnings("serial")
    public void test_factory() throws Exception {
        DruidDataSourceFactory factory = new DruidDataSourceFactory();

        Assert.assertNull(factory.getObjectInstance(null, null, null, null));
        Assert.assertNull(factory.getObjectInstance(new Reference("javax.sql.Date"), null, null, null));

        Reference ref = new Reference("javax.sql.DataSource");
        ref.add(new RefAddr("user") {

            @Override
            public Object getContent() {
                return null;
            }

        });
        ref.add(new RefAddr("defaultReadOnly") {

            @Override
            public Object getContent() {
                return Boolean.TRUE;
            }

        });

        factory.getObjectInstance(ref, null, null, new Hashtable<Object, Object>());
    }
View Full Code Here

Examples of com.alibaba.druid.pool.DruidDataSourceFactory

import com.alibaba.druid.pool.DruidDataSourceFactory;

public class DruidDataSourceFactoryTest0 extends TestCase {

    public void test_factory_null() throws Exception {
        DruidDataSourceFactory factory = new DruidDataSourceFactory();
        Assert.assertNull(factory.getObjectInstance(null, null, null, null));
    }
View Full Code Here

Examples of com.alibaba.druid.pool.DruidDataSourceFactory

        DruidDataSourceFactory factory = new DruidDataSourceFactory();
        Assert.assertNull(factory.getObjectInstance(null, null, null, null));
    }
   
    public void test_factory_null_1() throws Exception {
        DruidDataSourceFactory factory = new DruidDataSourceFactory();
        Assert.assertNull(factory.getObjectInstance(new Object(), null, null, null));
    }
View Full Code Here

Examples of com.alibaba.druid.pool.DruidDataSourceFactory

            JdbcUtils.close(dataSource);
        }
    }

    public void test_getObjectInstance() throws Exception {
        Assert.assertNull(new DruidDataSourceFactory().getObjectInstance(null, null, null, null));
    }
View Full Code Here

Examples of com.alibaba.druid.pool.DruidDataSourceFactory

    public void test_getObjectInstance() throws Exception {
        Assert.assertNull(new DruidDataSourceFactory().getObjectInstance(null, null, null, null));
    }
   
    public void test_getObjectInstance_1() throws Exception {
        Assert.assertNull(new DruidDataSourceFactory().getObjectInstance(new Object(), null, null, null));
    }
View Full Code Here

Examples of com.alibaba.druid.support.ibatis.DruidDataSourceFactory

import com.alibaba.druid.support.ibatis.DruidDataSourceFactory;


public class DruidDataSourceFactoryTest extends TestCase {
    public void test_facttory() throws Exception {
        DruidDataSourceFactory factory = new DruidDataSourceFactory();
        Properties properties = new Properties();
        properties.setProperty("url", "jdbc:mock:xx");
        factory.initialize(properties);
        DruidDataSource dataSource = (DruidDataSource) factory.getDataSource();
        dataSource.close();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.