diff --git a/Couchbase/build.gradle b/Couchbase/build.gradle index 28b641d..b601e7a 100644 --- a/Couchbase/build.gradle +++ b/Couchbase/build.gradle @@ -28,5 +28,5 @@ android { dependencies { androidTestCompile project(':Common') - androidTestCompile 'com.couchbase.lite:couchbase-lite-android:1.1.0' + androidTestCompile 'com.couchbase.lite:couchbase-lite-android:1.2.1' } diff --git a/Couchbase/src/androidTest/java/de/greenrobot/performance/couchbase/PerfTestCouchbase.java b/Couchbase/src/androidTest/java/de/greenrobot/performance/couchbase/PerfTestCouchbase.java index b071c15..6bd6c70 100644 --- a/Couchbase/src/androidTest/java/de/greenrobot/performance/couchbase/PerfTestCouchbase.java +++ b/Couchbase/src/androidTest/java/de/greenrobot/performance/couchbase/PerfTestCouchbase.java @@ -21,7 +21,7 @@ import java.util.Map; /** - * http://developer.couchbase.com/documentation/mobile/1.1.0/develop/training/build-first-android-app/index.html + * http://developer.couchbase.com/documentation/mobile/1.2/develop/training/build-first-android-app/index.html * https://github.com/couchbaselabs/ToDoLite-Android */ public class PerfTestCouchbase extends BasePerfTestCase { @@ -76,22 +76,17 @@ private void indexedStringEntityQueriesRun(View indexedStringView, int count) throws CouchbaseLiteException { // create entities String[] fixedRandomStrings = StringGenerator.createFixedRandomStrings(count); - database.beginTransaction(); for (int i = 0; i < count; i++) { Document entity = database.getDocument(String.valueOf(i)); Map properties = new HashMap<>(); properties.put("indexedString", fixedRandomStrings[i]); entity.putProperties(properties); } - database.endTransaction(true); log("Built and inserted entities."); // query for entities by indexed string at random int[] randomIndices = StringGenerator.getFixedRandomIndices(getQueryCount(), count - 1); - // clear the document cache to force loading properties from the database - database.clearDocumentCache(); - startClock(); for (int i = 0; i < getQueryCount(); i++) { int nextIndex = randomIndices[i]; @@ -119,7 +114,9 @@ protected void doOneByOneAndBatchCrud() throws Exception { for (int i = 0; i < RUNS; i++) { log("----Run " + (i + 1) + " of " + RUNS); oneByOneCrudRun(getOneByOneCount()); - batchCrudRun(getBatchSize()); + // couchbase 1.2 has removed transaction support, do not run batch test + // (only available for conflict resolution now) +// batchCrudRun(getBatchSize()); } } @@ -163,18 +160,15 @@ private void batchCrudRun(int count) throws Exception { startClock(); List documents = new ArrayList<>(count); - database.beginTransaction(); for (int i = 0; i < count; i++) { // use our own ids (use .createDocument() for random UUIDs) Document document = database.getDocument(String.valueOf(i)); document.putProperties(maps.get(i)); documents.add(document); } - database.endTransaction(true); stopClock(LogMessage.BATCH_CREATE); startClock(); - database.beginTransaction(); for (int i = 0; i < count; i++) { Document document = documents.get(i); Map updatedProperties = new HashMap<>(); @@ -183,12 +177,8 @@ private void batchCrudRun(int count) throws Exception { updatedProperties.putAll(maps.get(i)); document.putProperties(updatedProperties); } - database.endTransaction(true); stopClock(LogMessage.BATCH_UPDATE); - // clear the document cache to force loading properties from the database - database.clearDocumentCache(); - startClock(); List reloaded = new ArrayList<>(); for (int i = 0; i < count; i++) { @@ -223,12 +213,10 @@ private void deleteAll() throws CouchbaseLiteException { // query all documents, mark them as deleted Query query = database.createAllDocumentsQuery(); QueryEnumerator result = query.run(); - database.beginTransaction(); while (result.hasNext()) { QueryRow row = result.next(); row.getDocument().purge(); } - database.endTransaction(true); } private Map createDocumentMap(int seed) throws CouchbaseLiteException {