Skip to content

Commit

Permalink
[#11440] Bump commons-lang3 from 3.16.0 to 3.17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
emeroad committed Aug 30, 2024
1 parent cd771f4 commit d6f03e6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ public TSpan randomTSpan() {
tSpan.setParentSpanId(random.nextInt(0, 100000));
tSpan.setStartTime(System.currentTimeMillis() + random.nextInt(0, 1000));
tSpan.setElapsed(random.nextInt(0, 2000));
tSpan.setRpc(RandomStringUtils.random(10));
tSpan.setRpc(randomAlphanumeric(10));

tSpan.setServiceType(randomServerServiceType());
tSpan.setEndPoint(RandomStringUtils.random(20));
tSpan.setRemoteAddr(RandomStringUtils.random(20));
tSpan.setEndPoint(randomAlphanumeric(20));
tSpan.setRemoteAddr(randomAlphanumeric(20));

List<TAnnotation> tAnnotationList = randomTAnnotationList();
if (CollectionUtils.isNotEmpty(tAnnotationList)) {
Expand All @@ -73,7 +73,7 @@ public TSpan randomTSpan() {
if (random.nextBoolean()) {
TIntStringValue exceptionInfo = new TIntStringValue();
exceptionInfo.setIntValue(random.nextInt(0, 5000));
exceptionInfo.setStringValue(RandomStringUtils.random(100));
exceptionInfo.setStringValue(randomAlphanumeric(100));
tSpan.setExceptionInfo(exceptionInfo);
}
tSpan.setLoggingTransactionInfo((byte) random.nextInt(0, 256));
Expand All @@ -99,7 +99,7 @@ public TAnnotation randomTAnnotation(int key) {
// sort order
tAnnotation.setKey(key);
TAnnotationValue tAnnotationValue = new TAnnotationValue();
tAnnotationValue.setStringValue(RandomStringUtils.random(10));
tAnnotationValue.setStringValue(randomAlphanumeric(10));
tAnnotation.setValue(tAnnotationValue);
return tAnnotation;
}
Expand All @@ -111,10 +111,10 @@ public TSpanEvent randomTSpanEvent(short sequence) {
tSpanEvent.setSequence(sequence);
tSpanEvent.setStartElapsed(random.nextInt(0, 1000));
tSpanEvent.setEndElapsed(random.nextInt(0, 1000));
// tSpanEvent.setRpc(RandomStringUtils.random(10));
// tSpanEvent.setRpc(randomAlphanumeric(10));
// Database (2000 ~ 2899)
tSpanEvent.setServiceType((short) random.nextInt(2000, 2889));
tSpanEvent.setEndPoint(RandomStringUtils.random(10));
tSpanEvent.setEndPoint(randomAlphanumeric(10));

List<TAnnotation> tAnnotationList = randomTAnnotationList();
if (CollectionUtils.isNotEmpty(tAnnotationList)) {
Expand All @@ -123,15 +123,15 @@ public TSpanEvent randomTSpanEvent(short sequence) {
tSpanEvent.setDepth(random.nextInt(0, 256));
tSpanEvent.setNextSpanId(random.nextLong());

tSpanEvent.setDestinationId(RandomStringUtils.random(20));
tSpanEvent.setDestinationId(randomAlphanumeric(20));
tSpanEvent.setApiId(random.nextInt(0, 65535));

tSpanEvent.setNextAsyncId(random.nextInt());

if (random.nextBoolean()) {
TIntStringValue exceptionInfo = new TIntStringValue();
exceptionInfo.setIntValue(random.nextInt(0, 5000));
exceptionInfo.setStringValue(RandomStringUtils.random(100));
exceptionInfo.setStringValue(randomAlphanumeric(100));
tSpanEvent.setExceptionInfo(exceptionInfo);
}

Expand All @@ -154,10 +154,15 @@ public TSpanChunk randomTSpanChunk() {
tSpanChunk.setTransactionId(TransactionIdUtils.formatByteBuffer("agent", System.currentTimeMillis(), random.nextLong(0, Long.MAX_VALUE)));
tSpanChunk.setSpanId(random.nextLong());

tSpanChunk.setEndPoint(RandomStringUtils.random(20));
tSpanChunk.setEndPoint(randomAlphanumeric(20));

// tSpanChunk.setSpanEventList()
tSpanChunk.setApplicationServiceType(randomServerServiceType());
return tSpanChunk;
}


private String randomAlphanumeric(int count) {
return RandomStringUtils.insecure().nextAlphabetic(count);
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.16.0</version>
<version>3.17.0</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public class UdpDataSenderTest {
private final int PORT = SocketUtils.findAvailableUdpPort(9009);

private final BiPredicate<byte[], TBase<?, ?>> maxBytesLengthPredicate = new MaxBytesLengthPredicate<>(logger, ThriftUdpMessageSerializer.UDP_MAX_PACKET_LENGTH);
RandomStringUtils randomString = RandomStringUtils.insecure();

@BeforeAll
public static void before() {
Expand Down Expand Up @@ -105,7 +106,7 @@ public void sendAndFlushCheck() {

@Test
public void sendExceedData() throws InterruptedException {
String random = RandomStringUtils.randomAlphabetic(ThriftUdpMessageSerializer.UDP_MAX_PACKET_LENGTH + 100);
String random = randomAlphabetic(ThriftUdpMessageSerializer.UDP_MAX_PACKET_LENGTH + 100);
TAgentInfo agentInfo = new TAgentInfo();
agentInfo.setAgentId(random);
boolean limit = sendMessage_getLimit(agentInfo, 1000);
Expand All @@ -116,7 +117,7 @@ public void sendExceedData() throws InterruptedException {

@Test
public void sendData() throws InterruptedException {
String random = RandomStringUtils.randomAlphabetic(100);
String random = randomAlphabetic(100);
TAgentInfo agentInfo = new TAgentInfo();
agentInfo.setAgentId(random);
boolean limit = sendMessage_getLimit(agentInfo, 1000);
Expand All @@ -125,6 +126,10 @@ public void sendData() throws InterruptedException {
Assertions.assertFalse(limit);
}

private String randomAlphabetic(int count) {
return randomString.nextAlphabetic(count);
}


private boolean sendMessage_getLimit(TBase<?, ?> tbase, long waitTimeMillis) throws InterruptedException {
final AtomicBoolean limitCounter = new AtomicBoolean(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ private static SpanBo createSpanBo(String applicationId) {
}

private static TransactionId createTransactionId() {
String agentId = RandomStringUtils.randomAlphanumeric(4, 24);
String agentId = RandomStringUtils.insecure().nextAlphanumeric(4, 24);

long boundAgentStartTime = System.currentTimeMillis();
long originAgentStartTime = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(30);
Expand Down

0 comments on commit d6f03e6

Please sign in to comment.