@@ -0,0 +1,2714 @@
+//%0A// Copyright (c) 2016 Couchbase, Inc. All rights reserved.%0A//%0A// Licensed under the Apache License, Version 2.0 (the %22License%22); you may not use this file%0A// except in compliance with the License. You may obtain a copy of the License at%0A//%0A// http://www.apache.org/licenses/LICENSE-2.0%0A//%0A// Unless required by applicable law or agreed to in writing, software distributed under the%0A// License is distributed on an %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,%0A// either express or implied. See the License for the specific language governing permissions%0A// and limitations under the License.%0A//%0Apackage com.couchbase.lite.syncgateway;%0A%0Aimport com.couchbase.lite.CouchbaseLiteException;%0Aimport com.couchbase.lite.Database;%0Aimport com.couchbase.lite.Document;%0Aimport com.couchbase.lite.LiteTestCaseWithDB;%0Aimport com.couchbase.lite.TransactionalTask;%0Aimport com.couchbase.lite.replicator.Replication;%0Aimport com.couchbase.lite.util.Log;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0A%0A/**%0A * Created by hideki on 6/27/16.%0A */%0Apublic class PusherInternalTest extends LiteTestCaseWithDB %7B%0A    public void testPushWithLargeDataSet() throws Exception %7B%0A        if (!syncgatewayTestsEnabled())%0A            return;%0A        if (!isSQLiteDB())%0A            return;%0A%0A        createDocs(database, 250);%0A        assertEquals(250 * 100, database.getDocumentCount());%0A        Replication push = database.createPushReplication(getReplicationURL());%0A        assertNotNull(push);%0A        runReplication(push);%0A        assertEquals(250 * 100, push.getChangesCount());%0A%0A    %7D%0A%0A    private static void createDocs(final Database db, int xK) %7B%0A        final StringBuffer sb = new StringBuffer();%0A        for (int i = 0; i %3C 1000; i++) %7B%0A            sb.append(%221234567890%22);%0A        %7D%0A%0A        for (int i = 0; i %3C xK; i++) %7B%0A            final int j = i;%0A            assertTrue(db.runInTransaction(new TransactionalTask() %7B%0A                @Override%0A                public boolean run() %7B%0A                    for (int k = 0; k %3C 100; k++) %7B%0A                        Map%3CString, Object%3E props = new HashMap%3CString, Object%3E();%0A                        props.put(%22key%22, j * 1000 + k);%0A                        props.put(%22value%22, sb.toString());%0A                        Document doc = db.createDocument();%0A                        try %7B%0A                            doc.putProperties(props);%0A                        %7D catch (CouchbaseLiteException e) %7B%0A                            Log.e(TAG, %22Error in Document.putProperperties() props=%25s%22, e, props);%0A                            return false;%0A                        %7D%0A                    %7D%0A                    return true;%0A                %7D%0A            %7D));%0A        %7D%0A    %7D%0A%7D%0A

Implement unit test for https://github.com/couchbase/couchbase-lite-android/issues/898