use of org.eclipse.persistence.testing.framework.TestProblemException in project eclipselink by eclipse-ee4j.
the class HibernateJPAConcurrencyComparisonModel method setupProvider.
/**
* Setup the JPA provider.
*/
@Override
public void setupProvider() {
// Configure provider to be Hibernate.
String providerClass = "org.hibernate.ejb.HibernatePersistence";
PersistenceProvider provider = null;
try {
provider = (PersistenceProvider) Class.forName(providerClass).getConstructor().newInstance();
} catch (Exception error) {
throw new TestProblemException("Failed to create persistence provider.", error);
}
Map properties = new HashMap();
// For DataSource testing.
// properties.put("jakarta.persistence.nonJtaDataSource", "datasource");
// For JSE testing.
properties.put("hibernate.connection.driver_class", getSession().getLogin().getDriverClassName());
properties.put("hibernate.connection.url", getSession().getLogin().getConnectionString());
properties.put("hibernate.connection.username", getSession().getLogin().getUserName());
properties.put("hibernate.connection.password", getSession().getLogin().getPassword());
properties.put("hibernate.connection.pool_size", "32");
/*/ For emulated connection testing.
try {
Class.forName(getSession().getLogin().getDriverClassName());
} catch (Exception ignore) {}
properties.put("hibernate.connection.driver_class", "org.eclipse.persistence.testing.tests.performance.emulateddb.EmulatedDriver");
properties.put("hibernate.connection.url", "emulate:" + getSession().getLogin().getConnectionString());
properties.put("hibernate.connection.username", getSession().getLogin().getUserName());
properties.put("hibernate.connection.password", getSession().getLogin().getPassword());
properties.put("hibernate.connection.pool_size", "32");*/
properties.put("hibernate.jdbc.batch_size", "100");
properties.put("hibernate.dialect", "org.hibernate.dialect.Oracle9Dialect");
properties.put("hibernate.cache.provider_class", "org.hibernate.cache.EhCacheProvider");
// properties.put("hibernate.cache.use_structured_entries", "true");
if (getSession().getSessionLog().getLevel() <= SessionLog.FINE) {
properties.put("hibernate.show_sql", "true");
}
getExecutor().setEntityManagerFactory(provider.createEntityManagerFactory("performance", properties));
}
use of org.eclipse.persistence.testing.framework.TestProblemException in project eclipselink by eclipse-ee4j.
the class HibernateJPAPerformanceRegressionModel method setupProvider.
/**
* Setup the JPA provider.
*/
@Override
public void setupProvider() {
// Configure provider to be Hibernate.
String providerClass = "org.hibernate.ejb.HibernatePersistence";
PersistenceProvider provider = null;
try {
provider = (PersistenceProvider) Class.forName(providerClass).getConstructor().newInstance();
} catch (Exception error) {
throw new TestProblemException("Failed to create persistence provider.", error);
}
Map properties = new HashMap();
// For DataSource testing.
// properties.put("jakarta.persistence.nonJtaDataSource", "datasource");
// For JSE testing.
properties.put("hibernate.connection.driver_class", getSession().getLogin().getDriverClassName());
properties.put("hibernate.connection.url", getSession().getLogin().getConnectionString());
properties.put("hibernate.connection.username", getSession().getLogin().getUserName());
properties.put("hibernate.connection.password", getSession().getLogin().getPassword());
properties.put("hibernate.connection.pool_size", "10");
/*/ For emulated connection testing.
try {
Class.forName(getSession().getLogin().getDriverClassName());
} catch (Exception ignore) {}
properties.put("hibernate.connection.driver_class", "org.eclipse.persistence.testing.tests.performance.emulateddb.EmulatedDriver");
properties.put("hibernate.connection.url", "emulate:" + getSession().getLogin().getConnectionString());
properties.put("hibernate.connection.username", getSession().getLogin().getUserName());
properties.put("hibernate.connection.password", getSession().getLogin().getPassword());
properties.put("hibernate.connection.pool_size", "10");*/
properties.put("hibernate.jdbc.batch_size", "100");
properties.put("hibernate.dialect", "org.hibernate.dialect.Oracle9Dialect");
properties.put("hibernate.cache.provider_class", "org.hibernate.cache.EhCacheProvider");
if (getSession().getSessionLog().getLevel() <= SessionLog.FINE) {
properties.put("hibernate.show_sql", "true");
}
getExecutor().setEntityManagerFactory(provider.createEntityManagerFactory("performance", properties));
}
use of org.eclipse.persistence.testing.framework.TestProblemException in project eclipselink by eclipse-ee4j.
the class XDBTestModel method addForcedRequiredSystems.
@Override
public void addForcedRequiredSystems() {
addForcedRequiredSystem(new XMLTypeEmployeeSystem());
oldPlatform = getSession().getPlatform();
if (!(oldPlatform instanceof OraclePlatform)) {
throw new TestProblemException("This model is intended for Oracle databases through OCI");
}
this.getSession().getLogin().setPlatform(new Oracle12Platform());
getDatabaseSession().logout();
getDatabaseSession().login();
try {
super.addForcedRequiredSystems();
} catch (Exception ex) {
String message = ex.getMessage();
if ((message != null) && (message.indexOf("invalid datatype") > 0)) {
throw new TestProblemException("This model will only work on Oracle 9i and up");
} else {
throw new TestProblemException("Error occurred", ex);
}
}
}
Aggregations