Skip to content

Commit 2cdc2b8

Browse files
authored
fix: upgrade cosn version and unit test incompatible problem (#163)
* feat: add unit test and convering client-side issues * fix: upgrade cosn version and unit test incompatible problem
1 parent e90f157 commit 2cdc2b8

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.qcloud.cos</groupId>
88
<artifactId>hadoop-cos</artifactId>
9-
<version>8.3.14</version>
9+
<version>8.3.15</version>
1010
<packaging>jar</packaging>
1111

1212
<name>Apache Hadoop Tencent Cloud COS Support</name>

src/test/java/org/apache/hadoop/fs/CosNFileSystemTestBase.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package org.apache.hadoop.fs;
22

3-
import org.apache.commons.lang3.RandomStringUtils;
43
import org.apache.hadoop.conf.Configuration;
54
import org.junit.After;
65
import org.junit.AfterClass;
@@ -9,12 +8,15 @@
98

109
import java.io.IOException;
1110
import java.util.Arrays;
11+
import java.util.Random;
12+
import java.security.SecureRandom;
1213

1314
public class CosNFileSystemTestBase extends CosNFileSystemTestWithTimeout {
1415
protected static Configuration configuration;
1516
protected static FileSystem fs;
17+
static Random random = new Random();
1618

17-
protected static final Path unittestDirPath = new Path("/unittest-dir" + RandomStringUtils.randomAlphanumeric(8));
19+
protected static final Path unittestDirPath = new Path("/unittest-dir" + random.nextInt());
1820
protected final Path testDirPath = new Path(unittestDirPath, "test-dir");
1921
protected final Path testFilePath = new Path(unittestDirPath, "test-file");
2022

@@ -87,7 +89,8 @@ protected Path methodPath() throws IOException {
8789
*/
8890
protected static byte[] getTestData(int size) {
8991
byte[] testData = new byte[size];
90-
System.arraycopy(RandomStringUtils.randomAlphabetic(size).getBytes(), 0, testData, 0, size);
92+
SecureRandom secureRandom = new SecureRandom();
93+
secureRandom.nextBytes(testData); // 生成随机字节
9194
return testData;
9295
}
9396

0 commit comments

Comments
 (0)