當前位置: 首頁>>代碼示例>>Java>>正文


Java ClearDatabaseLifecycle類代碼示例

本文整理匯總了Java中org.kuali.rice.test.ClearDatabaseLifecycle的典型用法代碼示例。如果您正苦於以下問題:Java ClearDatabaseLifecycle類的具體用法?Java ClearDatabaseLifecycle怎麽用?Java ClearDatabaseLifecycle使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ClearDatabaseLifecycle類屬於org.kuali.rice.test包,在下文中一共展示了ClearDatabaseLifecycle類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testExport

import org.kuali.rice.test.ClearDatabaseLifecycle; //導入依賴的package包/類
@Test public void testExport() throws Exception {
    // Previous tests may not have forced a full clear of the tables,
    new ClearDatabaseLifecycle(getPerTestTablesToClear(), getPerTestTablesNotToClear()).start();

    loadXmlFile("RuleTemplateExportConfig.xml");
    assertExport();
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:8,代碼來源:RuleTemplateXmlExporterTest.java

示例2: assertExport

import org.kuali.rice.test.ClearDatabaseLifecycle; //導入依賴的package包/類
protected void assertExport() throws Exception {
    // export all existing rule templates and their dependencies (rule attributes)
    List oldRuleTemplates = KEWServiceLocator.getRuleTemplateService().findAll();
    KewExportDataSet dataSet = new KewExportDataSet();
    dataSet.getRuleTemplates().addAll(oldRuleTemplates);
    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
    new ClearDatabaseLifecycle(getPerTestTablesToClear(), getPerTestTablesNotToClear()).start();

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

    List newRuleTemplates = KEWServiceLocator.getRuleTemplateService().findAll();
    assertEquals("Should have same number of old and new RuleTemplates.", oldRuleTemplates.size(), newRuleTemplates.size());
    for (Iterator iterator = oldRuleTemplates.iterator(); iterator.hasNext();) {
        RuleTemplateBo oldRuleTemplate = (RuleTemplateBo) iterator.next();
        boolean foundTemplate = false;
        for (Iterator iterator2 = newRuleTemplates.iterator(); iterator2.hasNext();) {
            RuleTemplateBo newRuleTemplate = (RuleTemplateBo) iterator2.next();
            if (oldRuleTemplate.getName().equals(newRuleTemplate.getName())) {
                assertRuleTemplateExport(oldRuleTemplate, newRuleTemplate);
                foundTemplate = true;
            }
        }
        assertTrue("Could not locate the new rule template for name " + oldRuleTemplate.getName(), foundTemplate);
    }
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:31,代碼來源:RuleTemplateXmlExporterTest.java

示例3: getPerTestLifecycles

import org.kuali.rice.test.ClearDatabaseLifecycle; //導入依賴的package包/類
/**
 * Override the standard per-test lifecycles to prepend
 * ClearDatabaseLifecycle and ClearCacheLifecycle
 *
 * @see org.kuali.rice.test.RiceTestCase#getPerTestLifecycles()
 */
@Override
protected List<Lifecycle> getPerTestLifecycles() {
	List<Lifecycle> lifecycles = new ArrayList<Lifecycle>();
	lifecycles.add(new ClearDatabaseLifecycle(getPerTestTablesToClear(),
			getPerTestTablesNotToClear()));
	lifecycles.add(new ClearCacheLifecycle());
	lifecycles.addAll(super.getPerTestLifecycles());
	return lifecycles;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:16,代碼來源:KEWTestCase.java

示例4: 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

示例5: 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類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。