• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java DatabaseModule类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.unitils.database.DatabaseModule的典型用法代码示例。如果您正苦于以下问题:Java DatabaseModule类的具体用法?Java DatabaseModule怎么用?Java DatabaseModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

DatabaseModule类属于org.unitils.database包,在下文中一共展示了DatabaseModule类的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setUp

点赞 3

import org.unitils.database.DatabaseModule; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    schemas = new ArrayList<String>();
    schemas.add("PUBLIC");
    configuration = new ConfigurationLoader().loadConfiguration();
    configuration.setProperty("org.unitils.dbmaintainer.script.ScriptSource.implClassName", "org.unitils.dbmaintainer.script.impl.DefaultScriptSource");
    this.disabled = !"hsqldb".equals(PropertyUtils.getString(PROPKEY_DATABASE_DIALECT, configuration));
    if (disabled) {
        return;
    }
    scriptsLocation2 = new File(System.getProperty("java.io.tmpdir") + "/dbmaintain-integrationtest/scripts2");
    scriptsLocation1 = new File(System.getProperty("java.io.tmpdir") + "/dbmaintain-integrationtest/scripts1");

    logger.info("temp dir created as script location1 : " + scriptsLocation1);        
    logger.info("temp dir created as script location2 : " + scriptsLocation2);        
    
    configuration.put(PROPERTY_AUTO_CREATE_EXECUTED_SCRIPTS_TABLE, "true");
    configuration.put(PROPKEY_SCRIPT_LOCATIONS, scriptsLocation1.getAbsolutePath());
    configuration.put(PROPKEY_GENERATE_DATA_SET_STRUCTURE_ENABLED, "false");
    DatabaseModule databaseModule = Unitils.getInstance().getModulesRepository().getModuleOfType(DatabaseModule.class);
    dataSource = databaseModule.getWrapper("").getTransactionalDataSourceAndActivateTransactionIfNeeded(this);
    
    dbSupport = DbSupportFactory.getDefaultDbSupport(configuration, new DefaultSQLHandler(dataSource), dialect, schemas.get(0));
    clearScriptsDirectory();
    clearTestDatabase();
}
 

开发者ID:linux-china,
项目名称:unitils,
代码行数:27,
代码来源:DbMaintainerIntegrationTest.java

示例2: initDatabaseModule

点赞 3

import org.unitils.database.DatabaseModule; //导入依赖的package包/类
private void initDatabaseModule(Properties configuration) {
    configuration.setProperty("dbMaintainer.autoCreateExecutedScriptsTable", "false");
    configuration.setProperty("dbMaintainer.autoCreateDbMaintainScriptsTable", "false");
    configuration.setProperty("updateDataBaseSchema.enabled", "false");
    configuration.setProperty("dbMaintainer.fromScratch.enabled", "false");
    
    configuration.setProperty("dbMaintainer.updateSequences.enabled", "true");
    configuration.setProperty("dbMaintainer.keepRetryingAfterError.enabled","true");
    configuration.setProperty("org.unitils.dbmaintainer.script.ScriptSource.implClassName", "org.unitils.dbmaintainer.script.impl.DefaultScriptSource");
    //configuration.setProperty("database.schemaNames", "");
    
    dialect = PropertyUtils.getString("database.dialect", configuration);
    
    DatabaseModule databaseModule = Unitils.getInstance().getModulesRepository().getModuleOfType(DatabaseModule.class);
    databaseModule.init(configuration);
    databaseModule.afterInit();
    dataSource = databaseModule.getWrapper("").getTransactionalDataSourceAndActivateTransactionIfNeeded(this);
}
 

开发者ID:linux-china,
项目名称:unitils,
代码行数:19,
代码来源:DbSupportTest.java

示例3: initDatabaseModule

点赞 3

