@BeforeMethod public void beforeMethod() { factory = new PooledConnectionFactory(); }
@Override public void start(ConnectionFactoryConfiguration config, ClassLoader classLoader) throws PersistenceException { if (!started) { sharedFactory = new PooledConnectionFactory(); sharedFactory.start(config, classLoader); started = true; } }
public JdbcStoreReader(StoreProperties props) { this.props = props; this.marshaller = SerializationConfigUtil.getMarshaller(props); this.config = JdbcConfigurationUtil.getStoreConfig(props); this.connectionFactory = new PooledConnectionFactory(); String segmentCount = props.get(Element.SEGMENT_COUNT); this.metaData = new DbMetaData(config.dialect(), config.dbMajorVersion(), config.dbMinorVersion(), false, false, // If we don't have segments then disable it segmentCount == null || Integer.parseInt(segmentCount) <= 0); this.stringConfig = config.table(); this.binaryConfig = createBinaryTableConfig(); connectionFactory.start(config.connectionFactory(), JdbcStoreReader.class.getClassLoader()); }
public void testConnectionLeakGuessDialect() throws Exception { JdbcStringBasedStoreConfigurationBuilder storeBuilder = TestCacheManagerFactory .getDefaultCacheConfiguration(false) .persistence() .addStore(JdbcStringBasedStoreConfigurationBuilder.class); UnitTestDatabaseManager.buildTableManipulation(storeBuilder.table()); PooledConnectionFactory connectionFactory = new PooledConnectionFactory(); ConnectionFactoryConfiguration config = UnitTestDatabaseManager .configureUniqueConnectionFactory(storeBuilder).create(); connectionFactory.start(config, Thread.currentThread().getContextClassLoader()); // JdbcStringBasedStoreConfiguration defaults to null dialect, so dialect and versions must be guessed TableManager tableManager = TableManagerFactory.getManager(connectionFactory, storeBuilder.create()); tableManager.setCacheName("GuessDialect"); tableManager.start(); UnitTestDatabaseManager.verifyConnectionLeaks(connectionFactory); tableManager.stop(); connectionFactory.stop(); }