}
public void testNoPooling() {
Properties modifiedProperties = new Properties();
modifiedProperties.putAll(props);
SessionFactory sessionFactory1 = null;
SessionFactory sessionFactory2 = null;
// with connection.pool.size set to 1 each session factory should be the same
modifiedProperties.put(Constants.PROPERTY_CONNECTION_POOL_SIZE, 1);
sessionFactory1 = ClusterJHelper.getSessionFactory(modifiedProperties);
sessionFactory2 = ClusterJHelper.getSessionFactory(modifiedProperties);
sessionFactory1.close();
sessionFactory2.close();
errorIfNotEqual("With connection pooling, SessionFactory1 should be the same object as SessionFactory2",
true, sessionFactory1 == sessionFactory2);
// with connection.pool.size set to 0 each session factory should be unique
modifiedProperties.put(Constants.PROPERTY_CONNECTION_POOL_SIZE, 0);
sessionFactory1 = ClusterJHelper.getSessionFactory(modifiedProperties);
sessionFactory2 = ClusterJHelper.getSessionFactory(modifiedProperties);
try {
SessionFactory sessionFactory3 = ClusterJHelper.getSessionFactory(modifiedProperties);
sessionFactory3.close();
} catch (ClusterJFatalUserException ex) {
// good catch
}
sessionFactory1.close();
sessionFactory2.close();