import org.unitils.database.DatabaseModule; //导入依赖的package包/类
private Properties initDatabaseModule() {
    Properties configuration = (Properties) new ConfigurationLoader().loadConfiguration().clone();
    configuration.setProperty("dbMaintainer.autoCreateExecutedScriptsTable", "false");
    configuration.setProperty("dbMaintainer.autoCreateDbMaintainScriptsTable", "false");
    configuration.setProperty("updateDataBaseSchema.enabled", "false");
    configuration.setProperty("database.userName", "sa");
    configuration.setProperty("database.password", "");
    configuration.setProperty("database.schemaNames", "public");
    configuration.setProperty("database.driverClassName", "org.h2.Driver");
    configuration.setProperty("database.url", "jdbc:h2:~/test");
    configuration.setProperty("database.dialect", "h2");
    DatabaseModule databaseModule = Unitils.getInstance().getModulesRepository().getModuleOfType(DatabaseModule.class);
    databaseModule.init(configuration);
    databaseModule.afterInit();
    
    dataSource = databaseModule.getWrapper("").getTransactionalDataSourceAndActivateTransactionIfNeeded(this);
    return configuration;
}
 

开发者ID:linux-china,
项目名称:unitils,
代码行数:19,
代码来源:ReflectionComparatorHibernateProxyTest.java

示例4: getDataSourceFromUnitils

点赞 2

import org.unitils.database.DatabaseModule; //导入依赖的package包/类
/**
 * Returns the {@link DataSource} fetched from the unitils {@link DatabaseModule}
 *
 * @return DataSource
 */
private static DataSource getDataSourceFromUnitils(String databaseName) {
    Unitils unitils = Unitils.getInstance();
    DataSourceWrapper wrapper = unitils.getModulesRepository().getModuleOfType(DatabaseModule.class).getWrapper(databaseName);
    DataSource dataSource = wrapper.getTransactionalDataSourceAndActivateTransactionIfNeeded(unitils.getTestContext().getTestObject());
    return dataSource;
}
 

开发者ID:linux-china,
项目名称:unitils,
代码行数:12,
代码来源:SqlAssert.java

示例5: beforeClass

点赞 2

import org.unitils.database.DatabaseModule; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws FileNotFoundException, IOException {
    Properties config = getCorrectProperties();
    
    DatabaseModule databaseModule = Unitils.getInstance().getModulesRepository().getModuleOfType(DatabaseModule.class);
    databaseModule.init(config);
    databaseModule.afterInit();
    DbUnitModule dbunitModule = Unitils.getInstance().getModulesRepository().getModuleOfType(DbUnitModule.class);
    dbunitModule.init(config);
    dbunitModule.afterInit();
}
 

开发者ID:linux-china,
项目名称:unitils,
代码行数:12,
代码来源:EmptyTablesTest2.java

示例6: beforeClass

点赞 2

import org.unitils.database.DatabaseModule; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws FileNotFoundException, IOException {
    Properties config = getCorrectProperties();

    DatabaseModule databaseModule = Unitils.getInstance().getModulesRepository().getModuleOfType(DatabaseModule.class);
    databaseModule.init(config);
    databaseModule.afterInit();
    DbUnitModule dbunitModule = Unitils.getInstance().getModulesRepository().getModuleOfType(DbUnitModule.class);
    dbunitModule.init(config);
    dbunitModule.afterInit();

   // SQLUnitils.executeUpdate("CREATE TABLE PERSON (PERSONID INT NOT NULL, PERSONNAME VARCHAR(20));", databaseModule.getWrapper(DATABASE2).getDataSource());
}
 

开发者ID:linux-china,
项目名称:unitils,
代码行数:14,
代码来源:MultiDatabaseIntTest.java

示例7: beforeClass

点赞 2

import org.unitils.database.DatabaseModule; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() {
    Properties prop = getCorrectProperties();
    ModulesRepository modulesRepository = Unitils.getInstance().getModulesRepository();
    DatabaseModule databaseModule = modulesRepository.getModuleOfType(DatabaseModule.class);
    databaseModule.init(prop);
    databaseModule.afterInit();
    DbUnitModule dbunitModule = modulesRepository.getModuleOfType(DbUnitModule.class);
    dbunitModule.init(prop);
    dbunitModule.afterInit();
    DataSource dataSource2 = databaseModule.getWrapper("").getDataSource();
    
    SQLUnitils.executeUpdate("CREATE TABLE fruit (id varchar(50), name varchar(50))", dataSource2);
}
 

