Skip to content

Commit 3d95c5d

Browse files
authored
Merge branch 'master' into enable-new-security
2 parents a8d6764 + b3c6ca5 commit 3d95c5d

17 files changed

Lines changed: 802 additions & 25 deletions

File tree

client-java/controller/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,12 @@
204204
<artifactId>lettuce-core</artifactId>
205205
<scope>test</scope>
206206
</dependency>
207+
<!-- Bringing Netty dependency explicitly as it was excluded from spring-boot-starter-data-redis to avoid version conflict -->
208+
<dependency>
209+
<groupId>software.amazon.awssdk</groupId>
210+
<artifactId>netty-nio-client</artifactId>
211+
<scope>test</scope>
212+
</dependency>
207213

208214
<!--gRPC RPC test-->
209215
<dependency>

client-java/instrumentation-shared/src/main/java/org/evomaster/client/java/instrumentation/shared/ReplacementCategory.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ public enum ReplacementCategory {
5050
/**
5151
* Replacements to handle NEO4J command interceptions
5252
*/
53-
NEO4J
53+
NEO4J,
54+
55+
/**
56+
* Replacements to handle DYNAMODB command interceptions
57+
*/
58+
DYNAMODB
5459
}
5560

client-java/instrumentation/pom.xml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
<packaging>jar</packaging>
1313
<name>${project.groupId}:${project.artifactId}</name>
1414

15-
1615
<dependencies>
1716
<dependency>
1817
<groupId>org.evomaster</groupId>
@@ -72,6 +71,13 @@
7271
<groupId>org.springframework.boot</groupId>
7372
<artifactId>spring-boot-starter-data-redis</artifactId>
7473
<version>${springboot.version}</version>
74+
<!-- Need to exclude Netty from this package to avoid a clash of versions with AWS SDK -->
75+
<exclusions>
76+
<exclusion>
77+
<groupId>io.netty</groupId>
78+
<artifactId>*</artifactId>
79+
</exclusion>
80+
</exclusions>
7581
<scope>test</scope>
7682
</dependency>
7783
<!-- <dependency>-->
@@ -87,6 +93,17 @@
8793
<groupId>org.mockito</groupId>
8894
<artifactId>mockito-core</artifactId>
8995
</dependency>
96+
<!-- DynamoDB, need to bring Netty explicitly to avoid conflicts from the version coming from Lettuce -->
97+
<dependency>
98+
<groupId>software.amazon.awssdk</groupId>
99+
<artifactId>dynamodb</artifactId>
100+
<scope>test</scope>
101+
</dependency>
102+
<dependency>
103+
<groupId>software.amazon.awssdk</groupId>
104+
<artifactId>netty-nio-client</artifactId>
105+
<scope>test</scope>
106+
</dependency>
90107

91108
<!-- Dependencies for Java Regex distances -->
92109
<dependency>

client-java/instrumentation/src/main/java/org/evomaster/client/java/instrumentation/AdditionalInfo.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ public StatementDescription(String line, String method) {
112112

113113
private final Set<RedisCommand> redisCommandData = new CopyOnWriteArraySet<>();
114114

115+
private final Set<DynamoDbCommand> dynamoDbInfoData = new CopyOnWriteArraySet<>();
116+
115117
private final Set<MongoCollectionSchema> mongoCollectionSchemaData = new CopyOnWriteArraySet<>();
116118

117119
public Set<ExecutedSqlCommand> getSqlInfoData(){
@@ -134,6 +136,10 @@ public Set<RedisCommand> getRedisCommandData(){
134136
return Collections.unmodifiableSet(redisCommandData);
135137
}
136138

139+
public Set<DynamoDbCommand> getDynamoDbInfoData(){
140+
return Collections.unmodifiableSet(dynamoDbInfoData);
141+
}
142+
137143
public Set<MongoCollectionSchema> getMongoCollectionTypeData(){
138144
return Collections.unmodifiableSet(mongoCollectionSchemaData);
139145
}
@@ -158,6 +164,10 @@ public void addRedisCommand(RedisCommand info){
158164
redisCommandData.add(info);
159165
}
160166

167+
public void addDynamoDbInfo(DynamoDbCommand info){
168+
dynamoDbInfoData.add(info);
169+
}
170+
161171
public void addMongoCollectionType(MongoCollectionSchema mongoCollectionSchema){
162172
mongoCollectionSchemaData.add(mongoCollectionSchema);
163173
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package org.evomaster.client.java.instrumentation;
2+
3+
import java.io.Serializable;
4+
import java.util.ArrayList;
5+
import java.util.Collections;
6+
import java.util.List;
7+
8+
/**
9+
* Info related to DynamoDB command execution.
10+
*/
11+
public class DynamoDbCommand implements Serializable {
12+
13+
14+
/**
15+
* Names of the tables the operation was applied to (with Batch operations, more than one table is possible)
16+
*/
17+
private final List<String> tableNames;
18+
/**
19+
* Name of the operation that was executed
20+
*/
21+
private final String operationName;
22+
/**
23+
* Actual executed operation
24+
*/
25+
private final Object request;
26+
/**
27+
* If the operation was successfully executed
28+
*/
29+
private final boolean successfullyExecuted;
30+
/**
31+
* Elapsed execution time
32+
*/
33+
private final long executionTime;
34+
35+
public DynamoDbCommand(List<String> tableNames, String operationName, Object request, boolean successfullyExecuted, long executionTime) {
36+
this.tableNames = tableNames == null
37+
? Collections.emptyList()
38+
: Collections.unmodifiableList(new ArrayList<>(tableNames));
39+
this.operationName = operationName;
40+
this.request = request;
41+
this.successfullyExecuted = successfullyExecuted;
42+
this.executionTime = executionTime;
43+
}
44+
45+
public List<String> getTableNames() {
46+
return tableNames;
47+
}
48+
49+
public String getOperationName() {
50+
return operationName;
51+
}
52+
53+
public Object getRequest() {
54+
return request;
55+
}
56+
57+
public boolean isSuccessfullyExecuted() {
58+
return successfullyExecuted;
59+
}
60+
61+
public long getExecutionTime() {
62+
return executionTime;
63+
}
64+
}

client-java/instrumentation/src/main/java/org/evomaster/client/java/instrumentation/coverage/methodreplacement/ReplacementList.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public static List<MethodReplacementClass> getList() {
3636
new DateFormatClassReplacement(),
3737
new DocumentClassReplacement(),
3838
new DoubleClassReplacement(),
39+
new DynamoDbClassReplacement.Sync(),
40+
new DynamoDbClassReplacement.Async(),
3941
new EnumClassReplacement(),
4042
new FloatClassReplacement(),
4143
new GsonClassReplacement(),

0 commit comments

Comments
 (0)