Skip to content

Commit 1ce9b7a

Browse files
authored
Merge pull request #1927 from aws/salande/revert-test
Revert "Replacing @theory annotated test case to @parameterized test …
2 parents 9bcb446 + 95558d3 commit 1ce9b7a

File tree

2 files changed

+38
-30
lines changed

2 files changed

+38
-30
lines changed

http-clients/aws-crt-client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
<value>false</value>
188188
</property>
189189
</properties>
190-
<threadCount>1</threadCount>
190+
<threadCountClasses>1</threadCountClasses>
191191
</configuration>
192192
<dependencies>
193193
<dependency>

http-clients/aws-crt-client/src/it/java/software/amazon/awssdk/http/crt/AwsCrtClientCallingPatternIntegrationTest.java

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,19 @@
1818
import static software.amazon.awssdk.testutils.service.AwsTestBase.CREDENTIALS_PROVIDER_CHAIN;
1919

2020
import java.util.ArrayList;
21-
import java.util.Arrays;
2221
import java.util.List;
2322
import java.util.concurrent.CompletableFuture;
2423
import java.util.concurrent.CountDownLatch;
2524
import java.util.concurrent.ExecutorService;
2625
import java.util.concurrent.Executors;
2726
import java.util.concurrent.TimeUnit;
2827
import java.util.concurrent.atomic.AtomicBoolean;
29-
import java.util.stream.Stream;
3028
import org.junit.Assert;
31-
import org.junit.jupiter.api.Timeout;
32-
import org.junit.jupiter.params.ParameterizedTest;
33-
import org.junit.jupiter.params.provider.Arguments;
34-
import org.junit.jupiter.params.provider.MethodSource;
29+
import org.junit.experimental.theories.DataPoints;
30+
import org.junit.experimental.theories.FromDataPoints;
31+
import org.junit.experimental.theories.Theories;
32+
import org.junit.experimental.theories.Theory;
33+
import org.junit.runner.RunWith;
3534
import software.amazon.awssdk.crt.CrtResource;
3635
import software.amazon.awssdk.http.SdkHttpConfigurationOption;
3736
import software.amazon.awssdk.http.async.SdkAsyncHttpClient;
@@ -41,9 +40,11 @@
4140
import software.amazon.awssdk.services.kms.model.GenerateRandomResponse;
4241
import software.amazon.awssdk.utils.AttributeMap;
4342

43+
4444
/**
4545
* Test many possible different calling patterns that users might do, and make sure everything works.
4646
*/
47+
@RunWith(Theories.class)
4748
public class AwsCrtClientCallingPatternIntegrationTest {
4849
private final static String KEY_ALIAS = "alias/aws-sdk-java-v2-integ-test";
4950
private final static Region REGION = Region.US_EAST_1;
@@ -108,31 +109,38 @@ private boolean testWithNewClient(int eventLoopSize, int numberOfRequests) {
108109
}
109110
}
110111

111-
static Integer[] eventLoopValues = {1, 4};
112-
/* Don't use 1 connection Pool of size 1, otherwise test takes too long */
113-
static Integer[] connectionsValues = {10, 100};
114-
static Integer[] requestValues = {1, 25, 250};
115-
static Integer[] parallelClientValues = {1, 2, 8};
116-
static Boolean[] sharedClientValue = {true, false};
117-
118-
private static Stream<Arguments> permutationsOfCrtCallParameters() {
119-
return Arrays.stream(eventLoopValues).flatMap(
120-
eventLoops -> Arrays.stream(connectionsValues).flatMap(
121-
connections -> Arrays.stream(requestValues).flatMap(
122-
requests -> Arrays.stream(parallelClientValues).flatMap(
123-
parallelClients -> Arrays.stream(sharedClientValue).map(
124-
sharedClients -> Arguments.of(eventLoops, connections, requests, parallelClients, sharedClients))))));
112+
@DataPoints("EventLoop")
113+
public static int[] eventLoopValues(){
114+
return new int[]{1, 4};
115+
}
116+
117+
@DataPoints("ConnectionPool")
118+
public static int[] connectionsValues(){
119+
/* Don't use 1 connection Pool of size 1, otherwise test takes too long */
120+
return new int[]{10, 100};
121+
}
122+
123+
@DataPoints("NumRequests")
124+
public static int[] requestValues(){
125+
return new int[]{1, 25, 250};
126+
}
127+
128+
@DataPoints("ParallelClients")
129+
public static int[] parallelClientValues(){
130+
return new int[]{1, 2, 8};
131+
}
132+
133+
@DataPoints("SharedClient")
134+
public static boolean[] sharedClientValue(){
135+
return new boolean[]{true, false};
125136
}
126137

127-
// Timeout set to 4 times of Avg execution of this test 4*150
128-
@Timeout(600)
129-
@ParameterizedTest
130-
@MethodSource("permutationsOfCrtCallParameters")
131-
public void checkAllCombinations(int eventLoopSize,
132-
int connectionPoolSize,
133-
int numberOfRequests,
134-
int numberOfParallelClients,
135-
boolean useSharedClient) {
138+
@Theory
139+
public void checkAllCombinations(@FromDataPoints("EventLoop") int eventLoopSize,
140+
@FromDataPoints("ConnectionPool") int connectionPoolSize,
141+
@FromDataPoints("NumRequests") int numberOfRequests,
142+
@FromDataPoints("ParallelClients") int numberOfParallelClients,
143+
@FromDataPoints("SharedClient") boolean useSharedClient) throws Exception {
136144

137145
try {
138146

0 commit comments

Comments
 (0)