开发者ID:linux-china,
项目名称:unitils,
代码行数:15,
代码来源:ExpectedDataSetDifferentColumnsTest.java

示例8: afterClass

点赞 2

import org.unitils.database.DatabaseModule; //导入依赖的package包/类
@AfterClass
public static void afterClass() {
    DataSource dataSource2 = Unitils.getInstance().getModulesRepository().getModuleOfType(DatabaseModule.class).getWrapper("").getDataSource();
    SQLUnitils.executeUpdate("DROP TABLE fruit", dataSource2);
    
    Unitils.getInstance().initSingletonInstance();
}
 

开发者ID:linux-china,
项目名称:unitils,
代码行数:8,
代码来源:ExpectedDataSetDifferentColumnsTest.java

示例9: beforeClass

点赞 2

import org.unitils.database.DatabaseModule; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() {
    DatabaseModule databaseModule = Unitils.getInstance().getModulesRepository().getModuleOfType(DatabaseModule.class);
    Properties config = getCorrectProperties();
    databaseModule.init(config );
    databaseModule.afterInit();
    DbUnitModule dbunitModule = Unitils.getInstance().getModulesRepository().getModuleOfType(DbUnitModule.class);
    dbunitModule.init(config);
    dbunitModule.afterInit();
}
 

开发者ID:linux-china,
项目名称:unitils,
代码行数:11,
代码来源:EmptyTableTest.java

示例10: initDatabaseModule

点赞 2

import org.unitils.database.DatabaseModule; //导入依赖的package包/类
private void initDatabaseModule(Properties configuration) {
    dialect = PropertyUtils.getString("database.dialect", configuration);
    configuration.setProperty("dbMaintainer.autoCreateExecutedScriptsTable", "false");
    configuration.setProperty("dbMaintainer.autoCreateDbMaintainScriptsTable", "false");
    configuration.setProperty("updateDataBaseSchema.enabled", "false");
    configuration.setProperty("dbMaintainer.autoCreateExecutedScriptsTable", "false");

    DatabaseModule databaseModule = Unitils.getInstance().getModulesRepository().getModuleOfType(DatabaseModule.class);
    databaseModule.init(configuration);
    databaseModule.afterInit();
    dataSource = databaseModule.getWrapper("").getTransactionalDataSourceAndActivateTransactionIfNeeded(this);
}
 

开发者ID:linux-china,
项目名称:unitils,
代码行数:13,
代码来源:DtdDataSetStructureGeneratorTest.java

示例11: initDatabaseModule

点赞 2

import org.unitils.database.DatabaseModule; //导入依赖的package包/类
private void initDatabaseModule(Properties configuration) {
    configuration.setProperty("dbMaintainer.autoCreateExecutedScriptsTable", "false");
       configuration.setProperty("dbMaintainer.autoCreateDbMaintainScriptsTable", "false");
       configuration.setProperty("updateDataBaseSchema.enabled", "false");
       configuration.setProperty("dbMaintainer.autoCreateExecutedScriptsTable", "false");
       configuration.setProperty("dataSetStructureGenerator.xsd.dirName", "");
       
       DatabaseModule databaseModule = Unitils.getInstance().getModulesRepository().getModuleOfType(DatabaseModule.class);
       databaseModule.init(configuration);
       databaseModule.afterInit();
       dataSource = databaseModule.getWrapper("").getTransactionalDataSourceAndActivateTransactionIfNeeded(this);
}
 

开发者ID:linux-china,
项目名称:unitils,
代码行数:13,
代码来源:DefaultDBClearerMultiSchemaPreserveTest.java

示例12: initDatabaseModule

点赞 2

