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


Java ClearDatabaseLifecycle.start方法代码示例

本文整理汇总了Java中org.kuali.rice.test.ClearDatabaseLifecycle.start方法的典型用法代码示例。如果您正苦于以下问题:Java ClearDatabaseLifecycle.start方法的具体用法?Java ClearDatabaseLifecycle.start怎么用?Java ClearDatabaseLifecycle.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kuali.rice.test.ClearDatabaseLifecycle的用法示例。


在下文中一共展示了ClearDatabaseLifecycle.start方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resetDb

import org.kuali.rice.test.ClearDatabaseLifecycle; //导入方法依赖的package包/类
protected void resetDb() throws Exception {
    // cleanup database from previous @PerSuiteUnitTestData
    ClearDatabaseLifecycle clearDatabaseLifeCycle = new ClearDatabaseLifecycle();
    clearDatabaseLifeCycle.start();

    // Re-Loads Suite Test Data - Needed after adhoc cleanout
    BaseLifecycle baseLifecycle = new BaseLifecycle() {
        @Override
        public void start() throws Exception {
            loadSuiteTestData();
            super.start();
        }
    };
    baseLifecycle.start();
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:16,代码来源:AnnotationTestParent.java

示例2: assertExport

import org.kuali.rice.test.ClearDatabaseLifecycle; //导入方法依赖的package包/类
/**
 * Note that the assertion here will fail if you have multiple rules with the same description.
 */
protected void assertExport() throws Exception {
    // export all existing rules and their dependencies (document types, rule templates, rule attributes)
    List oldRules = KEWServiceLocator.getRuleService().fetchAllRules(true);
    assertAllRulesHaveUniqueNames(oldRules);
    List oldRuleDelegations = KEWServiceLocator.getRuleDelegationService().findAllCurrentRuleDelegations();
    assertAllRuleDelegationsHaveUniqueNames(oldRuleDelegations);

    KewExportDataSet dataSet = new KewExportDataSet();
    dataSet.getRules().addAll(oldRules);
    dataSet.getRuleDelegations().addAll(oldRuleDelegations);
    dataSet.getDocumentTypes().addAll(KEWServiceLocator.getDocumentTypeService().findAllCurrent());
    dataSet.getRuleTemplates().addAll(KEWServiceLocator.getRuleTemplateService().findAll());
    dataSet.getRuleAttributes().addAll(KEWServiceLocator.getRuleAttributeService().findAll());
    byte[] xmlBytes = CoreApiServiceLocator.getXmlExporterService().export(dataSet.createExportDataSet());
    assertTrue("XML should be non empty.", xmlBytes != null && xmlBytes.length > 0);
    
    // now clear the tables
    ClearDatabaseLifecycle clearLifeCycle = new ClearDatabaseLifecycle();
    clearLifeCycle.getTablesToClear().add("KREW_RULE_T");
    clearLifeCycle.getTablesToClear().add("KREW_RULE_RSP_T");
    clearLifeCycle.getTablesToClear().add("KREW_DLGN_RSP_T");
    clearLifeCycle.getTablesToClear().add("KREW_RULE_ATTR_T");
    clearLifeCycle.getTablesToClear().add("KREW_RULE_TMPL_T");
    clearLifeCycle.getTablesToClear().add("KREW_DOC_TYP_T");
    clearLifeCycle.start();
    new ClearCacheLifecycle().stop();

    // import the exported xml
    loadXmlStream(new BufferedInputStream(new ByteArrayInputStream(xmlBytes)));

    List newRules = KEWServiceLocator.getRuleService().fetchAllRules(true);
    assertEquals("Should have same number of old and new Rules.", oldRules.size(), newRules.size());
    for (Iterator iterator = oldRules.iterator(); iterator.hasNext();) {
        RuleBaseValues oldRule = (RuleBaseValues) iterator.next();
        boolean foundRule = false;
        for (Iterator iterator2 = newRules.iterator(); iterator2.hasNext();) {
            RuleBaseValues newRule = (RuleBaseValues) iterator2.next();
            if (oldRule.getDescription().equals(newRule.getDescription())) {
                assertRuleExport(oldRule, newRule);
                foundRule = true;
            }
        }
        assertTrue("Could not locate the new rule for description " + oldRule.getDescription(), foundRule);
    }
    
    List newRuleDelegations = KEWServiceLocator.getRuleDelegationService().findAllCurrentRuleDelegations();
    assertDelegations(oldRuleDelegations, newRuleDelegations);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:52,代码来源:RuleXmlExporterTest.java


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