本文整理汇总了Java中org.oscm.test.db.ITestDB类的典型用法代码示例。如果您正苦于以下问题:Java ITestDB类的具体用法?Java ITestDB怎么用?Java ITestDB使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITestDB类属于org.oscm.test.db包,在下文中一共展示了ITestDB类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get
import org.oscm.test.db.ITestDB; //导入依赖的package包/类
public static ITestDB get(String unitName) {
final ITestDB db = TEST_DATASOURCES.get(unitName);
if (db == null) {
throw new AssertionError("No data source for persistence unit "
+ unitName);
}
return db;
}
示例2: getEntityManagerFactory
import org.oscm.test.db.ITestDB; //导入依赖的package包/类
public EntityManagerFactory getEntityManagerFactory(String unitName)
throws Exception {
final ITestDB testDb = TestDataSources.get(unitName, runOnProductiveDB);
if (!initializedDBs.contains(testDb) && !runOnProductiveDB) {
testDb.initialize();
initializedDBs.add(testDb);
}
EntityManagerFactory f = factoryCache.get(unitName);
if (f == null) {
f = buildEntityManagerFactory(testDb, unitName);
factoryCache.put(unitName, f);
}
return f;
}
示例3: buildEntityManagerFactory
import org.oscm.test.db.ITestDB; //导入依赖的package包/类
private EntityManagerFactory buildEntityManagerFactory(ITestDB testDb,
String unitName) throws Exception {
Map<Object, Object> properties = new HashMap<Object, Object>();
properties.put(Environment.HBM2DDL_AUTO, "");
properties.put(Environment.DATASOURCE, createManagedDataSource(testDb
.getDataSource()));
properties.put("hibernate.search.autoregister_listeners", System.getProperty("hibernate.search.autoregister_listeners"));
properties.put("hibernate.transaction.jta.platform", "org.hibernate.service.jta.platform.internal.SunOneJtaPlatform");
properties.put("hibernate.id.new_generator_mappings", "false");
properties.put("org.hibernate.SQL", "false");
EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory(unitName, properties);
sf = ((EntityManagerFactoryImpl) entityManagerFactory).getSessionFactory();
return entityManagerFactory;
}
示例4: getDataSourceByName
import org.oscm.test.db.ITestDB; //导入依赖的package包/类
public DataSource getDataSourceByName(String unitName) {
final ITestDB testDb = TestDataSources.get(unitName, runOnProductiveDB);
if (testDb != null) {
return testDb.getDataSource();
}
return null;
}