import org.unitils.database.DatabaseModule; //导入依赖的package包/类
private void initDatabaseModule(Properties configuration) {
    dialect = PropertyUtils.getString("database.dialect", configuration);
    configuration.setProperty("dbMaintainer.autoCreateExecutedScriptsTable", "false");
    configuration.setProperty("dbMaintainer.autoCreateDbMaintainScriptsTable", "false");
    configuration.setProperty("updateDataBaseSchema.enabled", "false");
   
    DatabaseModule databaseModule = Unitils.getInstance().getModulesRepository().getModuleOfType(DatabaseModule.class);
    databaseModule.init(configuration);
    databaseModule.afterInit();
    
    
    DataSourceWrapper wrapper = databaseModule.getWrapper("");
    databaseModule.setWrapper(wrapper);
    dataSource = wrapper.getTransactionalDataSourceAndActivateTransactionIfNeeded(this);
}
 

开发者ID:linux-china,
项目名称:unitils,
代码行数:16,
代码来源:DefaultDBClearerPreserveTest.java

示例13: testGetModuleOfType_noneFound

点赞 2

import org.unitils.database.DatabaseModule; //导入依赖的package包/类
/**
 * Tests getting the first module of type DatabaseModule, but none found.
 */
@Test
public void testGetModuleOfType_noneFound() {
	try {
		modulesRepository.getModuleOfType(DatabaseModule.class);
		fail("A UnitilsException should have been thrown");
	} catch (UnitilsException e) {
		// Expected
	}
}
 

开发者ID:linux-china,
项目名称:unitils,
代码行数:13,
代码来源:ModulesRepositoryTest.java

示例14: testLoadItemAssocByUniqueKeyEmptyDB

点赞 2

import org.unitils.database.DatabaseModule; //导入依赖的package包/类
@Test
public void testLoadItemAssocByUniqueKeyEmptyDB() {
    Unitils.getInstance().getModulesRepository().getModuleOfType(DatabaseModule.class).cleanSchemas();

    ItemAssocVO<Integer,Integer> queryAssoc = new ItemAssocVO<Integer,Integer>(
            1, new ItemVO<Integer, Integer>(1, 1, 1), 1, null,
            new ItemVO<Integer, Integer>(1, 2, 1), 1, "abc", 1, null);
    ItemAssocVO<Integer,Integer> resultAssoc = itemAssocDAO
            .loadItemAssocByUniqueKey(queryAssoc);
    assertNull(resultAssoc);
}
 

开发者ID:major2015,
项目名称:easyrec_major,
代码行数:12,
代码来源:ItemAssocDAOTest.java

示例15: testLoadItemAssocByPrimaryKeyEmptyDB

点赞 2

import org.unitils.database.DatabaseModule; //导入依赖的package包/类
@Test
public void testLoadItemAssocByPrimaryKeyEmptyDB() {
    Unitils.getInstance().getModulesRepository().getModuleOfType(DatabaseModule.class).cleanSchemas();

    ItemAssocVO<Integer,Integer> resultAssoc = itemAssocDAO
            .loadItemAssocByPrimaryKey(1l);
    assertNull(resultAssoc);
}
 

开发者ID:major2015,
项目名称:easyrec_major,
代码行数:9,
代码来源:ItemAssocDAOTest.java

示例16: testGetItemAssocIteratorEmptyDB

点赞 2

import org.unitils.database.DatabaseModule; //导入依赖的package包/类
@Test
public void testGetItemAssocIteratorEmptyDB() {
    Unitils.getInstance().getModulesRepository().getModuleOfType(DatabaseModule.class).cleanSchemas();

    Iterator<ItemAssocVO<Integer,Integer>> itemAssocs = itemAssocDAO
            .getItemAssocIterator(5000);
    assertFalse(itemAssocs.hasNext());
}
 

开发者ID:major2015,
项目名称:easyrec_major,
代码行数:9,
代码来源:ItemAssocDAOTest.java

示例17: testGetItemsFromEmptyDB

点赞 2

import org.unitils.database.DatabaseModule; //导入依赖的package包/类
@Test
public void testGetItemsFromEmptyDB() {
    Unitils.getInstance().getModulesRepository().getModuleOfType(DatabaseModule.class).cleanSchemas();

    List<AssociatedItemVO<Integer, Integer>> associatedItems = itemAssocDAO
            .getItemsFrom(1, 1, new ItemVO<Integer, Integer>(1, 1, 1),
                    new IAConstraintVO<Integer, Integer>(500));
    assertTrue(associatedItems.isEmpty());
    assertEquals(0, associatedItems.size());
}
 

