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


Java CaseDBUtils类代码示例

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


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

示例1: initialize

import org.commcare.cases.util.CaseDBUtils; //导入依赖的package包/类
public void initialize(CommCareOTARestoreListener rListener, CommCareOTARestoreTransitions transitions,
        String restoreURI, HttpAuthenticator authenticator, boolean isSync, boolean noPartial, String syncToken, String logSubmitURI){

    if (isSync && !noPartial) {
        System.err.println("WARNING: no-partial mode is strongly recommended when syncing");
    }
    this.syncToken = syncToken;

    this.originalRestoreURI = restoreURI;
    this.authenticator = authenticator;
    this.logSubmitURI = logSubmitURI;

    this.isSync = isSync;
    if (isSync) {
        this.stateHash = CaseDBUtils.computeHash((IStorageUtility<Case>)StorageManager.getStorage(Case.STORAGE_KEY));
        initURI(syncToken, stateHash);
    } else {
        initURI(null,null);
    }
    this.noPartial = noPartial;

    this.listener = rListener;

    this.transitions = transitions;

    HandledThread t = new HandledThread(this);
    t.start();

}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:30,代码来源:CommCareRestorer.java

示例2: testCaseDigest

import org.commcare.cases.util.CaseDBUtils; //导入依赖的package包/类
public void testCaseDigest() {
    DummyIndexedStorageUtility<Case> testStorage =  new DummyIndexedStorageUtility<Case>(Case.class);
    Case[] dc = genDummyCases();
    try {
        testStorage.write(dc[0]);
        testStorage.write(dc[1]);
    } catch(Exception e){
        e.printStackTrace();
        this.fail("Exception when creating dummy storage for case digest test: " + e.getMessage());
    }

    this.assertEquals("Invalid state hash", CaseDBUtils.computeHash(testStorage),"c4251c443d45aa2601bf16533fb9dbe1");
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:14,代码来源:CaseDBUtilsTests.java

示例3: testOrderInvariance

import org.commcare.cases.util.CaseDBUtils; //导入依赖的package包/类
public void testOrderInvariance() {
    DummyIndexedStorageUtility<Case> testStorage =  new DummyIndexedStorageUtility<Case>(Case.class);
    Case[] dc = genDummyCases();
    try {
        //NOTE: Depends on the implementation of the testStorage! badbadbad;
        testStorage.write(dc[1]);
        testStorage.write(dc[0]);
    } catch(Exception e){
        e.printStackTrace();
        this.fail("Exception when creating dummy storage for case digest invariance test: " + e.getMessage());
    }

    this.assertEquals("Invalid state hash on Inversion", CaseDBUtils.computeHash(testStorage),"c4251c443d45aa2601bf16533fb9dbe1");

}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:16,代码来源:CaseDBUtilsTests.java

示例4: getDigest

import org.commcare.cases.util.CaseDBUtils; //导入依赖的package包/类
private static String getDigest() {
    String fakeHash = DebugControlsReceiver.getFakeCaseDbHash();
    if (fakeHash != null) {
        // For integration tests, use fake hash to trigger 412 recovery on this sync
        return fakeHash;
    } else {
        return CaseDBUtils.computeCaseDbHash(CommCareApplication.instance().getUserStorage(ACase.STORAGE_KEY, ACase.class));
    }
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:10,代码来源:CommcareRequestGenerator.java

示例5: testHighLevelStrategy

import org.commcare.cases.util.CaseDBUtils; //导入依赖的package包/类
public void testHighLevelStrategy() {
    this.assertEquals("Case ID hashing method produces invalid result", MD5.toHex(CaseDBUtils.xordata(MD5.hash((one+":o").getBytes()), MD5.hash((two+":c").getBytes()))),"c4251c443d45aa2601bf16533fb9dbe1");
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:4,代码来源:CaseDBUtilsTests.java


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