@@ -0,0 +1,2863 @@
+package com.qiniu.android;%0A%0Aimport android.test.AndroidTestCase;%0Aimport android.util.Log;%0A%0Aimport com.qiniu.android.http.ResponseInfo;%0Aimport com.qiniu.android.storage.Configuration;%0Aimport com.qiniu.android.storage.UpCompletionHandler;%0Aimport com.qiniu.android.storage.UploadManager;%0A%0Aimport junit.framework.Assert;%0A%0Aimport org.json.JSONObject;%0A%0Aimport java.io.File;%0Aimport java.io.IOException;%0Aimport java.util.concurrent.CountDownLatch;%0Aimport java.util.concurrent.TimeUnit;%0A%0Apublic class ComplexUploadSceneTest extends AndroidTestCase %7B%0A%0A    private final CountDownLatch signal = new CountDownLatch(1);%0A%0A    public void testMutiUpload()%7B%0A%0A        final int maxCount = 10;%0A%0A        final TestParam param = new TestParam();%0A        param.completeCount = 0;%0A        param.successCount = 0;%0A%0A        for (int i = 0; i %3C maxCount; i++) %7B%0A            template((i + 1) * 100, new CompleteHandler() %7B%0A                @Override%0A                public void complete(boolean isSuccess) %7B%0A%0A                    synchronized (param)%7B%0A                        param.completeCount += 1;%0A                        if (isSuccess)%7B%0A                            param.successCount += 1;%0A                        %7D%0A                        if (param.completeCount == maxCount)%7B%0A                            signal.countDown();%0A                        %7D%0A                    %7D%0A                %7D%0A            %7D);%0A        %7D%0A%0A        try %7B%0A            signal.await(); // wait for callback%0A        %7D catch (InterruptedException e) %7B%0A        %7D%0A%0A        Log.d(%22ComplexUploadSceneTest%22, %22complex_upload successCount: %22 + param.successCount);%0A        assertTrue(%22Pass%22, param.successCount == param.completeCount);%0A    %7D%0A%0A    private void template(int size, final CompleteHandler completeHandler)%7B%0A%0A        final String keyUp = %22android_complex_upload_%22 + size + %22k%22;%0A        File file = null;%0A        try %7B%0A            file = TempFile.createFile(size);%0A        %7D catch (IOException e) %7B%0A            completeHandler.complete(false);%0A            return;%0A        %7D%0A%0A        Configuration configuration = new Configuration.Builder()%0A                .useHttps(true)%0A                .build();%0A        UploadManager manager = new UploadManager(configuration);%0A%0A        manager.put(file, keyUp, TestConfig.token_na0, new UpCompletionHandler() %7B%0A            @Override%0A            public void complete(String key, ResponseInfo info, JSONObject response) %7B%0A                if (info.isOK() && info.reqId != null && keyUp.equals(key))%7B%0A                    completeHandler.complete(true);%0A                %7D else %7B%0A                    completeHandler.complete(false);%0A                %7D%0A            %7D%0A        %7D, null);%0A    %7D%0A%0A    private interface CompleteHandler%7B%0A        void complete(boolean isSuccess);%0A    %7D%0A%0A%0A    private class TestParam%7B%0A        int successCount = 0;%0A        int completeCount = 0;%0A    %7D%0A%0A%7D%0A

add complex upload scene test