本文整理汇总了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();
}
示例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");
}
示例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");
}
示例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));
}
}
示例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");
}