|
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; |
22 | 21 | import java.util.List;
|
23 | 22 | import java.util.concurrent.CompletableFuture;
|
24 | 23 | import java.util.concurrent.CountDownLatch;
|
25 | 24 | import java.util.concurrent.ExecutorService;
|
26 | 25 | import java.util.concurrent.Executors;
|
27 | 26 | import java.util.concurrent.TimeUnit;
|
28 | 27 | import java.util.concurrent.atomic.AtomicBoolean;
|
29 |
| -import java.util.stream.Stream; |
30 | 28 | 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; |
35 | 34 | import software.amazon.awssdk.crt.CrtResource;
|
36 | 35 | import software.amazon.awssdk.http.SdkHttpConfigurationOption;
|
37 | 36 | import software.amazon.awssdk.http.async.SdkAsyncHttpClient;
|
|
41 | 40 | import software.amazon.awssdk.services.kms.model.GenerateRandomResponse;
|
42 | 41 | import software.amazon.awssdk.utils.AttributeMap;
|
43 | 42 |
|
| 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) |
47 | 48 | public class AwsCrtClientCallingPatternIntegrationTest {
|
48 | 49 | private final static String KEY_ALIAS = "alias/aws-sdk-java-v2-integ-test";
|
49 | 50 | private final static Region REGION = Region.US_EAST_1;
|
@@ -108,31 +109,38 @@ private boolean testWithNewClient(int eventLoopSize, int numberOfRequests) {
|
108 | 109 | }
|
109 | 110 | }
|
110 | 111 |
|
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}; |
125 | 136 | }
|
126 | 137 |
|
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 { |
136 | 144 |
|
137 | 145 | try {
|
138 | 146 |
|
|
0 commit comments