use of org.hibernate.testing.BeforeClassOnce in project hibernate-orm by hibernate.
the class CorrectnessTestCase method beforeClass.
@BeforeClassOnce
public void beforeClass() {
TestResourceTracker.testStarted(getClass().getSimpleName());
Arrays.asList(new File(System.getProperty("java.io.tmpdir")).listFiles((dir, name) -> name.startsWith("family_") || name.startsWith("invalidations-"))).stream().forEach(f -> f.delete());
StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder().enableAutoClose().applySetting(Environment.USE_SECOND_LEVEL_CACHE, "true").applySetting(Environment.USE_QUERY_CACHE, "true").applySetting(Environment.DRIVER, "org.h2.Driver").applySetting(Environment.URL, "jdbc:h2:mem:" + getDbName() + ";TRACE_LEVEL_FILE=4").applySetting(Environment.DIALECT, H2Dialect.class.getName()).applySetting(Environment.HBM2DDL_AUTO, "create-drop").applySetting(Environment.CACHE_REGION_FACTORY, FailingInfinispanRegionFactory.class.getName()).applySetting(TestInfinispanRegionFactory.CACHE_MODE, cacheMode).applySetting(Environment.USE_MINIMAL_PUTS, "false").applySetting(Environment.GENERATE_STATISTICS, "false");
applySettings(ssrb);
sessionFactories = new SessionFactory[NUM_NODES];
for (int i = 0; i < NUM_NODES; ++i) {
StandardServiceRegistry registry = ssrb.build();
Metadata metadata = buildMetadata(registry);
sessionFactories[i] = metadata.buildSessionFactory();
}
}
use of org.hibernate.testing.BeforeClassOnce in project hibernate-orm by hibernate.
the class NewCustomEntityMappingAnnotationsTest method setUp.
@BeforeClassOnce
public void setUp() {
ssr = new StandardServiceRegistryBuilder().build();
metadata = new MetadataSources(ssr).addAnnotatedClass(Forest.class).addAnnotatedClass(Forest2.class).addPackage(Forest.class.getPackage().getName()).buildMetadata();
}
use of org.hibernate.testing.BeforeClassOnce in project hibernate-orm by hibernate.
the class AbstractRegionAccessStrategyTest method prepareResources.
@BeforeClassOnce
public void prepareResources() throws Exception {
TestResourceTracker.testStarted(getClass().getSimpleName());
// to mimic exactly the old code results, both environments here are exactly the same...
StandardServiceRegistryBuilder ssrb = createStandardServiceRegistryBuilder();
localEnvironment = new NodeEnvironment(ssrb);
localEnvironment.prepare();
localRegion = getRegion(localEnvironment);
localAccessStrategy = getAccessStrategy(localRegion);
transactional = Caches.isTransactionalCache(localRegion.getCache());
invalidation = Caches.isInvalidationCache(localRegion.getCache());
synchronous = Caches.isSynchronousCache(localRegion.getCache());
remoteEnvironment = new NodeEnvironment(ssrb);
remoteEnvironment.prepare();
remoteRegion = getRegion(remoteEnvironment);
remoteAccessStrategy = getAccessStrategy(remoteRegion);
waitForClusterToForm(localRegion.getCache(), remoteRegion.getCache());
}
use of org.hibernate.testing.BeforeClassOnce in project hibernate-orm by hibernate.
the class AbstractOneSessionTest method init.
@BeforeClassOnce
public void init() throws URISyntaxException {
config = new Configuration();
URL url = Thread.currentThread().getContextClassLoader().getResource(getHibernateConfigurationFileName());
config.configure(new File(url.toURI()));
String auditStrategy = getAuditStrategy();
if (auditStrategy != null && !"".equals(auditStrategy)) {
config.setProperty(EnversSettings.AUDIT_STRATEGY, auditStrategy);
}
config.setProperty(Environment.USE_NEW_ID_GENERATOR_MAPPINGS, "true");
config.setProperty(EnversSettings.USE_REVISION_ENTITY_WITH_NATIVE_ID, "false");
addProperties(config);
this.initMappings();
serviceRegistry = ServiceRegistryBuilder.buildServiceRegistry(config.getProperties());
sessionFactory = config.buildSessionFactory(serviceRegistry);
}
Aggregations