Skip to content

Commit 4a68e4b

Browse files
author
jordanqin
committed
update qcloud sdk to 5.9.28
1 parent 38de9dd commit 4a68e4b

File tree

101 files changed

+2735
-1442
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+2735
-1442
lines changed

QCloudCosXml/cos-android-base/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ android {
66
minSdkVersion 15
77
targetSdkVersion 28
88

9-
versionCode 50925
10-
versionName '5.9.25'
9+
versionCode 50926
10+
versionName '5.9.26'
1111

1212
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
1313

QCloudCosXml/cos-android-base/src/main/java/com/tencent/cos/xml/CosXmlBaseService.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -494,11 +494,6 @@ public void onFailure(QCloudClientException clientException, QCloudServiceExcept
494494
QCloudHttpRequest<T2> httpRequest = buildHttpRequest(cosXmlRequest, cosXmlResult);
495495

496496
HttpTask<T2> httpTask;
497-
// if (cosXmlRequest instanceof PostObjectRequest) {
498-
// httpTask = client.resolveRequest(httpRequest, null);
499-
// } else {
500-
// httpTask = client.resolveRequest(httpRequest, credentialProvider);
501-
// }
502497
httpTask = client.resolveRequest(httpRequest, credentialProvider);
503498

504499
httpTask.setTransferThreadControl(config.isTransferThreadControl());
@@ -644,10 +639,6 @@ public GetObjectResult getObject(GetObjectRequest request) throws CosXmlClientEx
644639
public void getObjectAsync(GetObjectRequest request, CosXmlResultListener cosXmlResultListener) {
645640
schedule(request, new GetObjectResult(), cosXmlResultListener);
646641
}
647-
648-
public GetObjectResult internalGetObject(GetObjectRequest request) throws CosXmlClientException, CosXmlServiceException {
649-
return execute(request, new GetObjectResult(), true);
650-
}
651642
public void internalGetObjectAsync(GetObjectRequest request, CosXmlResultListener cosXmlResultListener) {
652643
schedule(request, new GetObjectResult(), cosXmlResultListener, true);
653644
}

QCloudCosXml/cos-android-base/src/main/java/com/tencent/cos/xml/utils/DigestUtils.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,17 @@ public static String getHmacSha1(String content, String key) throws CosXmlClient
307307
return hmacSha1;
308308
}
309309

310+
public static String decodeBase64(String content) {
311+
if(TextUtils.isEmpty(content)){
312+
return content;
313+
}
314+
try {
315+
return new String(Base64.decode(content, Base64.DEFAULT), "UTF-8");
316+
} catch (UnsupportedEncodingException e) {
317+
return content;
318+
}
319+
}
320+
310321
public static String getBase64(String content) throws CosXmlClientException {
311322
if(TextUtils.isEmpty(content)){
312323
return content;

QCloudCosXml/cos-android-tiny/src/main/java/com/tencent/cos/xml/CosXmlSimpleService.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,11 +359,6 @@ public void onFailure(QCloudClientException clientException, QCloudServiceExcept
359359
QCloudHttpRequest<T2> httpRequest = buildHttpRequest(cosXmlRequest, cosXmlResult);
360360

361361
HttpTask<T2> httpTask;
362-
// if (cosXmlRequest instanceof PostObjectRequest) {
363-
// httpTask = client.resolveRequest(httpRequest, null);
364-
// } else {
365-
// httpTask = client.resolveRequest(httpRequest, credentialProvider);
366-
// }
367362
httpTask = client.resolveRequest(httpRequest, credentialProvider);
368363

369364
httpTask.setTransferThreadControl(config.isTransferThreadControl());

QCloudCosXml/cos-android/build.gradle

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ android {
4040
buildTypes {
4141

4242
debug {
43-
// testCoverageEnabled = true
43+
testCoverageEnabled = true
4444
// it.buildConfigField "int", "VERSION_CODE", "${defaultConfig.versionCode}"
4545
// it.buildConfigField "String","VERSION_NAME","\"${defaultConfig.versionName}\""
4646
it.buildConfigField 'String', 'OWNER_UIN', quotWrapper(System.getenv("OWNER_UIN"))
@@ -66,6 +66,9 @@ android {
6666

6767
it.buildConfigField 'String', 'CLS_SECRET_ID', quotWrapper(System.getenv("CLS_SECRET_ID"))
6868
it.buildConfigField 'String', 'CLS_SECRET_KEY', quotWrapper(System.getenv("CLS_SECRET_KEY"))
69+
70+
it.buildConfigField 'String', 'CALLBACK_SECRET_ID', quotWrapper(System.getenv("CALLBACK_SECRET_ID"))
71+
it.buildConfigField 'String', 'CALLBACK_SECRET_KEY', quotWrapper(System.getenv("CALLBACK_SECRET_KEY"))
6972
}
7073

7174
release {
@@ -89,8 +92,8 @@ android {
8992
}
9093

9194
// 切换发 normal 或者 slim 包,需要同步修改 pom.artifactId 信息
92-
// defaultPublishConfig "normalRelease"
93-
defaultPublishConfig "slimRelease"
95+
defaultPublishConfig "normalRelease"
96+
// defaultPublishConfig "slimRelease"
9497

9598
compileOptions {
9699
sourceCompatibility = JavaVersion.VERSION_1_8
@@ -140,7 +143,9 @@ dependencies {
140143
androidTestImplementation 'com.tencentcloudapi:tencentcloud-sdk-java-kms:3.1.213'
141144
androidTestImplementation 'xerces:xercesImpl:2.12.0'
142145

143-
androidTestImplementation project(path: ':quic')
146+
androidTestImplementation(project(path: ':quic')) {
147+
exclude group: 'com.qcloud.cos', module: 'qcloud-foundation'
148+
}
144149
//tencent http dns
145150
androidTestImplementation "io.github.dnspod:httpdns-sdk:4.3.0"
146151
// androidTestImplementation 'android.arch.persistence.room:rxjava2:2.1.1'

QCloudCosXml/cos-android/jacoco.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ task jacocoCreateNormalDebugCoverageReport(type: JacocoReport, dependsOn: 'conne
4949
'com/tencent/cos/xml/transfer/CopyObjectService*',
5050
// 系统临时生成
5151
'**/*BuildConfig.class',
52+
'**/*$$XmlAdapter.class',// 排除xml序列化中间生成类
53+
'**/*XmlAdapter*.class',// 排除XmlAdapter中的匿名类ChildElementBinder
5254

5355
'com/tencent/cos/xml/crypto/**',
5456
'com/tencent/cos/xml/model/tag/eventstreaming/**',

QCloudCosXml/cos-android/src/androidTest/java/com/tencent/cos/xml/MyApplication.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import android.app.Application;
44

5+
import com.tencent.cos.xml.core.TestUtils;
6+
57
/**
68
* <p>
79
* Created by jordanqin on 2023/9/14 21:38.
@@ -11,6 +13,13 @@ public class MyApplication extends Application {
1113
@Override
1214
public void onCreate() {
1315
super.onCreate();
16+
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
17+
@Override
18+
public void uncaughtException(Thread thread, Throwable throwable) {
19+
// 在这里处理异常,例如记录日志
20+
TestUtils.printError(throwable.getMessage());
21+
}
22+
});
1423
trackInit();
1524
}
1625

QCloudCosXml/cos-android/src/androidTest/java/com/tencent/cos/xml/common/CosXmlConfigTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public void multipleConfigTest() {
116116
} catch (CosXmlServiceException e) {
117117
}
118118

119-
HeadObjectRequest headObjectRequest2 = new HeadObjectRequest(TestConst.ASR_BUCKET, TestConst.ASR_OBJECT_LONG);
119+
HeadObjectRequest headObjectRequest2 = new HeadObjectRequest(TestConst.CI_BUCKET, TestConst.ASR_OBJECT_LONG);
120120
CosXmlServiceConfig cosXmlServiceConfig2 = new CosXmlServiceConfig.Builder()
121121
.isHttps(true)
122122
.setDebuggable(true)

QCloudCosXml/cos-android/src/androidTest/java/com/tencent/cos/xml/common/OtherTest.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import com.tencent.cos.xml.CosXmlSimpleService;
3434
import com.tencent.cos.xml.core.ServiceFactory;
3535
import com.tencent.cos.xml.core.TestConst;
36+
import com.tencent.cos.xml.core.TestLocker;
3637
import com.tencent.cos.xml.core.TestUtils;
3738
import com.tencent.cos.xml.exception.CosXmlClientException;
3839
import com.tencent.cos.xml.exception.CosXmlServiceException;
@@ -87,48 +88,56 @@ public void testClientErrorCode(){
8788

8889
@Test
8990
public void testPreBuildConnection() {
90-
CosXmlSimpleService cosXmlSimpleService = ServiceFactory.INSTANCE.newSelfService();
91+
CosXmlSimpleService cosXmlSimpleService = ServiceFactory.INSTANCE.newDefaultService();
9192
boolean b = cosXmlSimpleService.preBuildConnection(TestConst.PERSIST_BUCKET);
9293
Assert.assertTrue(b);
9394
}
9495

9596
@Test
9697
public void testPreBuildConnectionFailed() {
97-
CosXmlSimpleService cosXmlSimpleService = ServiceFactory.INSTANCE.newSelfService();
98+
CosXmlSimpleService cosXmlSimpleService = ServiceFactory.INSTANCE.newDefaultService();
9899
boolean b = cosXmlSimpleService.preBuildConnection(TestConst.PERSIST_BUCKET+"aaaaaaa");
99100
Assert.assertFalse(b);
100101
}
101102

102103
@Test
103104
public void testPreBuildConnectionAsync() {
104105
CosXmlSimpleService cosXmlSimpleService = ServiceFactory.INSTANCE.newDefaultService();
106+
final TestLocker testLocker = new TestLocker();
105107
cosXmlSimpleService.preBuildConnectionAsync(TestConst.PERSIST_BUCKET, new CosXmlResultSimpleListener() {
106108
@Override
107109
public void onSuccess() {
108110
Assert.assertTrue(true);
111+
testLocker.release();
109112
}
110113

111114
@Override
112115
public void onFail(CosXmlClientException exception, CosXmlServiceException serviceException) {
113116
Assert.fail(TestUtils.getCosExceptionMessage(exception, serviceException));
117+
testLocker.release();
114118
}
115119
});
120+
testLocker.lock();
116121
}
117122

118123
@Test
119124
public void testPreBuildConnectionAsyncFailed() {
120125
CosXmlSimpleService cosXmlSimpleService = ServiceFactory.INSTANCE.newDefaultService();
126+
final TestLocker testLocker = new TestLocker();
121127
cosXmlSimpleService.preBuildConnectionAsync(TestConst.PERSIST_BUCKET+"aaaaa", new CosXmlResultSimpleListener() {
122128
@Override
123129
public void onSuccess() {
124130
Assert.fail();
131+
testLocker.release();
125132
}
126133

127134
@Override
128135
public void onFail(CosXmlClientException exception, CosXmlServiceException serviceException) {
129136
Assert.assertTrue(true);
137+
testLocker.release();
130138
}
131139
});
140+
testLocker.lock();
132141
}
133142

134143
@Test public void testCRC64() {

QCloudCosXml/cos-android/src/androidTest/java/com/tencent/cos/xml/core/TestConst.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ public class TestConst {
1616

1717
public static final String SECRET_ID = BuildConfig.COS_SECRET_ID;
1818
public static final String SECRET_KEY = BuildConfig.COS_SECRET_KEY;
19-
2019
public static final String PERSIST_BUCKET_REGION = BuildConfig.PERSIST_BUCKET_REGION;
2120
public static final String PERSIST_BUCKET = BuildConfig.PERSIST_BUCKET;
2221
public static final String PERSIST_BUCKET_CDN_SIGN = BuildConfig.PERSIST_BUCKET_CDN_SIGN;
2322
public static final String PERSIST_BUCKET_PIC_PATH = "do_not_remove/image.png";
23+
public static final String PERSIST_BUCKET_PIC_6M_PATH = "do_not_remove/6m.jpg";
2424
public static final String PERSIST_BUCKET_QR_PATH = "do_not_remove/qr.png";
2525
public static final String PERSIST_BUCKET_VIDEO_PATH = "do_not_remove/video.mp4";
2626
public static final String PERSIST_BUCKET_SELECT_JSON_PATH = "do_not_remove/select.json";
@@ -35,16 +35,17 @@ public class TestConst {
3535
public static final String PERSIST_BUCKET_REPLICATION = BuildConfig.PERSIST_BUCKET_REPLICATION;
3636
public static final String PERSIST_BUCKET_REPLICATION_REGION = BuildConfig.PERSIST_BUCKET_REPLICATION_REGION;
3737

38+
public static final String CI_BUCKET_REGION = "ap-beijing";
39+
public static final String CI_BUCKET = "cos-sdk-citest-1253960454";
40+
3841
//审核
39-
public static final String AUDIT_BUCKET_REGION = "ap-chengdu";
40-
public static final String AUDIT_BUCKET = "00000000000000-1253960454";
41-
public static final String AUDIT_BUCKET_PORN_IMAGE = "porn/IMG_6507.JPG";
42+
public static final String AUDIT_BUCKET_PORN_IMAGE = "logotest1.jpg";
4243
public static final String AUDIT_BUCKET_IMAGE = " %dimage.jpg";
4344
public static final String AUDIT_BUCKET_IMAGE_GIF = "image_gif_%d.gif";
44-
public static final String AUDIT_BUCKET_VIDEO = "test.mp4";
45-
public static final String AUDIT_BUCKET_AUDIO = "16k_ch_and_en.mp3";
45+
public static final String AUDIT_BUCKET_VIDEO = "example.mp4";
46+
public static final String AUDIT_BUCKET_AUDIO = "example1672060469857.mp3";
4647
public static final String AUDIT_BUCKET_TEXT = "test.txt";
47-
public static final String AUDIT_BUCKET_DOCUMENT = "03_路由.pdf";
48+
public static final String AUDIT_BUCKET_DOCUMENT = "student.ppt";
4849
public static final String AUDIT_WEBPAGE = "https://tech.meituan.com/2021/06/10/react-native-hybrid-practice-dsl-in-meituan.html";
4950

5051
//声音识别
@@ -54,6 +55,7 @@ public class TestConst {
5455
public static final String ASR_OBJECT_FF_2C = "asr/ff-16b-2c-44100hz.aac";
5556
public static final String ASR_OBJECT_GS_1C = "asr/gs-16b-1c-8000hz.amr";
5657
public static final String ASR_OBJECT_GS_2C = "asr/gs-16b-2c-44100hz.aac";
58+
public static final String ASR_OBJECT_GS_2C_URL = "https://ci-auditing-sample-1253960454.cos.ap-guangzhou.myqcloud.com/asr/gs-16b-2c-44100hz.aac";
5759
public static final String ASR_OBJECT_LONG = "asr/aaa.m4a";
5860
public static final String ASR_OBJECT_OUTPUT = "asr/output.txt";
5961

@@ -70,16 +72,17 @@ public class TestConst {
7072
public static final long PERSIST_BUCKET_SMALL_OBJECT_SIZE = 1024 * 1024;
7173
public static final long PERSIST_BUCKET_BIG_OBJECT_SIZE = 10 * 1024 * 1024;
7274
public static final long PERSIST_BUCKET_BIG_60M_OBJECT_SIZE = 60 * 1024 * 1024;
75+
7376
public static final String PERSIST_BUCKET_SMALL_OBJECT_PATH = "do_not_remove/small_object";
7477
public static final String PERSIST_BUCKET_BIG_OBJECT_PATH = "do_not_remove/big_object";
7578
public static final String PERSIST_BUCKET_BATCH_OBJECT_PATH = "do_not_remove//batch/small_object";
7679
public static final String PERSIST_BUCKET_BIG_60M_OBJECT_PATH = "do_not_remove/big_60m_object";
77-
7880
public static final String PERSIST_BUCKET_CSE_SMALL_OBJECT_PATH = "do_not_remove/cse_small_object";
7981
public static final String PERSIST_BUCKET_CSE_BIG_OBJECT_PATH = "do_not_remove/cse_big_object";
8082

8183
public static final String TEMP_BUCKET_REGION = BuildConfig.TEMP_BUCKET_REGION;
8284
public static final String TEMP_BUCKET = BuildConfig.TEMP_BUCKET;
85+
public static final String TEMP_BUCKET_MAZ = "mobile-ut-temp-maz-1253960454";
8386

8487
public static final Boolean WEAK_NETWORK_TEST = BuildConfig.WEAK_NETWORK_TEST;
8588

@@ -95,4 +98,10 @@ public class TestConst {
9598
public static final String PERSIST_BUCKET_CDN_PIC_PATH = "do_not_remove/cdn/image.png";
9699
public static final String PERSIST_BUCKET_CDN_SMALL_OBJECT_URL = "https://mobile-ut-1253960454.cos.ap-guangzhou.myqcloud.com/do_not_remove/cdn/small_object";
97100
public static final String PERSIST_BUCKET_CDN_BIG_OBJECT_URL = "https://mobile-ut-1253960454.cos.ap-guangzhou.myqcloud.com/do_not_remove/cdn/big_object";
101+
public static final String PERSIST_BUCKET_QR_URL = "https://mobile-ut-1253960454.cos.ap-guangzhou.myqcloud.com/do_not_remove/cdn/qr.png";
102+
103+
public static final String CALLBACK_SECRET_ID = BuildConfig.CALLBACK_SECRET_ID;
104+
public static final String CALLBACK_SECRET_KEY = BuildConfig.CALLBACK_SECRET_KEY;
105+
public static final String CALLBACK_PERSIST_BUCKET_REGION = "ap-shanghai";
106+
public static final String CALLBACK_PERSIST_BUCKET = "test-callback-1251668577";
98107
}

0 commit comments

Comments
 (0)