开发者ID:major2015,
项目名称:easyrec_major,
代码行数:11,
代码来源:ItemAssocDAOTest.java

示例18: testGetItemsToEmptyDB

点赞 2

import org.unitils.database.DatabaseModule; //导入依赖的package包/类
@Test
public void testGetItemsToEmptyDB() {
    Unitils.getInstance().getModulesRepository().getModuleOfType(DatabaseModule.class).cleanSchemas();

    List<AssociatedItemVO<Integer, Integer>> associatedItems = itemAssocDAO
            .getItemsTo(new ItemVO<Integer, Integer>(1, 1, 1), 1, 1,
                    new IAConstraintVO<Integer, Integer>(500));
    assertTrue(associatedItems.isEmpty());
    assertEquals(0, associatedItems.size());
}
 

开发者ID:major2015,
项目名称:easyrec_major,
代码行数:11,
代码来源:ItemAssocDAOTest.java

示例19: testGetItemAssocsEmptyDB

点赞 2

import org.unitils.database.DatabaseModule; //导入依赖的package包/类
@Test
public void testGetItemAssocsEmptyDB() {
    Unitils.getInstance().getModulesRepository().getModuleOfType(DatabaseModule.class).cleanSchemas();

    List<ItemAssocVO<Integer,Integer>> itemAssocs = itemAssocDAO
            .getItemAssocs(new ItemVO<Integer, Integer>(1, 1, 1), 1,
                    new ItemVO<Integer, Integer>(1, 2, 1),
                    new IAConstraintVO<Integer, Integer>(500));
    assertTrue(itemAssocs.isEmpty());
    assertEquals(0, itemAssocs.size());
}
 

开发者ID:major2015,
项目名称:easyrec_major,
代码行数:12,
代码来源:ItemAssocDAOTest.java

示例20: testGetTenantByIdEmptyDB

点赞 2

import org.unitils.database.DatabaseModule; //导入依赖的package包/类
@Test
public void testGetTenantByIdEmptyDB() {
    Unitils.getInstance().getModulesRepository().getModuleOfType(DatabaseModule.class).cleanSchemas();

    TenantVO resultAssoc = tenantDAO.getTenantById(0);
    assertNull(resultAssoc);
}
 

开发者ID:major2015,
项目名称:easyrec_major,
代码行数:8,
代码来源:TenantDAOTest.java

示例21: testGetTenantByStringIdEmptyDB

点赞 2

import org.unitils.database.DatabaseModule; //导入依赖的package包/类
@Test
public void testGetTenantByStringIdEmptyDB() {
    Unitils.getInstance().getModulesRepository().getModuleOfType(DatabaseModule.class).cleanSchemas();

    TenantVO resultAssoc = tenantDAO.getTenantByStringId("TEST");
    assertNull(resultAssoc);
}
 

开发者ID:major2015,
项目名称:easyrec_major,
代码行数:8,
代码来源:TenantDAOTest.java

示例22: testLoadItemAssocByPrimaryKeyEmptyDB

点赞 2

import org.unitils.database.DatabaseModule; //导入依赖的package包/类
@Test
public void testLoadItemAssocByPrimaryKeyEmptyDB() {
    Unitils.getInstance().getModulesRepository().getModuleOfType(DatabaseModule.class).cleanSchemas();

    ItemAssocVO<Integer,Integer> resultAssoc = itemAssocDAO
            .loadItemAssocByPrimaryKey(1);
    assertNull(resultAssoc);
}
 

开发者ID:customertimes,
项目名称:easyrec-PoC,
代码行数:9,
代码来源:ItemAssocDAOTest.java

示例23: getDatabaseModule

点赞 2

import org.unitils.database.DatabaseModule; //导入依赖的package包/类
protected DatabaseModule getDatabaseModule() {
    return Unitils.getInstance().getModulesRepository().getModuleOfType(DatabaseModule.class);
}
 

开发者ID:linux-china,
项目名称:unitils,
代码行数:4,
代码来源:JpaEntityManagerFactoryLoader.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)