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


Java CasePurgeFilter.getInternalCaseGraph方法代码示例

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


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

示例1: testValidateCaseGraphBeforePurge_simple

import org.commcare.cases.util.CasePurgeFilter; //导入方法依赖的package包/类
/**
 * Test correct validation of a graph where 1 case indexes a non-existent node
 */
@Test
public void testValidateCaseGraphBeforePurge_simple() throws Exception {
    MockUserDataSandbox sandbox = MockDataUtils.getStaticStorage();
    ParseUtils.parseIntoSandbox(this.getClass().getClassLoader().
            getResourceAsStream("case_purge/validate_case_graph_test_simple.xml"), sandbox);
    IStorageUtilityIndexed<Case> storage = sandbox.getCaseStorage();

    HashMap<String, Integer> caseIdsToRecordIds = createCaseIdsMap(storage);
    CasePurgeFilter filter = new CasePurgeFilter(storage);

    Set<String> nodesExpectedToBeLeft = new HashSet<>();
    nodesExpectedToBeLeft.add("case_one");
    nodesExpectedToBeLeft.add("case_two");

    Set<String[]> edgesExpectedToBeLeft = new HashSet<>();
    edgesExpectedToBeLeft.add(new String[]{"case_two", "case_one"});

    // Check that the edges and nodes still present in the graph are as expected
    DAG<String, int[], String> internalCaseGraph = filter.getInternalCaseGraph();
    checkProperNodesPresent(nodesExpectedToBeLeft, internalCaseGraph);
    checkProperEdgesPresent(edgesExpectedToBeLeft, internalCaseGraph);

    // Check that the correct cases were actually purged
    Vector<Integer> expectedToRemove = new Vector<>();
    expectedToRemove.add(caseIdsToRecordIds.get("case_three"));
    Vector<Integer> removed = storage.removeAll(filter);
    checkProperCasesRemoved(expectedToRemove, removed);
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:32,代码来源:CasePurgeRegressions.java

示例2: testValidateCaseGraphBeforePurge_complex

import org.commcare.cases.util.CasePurgeFilter; //导入方法依赖的package包/类
/**
 * Test correct validation of a graph where 2 different cases index the same non-existent node,
 * and both of those cases have child nodes
 */
@Test
public void testValidateCaseGraphBeforePurge_complex() throws Exception {
    MockUserDataSandbox sandbox = MockDataUtils.getStaticStorage();
    ParseUtils.parseIntoSandbox(this.getClass().getClassLoader().
            getResourceAsStream("case_purge/validate_case_graph_test_complex.xml"), sandbox);
    IStorageUtilityIndexed<Case> storage = sandbox.getCaseStorage();

    HashMap<String, Integer> caseIdsToRecordIds = createCaseIdsMap(storage);
    CasePurgeFilter filter = new CasePurgeFilter(storage);

    Set<String> nodesExpectedToBeLeft = new HashSet<>();
    nodesExpectedToBeLeft.add("case_one");
    nodesExpectedToBeLeft.add("case_two");

    Set<String[]> edgesExpectedToBeLeft = new HashSet<>();
    edgesExpectedToBeLeft.add(new String[]{"case_two", "case_one"});

    // Check that the edges and nodes still present in the graph are as expected
    DAG<String, int[], String> internalCaseGraph = filter.getInternalCaseGraph();
    checkProperNodesPresent(nodesExpectedToBeLeft, internalCaseGraph);
    checkProperEdgesPresent(edgesExpectedToBeLeft, internalCaseGraph);

    // Check that the correct cases were actually purged
    Vector<Integer> expectedToRemove = new Vector<>();
    expectedToRemove.add(caseIdsToRecordIds.get("case_three"));
    expectedToRemove.add(caseIdsToRecordIds.get("case_four"));
    expectedToRemove.add(caseIdsToRecordIds.get("case_five"));
    expectedToRemove.add(caseIdsToRecordIds.get("case_six"));
    expectedToRemove.add(caseIdsToRecordIds.get("case_seven"));
    Vector<Integer> removed = storage.removeAll(filter);
    checkProperCasesRemoved(expectedToRemove, removed);
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:37,代码来源:CasePurgeRegressions.java

示例3: testValidateCaseGraphBeforePurge_multipleParents

import org.commcare.cases.util.CasePurgeFilter; //导入方法依赖的package包/类
/**
 * Test correct validation of a graph where 1 case indexes 2 other cases - 1 valid and 1 that
 * does not exist
 */
@Test
public void testValidateCaseGraphBeforePurge_multipleParents() throws Exception {
    MockUserDataSandbox sandbox = MockDataUtils.getStaticStorage();
    ParseUtils.parseIntoSandbox(this.getClass().getClassLoader().
            getResourceAsStream("case_purge/validate_case_graph_test_multiple_parents.xml"),
            sandbox);
    IStorageUtilityIndexed<Case> storage = sandbox.getCaseStorage();

    HashMap<String, Integer> caseIdsToRecordIds = createCaseIdsMap(storage);
    CasePurgeFilter filter = new CasePurgeFilter(storage);

    Set<String> nodesExpectedToBeLeft = new HashSet<>();
    nodesExpectedToBeLeft.add("case_two");
    nodesExpectedToBeLeft.add("case_three");

    Set<String[]> edgesExpectedToBeLeft = new HashSet<>();
    edgesExpectedToBeLeft.add(new String[]{"case_three", "case_two"});

    // Check that the edges and nodes still present in the graph are as expected
    DAG<String, int[], String> internalCaseGraph = filter.getInternalCaseGraph();
    checkProperNodesPresent(nodesExpectedToBeLeft, internalCaseGraph);
    checkProperEdgesPresent(edgesExpectedToBeLeft, internalCaseGraph);

    // Check that the correct cases were actually purged
    Vector<Integer> expectedToRemove = new Vector<>();
    expectedToRemove.add(caseIdsToRecordIds.get("case_one"));
    expectedToRemove.add(caseIdsToRecordIds.get("case_four"));
    Vector<Integer> removed = storage.removeAll(filter);
    checkProperCasesRemoved(expectedToRemove, removed);
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:35,代码来源:CasePurgeRegressions.java

示例4: testValidateCaseGraphBeforePurge_noRemoval

import org.commcare.cases.util.CasePurgeFilter; //导入方法依赖的package包/类
/**
 * Test correct validation of a graph where no cases index a non-existent node, so there is no
 * change
 */
@Test
public void testValidateCaseGraphBeforePurge_noRemoval() throws Exception {
    MockUserDataSandbox sandbox = MockDataUtils.getStaticStorage();
    ParseUtils.parseIntoSandbox(this.getClass().getClassLoader().
            getResourceAsStream("case_purge/validate_case_graph_test_no_change.xml"), sandbox);
    IStorageUtilityIndexed<Case> storage = sandbox.getCaseStorage();

    CasePurgeFilter filter = new CasePurgeFilter(storage);

    Set<String> nodesExpectedToBeLeft = new HashSet<>();
    nodesExpectedToBeLeft.add("case_one");
    nodesExpectedToBeLeft.add("case_two");
    nodesExpectedToBeLeft.add("case_three");
    nodesExpectedToBeLeft.add("case_four");

    Set<String[]> edgesExpectedToBeLeft = new HashSet<>();
    edgesExpectedToBeLeft.add(new String[]{"case_two", "case_one"});

    // Check that the edges and nodes still present in the graph are as expected
    DAG<String, int[], String> internalCaseGraph = filter.getInternalCaseGraph();
    checkProperNodesPresent(nodesExpectedToBeLeft, internalCaseGraph);
    checkProperEdgesPresent(edgesExpectedToBeLeft, internalCaseGraph);

    // Check that the correct cases (none in this case) were actually purged
    Vector<Integer> expectedToRemove = new Vector<>();
    Vector<Integer> removed = storage.removeAll(filter);
    checkProperCasesRemoved(expectedToRemove, removed);
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:33,代码来源:CasePurgeRegressions.java


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