@BeforeTest
  public void createConnection() throws Exception {
    JdbcStringBasedStoreConfigurationBuilder storeBuilder =
        TestCacheManagerFactory.getDefaultCacheConfiguration(false)
            .persistence()
            .addStore(JdbcStringBasedStoreConfigurationBuilder.class);
    UnitTestDatabaseManager.buildTableManipulation(storeBuilder.table(), false);
    factoryConfiguration =
        UnitTestDatabaseManager.configureUniqueConnectionFactory(storeBuilder).create();
    tableManipulation = new TableManipulation(storeBuilder.table().create());

    if (factoryConfiguration instanceof SimpleConnectionFactoryConfiguration) {
      SimpleConnectionFactoryConfiguration simpleConfiguration =
          (SimpleConnectionFactoryConfiguration) factoryConfiguration;
      connection =
          DriverManager.getConnection(
              simpleConfiguration.connectionUrl(),
              simpleConfiguration.username(),
              simpleConfiguration.password());

    } else if (factoryConfiguration instanceof PooledConnectionFactoryConfiguration) {
      PooledConnectionFactoryConfiguration pooledConfiguration =
          (PooledConnectionFactoryConfiguration) factoryConfiguration;
      connection =
          DriverManager.getConnection(
              pooledConfiguration.connectionUrl(),
              pooledConfiguration.username(),
              pooledConfiguration.password());
    }
    tableManipulation.setCacheName("aName");
  }
 @Override
 protected void configurePersistence(ConfigurationBuilder cb) {
   JdbcStringBasedStoreConfigurationBuilder storeBuilder =
       cb.persistence().addStore(JdbcStringBasedStoreConfigurationBuilder.class);
   UnitTestDatabaseManager.configureUniqueConnectionFactory(storeBuilder);
   UnitTestDatabaseManager.buildTableManipulation(storeBuilder.table(), false);
 }
  public void testConnectionLeakGuessDatabaseType() throws Exception {
    JdbcStringBasedStoreConfigurationBuilder storeBuilder =
        TestCacheManagerFactory.getDefaultCacheConfiguration(false)
            .persistence()
            .addStore(JdbcStringBasedStoreConfigurationBuilder.class);

    UnitTestDatabaseManager.buildTableManipulation(storeBuilder.table(), false);

    TableManipulation tableManipulation = new TableManipulation(storeBuilder.table().create());
    // database type must now be determined
    tableManipulation.databaseType = null;
    tableManipulation.setCacheName("GuessDatabaseType");

    PooledConnectionFactory factory = new PooledConnectionFactory();
    ConnectionFactoryConfiguration config =
        UnitTestDatabaseManager.configureUniqueConnectionFactory(storeBuilder).create();
    factory.start(config, Thread.currentThread().getContextClassLoader());
    tableManipulation.start(factory);
    tableManipulation.getUpdateRowSql();
    UnitTestDatabaseManager.verifyConnectionLeaks(factory);
    tableManipulation.stop();
    factory.stop();
  }