当前位置: 首页>>代码示例>>Java>>正文


Java ITestDB类代码示例

本文整理汇总了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;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:9,代码来源:TestDataSources.java

示例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;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:16,代码来源:TestPersistence.java

示例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;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:15,代码来源:TestPersistence.java

示例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;
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:8,代码来源:TestPersistence.java


注:本文中的org.oscm.test.db.ITestDB类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。