Java 类org.jooq.tools.jdbc.MockConnection 实例源码

项目:droptools    文件:JooqHealthCheckTest.java   
private HealthCheck.Result runHealthCheck(MockDataProvider provider) throws Exception {
    MockConnection mockConnection = new MockConnection(provider) {
        @Override
        public Savepoint setSavepoint() throws SQLException {
            return new Savepoint() {
                @Override
                public int getSavepointId() throws SQLException {
                    return 0;
                }

                @Override
                public String getSavepointName() throws SQLException {
                    return "savepoint";
                }
            };
        }
    };

    Configuration configuration = new DefaultConfiguration().set(mockConnection);
    configuration.settings().setExecuteLogging(false);
    JooqHealthCheck healthCheck = new JooqHealthCheck(configuration, validationQuery);

    return healthCheck.check();
}
项目:club-tracker    文件:BrokerTestUtil.java   
static Connector mockConnector(MockDataProvider provider) {
    // Put your provider into a MockConnection and use that connection
    // in your application. In this case, with a jOOQ DSLContext:
    Connection connection = new MockConnection(provider);

    return new Connector() {

        @Override
        public Connection connect() throws SQLException {
            return connection;
        }

        @Override
        public SQLDialect getDialect() {
            return SQLDialect.HSQLDB;
        }

        @Override
        public Settings getSettings() {
            return new Settings();
        }
    };
}
项目:SMRTMS    文件:DBManagerTest.java   
@Before
public void init() {
    // Initialise your data provider (implementation further down):
    provider = new MyProvider();
    connection = new MockConnection(provider);

    // Pass the mock connection to a jOOQ DSLContext:
    create = DSL.using(connection, SQLDialect.MYSQL);
}