|
18 | 18 | import static software.amazon.awssdk.testutils.service.AwsTestBase.CREDENTIALS_PROVIDER_CHAIN;
|
19 | 19 |
|
20 | 20 | import java.util.ArrayList;
|
| 21 | +import java.util.Arrays; |
21 | 22 | import java.util.List;
|
22 | 23 | import java.util.concurrent.CompletableFuture;
|
23 | 24 | import java.util.concurrent.CountDownLatch;
|
24 | 25 | import java.util.concurrent.ExecutorService;
|
25 | 26 | import java.util.concurrent.Executors;
|
26 | 27 | import java.util.concurrent.TimeUnit;
|
27 | 28 | import java.util.concurrent.atomic.AtomicBoolean;
|
| 29 | +import java.util.stream.Stream; |
28 | 30 | import org.junit.Assert;
|
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; |
| 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; |
34 | 35 | import software.amazon.awssdk.crt.CrtResource;
|
35 | 36 | import software.amazon.awssdk.http.SdkHttpConfigurationOption;
|
36 | 37 | import software.amazon.awssdk.http.async.SdkAsyncHttpClient;
|
|
40 | 41 | import software.amazon.awssdk.services.kms.model.GenerateRandomResponse;
|
41 | 42 | import software.amazon.awssdk.utils.AttributeMap;
|
42 | 43 |
|
43 |
| - |
44 | 44 | /**
|
45 | 45 | * Test many possible different calling patterns that users might do, and make sure everything works.
|
46 | 46 | */
|
47 |
| -@RunWith(Theories.class) |
48 | 47 | public class AwsCrtClientCallingPatternIntegrationTest {
|
49 | 48 | private final static String KEY_ALIAS = "alias/aws-sdk-java-v2-integ-test";
|
50 | 49 | private final static Region REGION = Region.US_EAST_1;
|
@@ -109,38 +108,31 @@ private boolean testWithNewClient(int eventLoopSize, int numberOfRequests) {
|
109 | 108 | }
|
110 | 109 | }
|
111 | 110 |
|
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}; |
| 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)))))); |
136 | 125 | }
|
137 | 126 |
|
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 { |
| 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) { |
144 | 136 |
|
145 | 137 | try {
|
146 | 138 |
|
|
0 commit comments