2525import java .nio .file .Files ;
2626import java .nio .file .Path ;
2727import java .nio .file .StandardOpenOption ;
28- import java .security .Key ;
2928import java .security .KeyPair ;
3029import java .security .KeyPairGenerator ;
3130import java .security .PrivateKey ;
5150import software .amazon .awssdk .http .SdkHttpClient ;
5251import software .amazon .awssdk .http .SdkHttpMethod ;
5352import software .amazon .awssdk .http .SdkHttpRequest ;
54- import software .amazon .awssdk .http .apache . ApacheHttpClient ;
53+ import software .amazon .awssdk .http .apache5 . Apache5HttpClient ;
5554import software .amazon .awssdk .services .cloudfront .cookie .CookiesForCannedPolicy ;
5655import software .amazon .awssdk .services .cloudfront .cookie .CookiesForCustomPolicy ;
5756import software .amazon .awssdk .services .cloudfront .internal .utils .SigningUtils ;
@@ -144,7 +143,7 @@ static Stream<KeyTestCase> keyCases() throws Exception {
144143
145144 @ Test
146145 void unsignedUrl_shouldReturn403Response () throws Exception {
147- SdkHttpClient client = ApacheHttpClient .create ();
146+ SdkHttpClient client = Apache5HttpClient .create ();
148147 HttpExecuteResponse response =
149148 client .prepareRequest (HttpExecuteRequest .builder ()
150149 .request (SdkHttpRequest .builder ()
@@ -169,7 +168,7 @@ void getSignedUrlWithCannedPolicy_producesValidUrl(KeyTestCase testCase) throws
169168 .keyPairId (testCase .keyPairId )
170169 .expirationDate (expirationDate ).build ();
171170 SignedUrl signedUrl = cloudFrontUtilities .getSignedUrlWithCannedPolicy (request );
172- SdkHttpClient client = ApacheHttpClient .create ();
171+ SdkHttpClient client = Apache5HttpClient .create ();
173172 HttpExecuteResponse response = client .prepareRequest (HttpExecuteRequest .builder ()
174173 .request (signedUrl .createHttpGetRequest ())
175174 .build ()).call ();
@@ -188,7 +187,7 @@ void getSignedUrlWithCannedPolicy_withExpiredDate_shouldReturn403Response(KeyTes
188187 .privateKey (testCase .privateKey )
189188 .keyPairId (testCase .keyPairId )
190189 .expirationDate (expirationDate ));
191- SdkHttpClient client = ApacheHttpClient .create ();
190+ SdkHttpClient client = Apache5HttpClient .create ();
192191 HttpExecuteResponse response = client .prepareRequest (HttpExecuteRequest .builder ()
193192 .request (signedUrl .createHttpGetRequest ())
194193 .build ()).call ();
@@ -209,7 +208,7 @@ void getSignedUrlWithCustomPolicy_producesValidUrl(KeyTestCase testCase) throws
209208 .expirationDate (expirationDate )
210209 .activeDate (activeDate ).build ();
211210 SignedUrl signedUrl = cloudFrontUtilities .getSignedUrlWithCustomPolicy (request );
212- SdkHttpClient client = ApacheHttpClient .create ();
211+ SdkHttpClient client = Apache5HttpClient .create ();
213212 HttpExecuteResponse response = client .prepareRequest (HttpExecuteRequest .builder ()
214213 .request (signedUrl .createHttpGetRequest ())
215214 .build ()).call ();
@@ -229,7 +228,7 @@ void getSignedUrlWithCustomPolicy_withFutureActiveDate_shouldReturn403Response()
229228 .keyPairId (rsaKeyPairId )
230229 .expirationDate (expirationDate )
231230 .activeDate (activeDate ));
232- SdkHttpClient client = ApacheHttpClient .create ();
231+ SdkHttpClient client = Apache5HttpClient .create ();
233232 HttpExecuteResponse response = client .prepareRequest (HttpExecuteRequest .builder ()
234233 .request (signedUrl .createHttpGetRequest ())
235234 .build ()).call ();
@@ -247,7 +246,7 @@ void getCookiesForCannedPolicy_producesValidCookies(KeyTestCase testCase) throws
247246 .keyPairId (testCase .keyPairId )
248247 .expirationDate (expirationDate ));
249248
250- SdkHttpClient client = ApacheHttpClient .create ();
249+ SdkHttpClient client = Apache5HttpClient .create ();
251250 HttpExecuteResponse response = client .prepareRequest (HttpExecuteRequest .builder ()
252251 .request (cookies .createHttpGetRequest ())
253252 .build ()).call ();
@@ -268,7 +267,7 @@ void getCookiesForCannedPolicy_withExpiredDate_shouldReturn403Response() throws
268267 .expirationDate (expirationDate ).build ();
269268 CookiesForCannedPolicy cookies = cloudFrontUtilities .getCookiesForCannedPolicy (request );
270269
271- SdkHttpClient client = ApacheHttpClient .create ();
270+ SdkHttpClient client = Apache5HttpClient .create ();
272271 HttpExecuteResponse response = client .prepareRequest (HttpExecuteRequest .builder ()
273272 .request (cookies .createHttpGetRequest ())
274273 .build ()).call ();
@@ -288,7 +287,7 @@ void getCookiesForCustomPolicy_producesValidCookies(KeyTestCase testCase) throws
288287 .expirationDate (expirationDate )
289288 .activeDate (activeDate ));
290289
291- SdkHttpClient client = ApacheHttpClient .create ();
290+ SdkHttpClient client = Apache5HttpClient .create ();
292291 HttpExecuteResponse response = client .prepareRequest (HttpExecuteRequest .builder ()
293292 .request (cookies .createHttpGetRequest ())
294293 .build ()).call ();
@@ -311,7 +310,7 @@ void getCookiesForCustomPolicy_withFutureActiveDate_shouldReturn403Response() th
311310 .activeDate (activeDate ).build ();
312311 CookiesForCustomPolicy cookies = cloudFrontUtilities .getCookiesForCustomPolicy (request );
313312
314- SdkHttpClient client = ApacheHttpClient .create ();
313+ SdkHttpClient client = Apache5HttpClient .create ();
315314 HttpExecuteResponse response = client .prepareRequest (HttpExecuteRequest .builder ()
316315 .request (cookies .createHttpGetRequest ())
317316 .build ()).call ();
@@ -345,7 +344,7 @@ void getSignedUrlWithCustomPolicy_shouldAllowQueryParametersWhenUsingWildcard(Ke
345344 URI modifiedUri = URI .create (urlWithDynamicParam );
346345
347346
348- SdkHttpClient client = ApacheHttpClient .create ();
347+ SdkHttpClient client = Apache5HttpClient .create ();
349348 HttpExecuteResponse response = client .prepareRequest (HttpExecuteRequest .builder ()
350349 .request (SdkHttpRequest .builder ()
351350 .encodedPath (modifiedUri .getRawPath () + "?" + modifiedUri .getRawQuery ())
@@ -382,7 +381,7 @@ void getSignedUrlWithCustomPolicy_wildCardPath(KeyTestCase testCase) throws Exce
382381
383382
384383 URI modifiedUri = URI .create (signedUrl .url ().replace ("/specific-file" ,"/other-file" ));
385- SdkHttpClient client = ApacheHttpClient .create ();
384+ SdkHttpClient client = Apache5HttpClient .create ();
386385 HttpExecuteResponse response = client .prepareRequest (HttpExecuteRequest .builder ()
387386 .request (SdkHttpRequest .builder ()
388387 .encodedPath (modifiedUri .getRawPath () + "?" + modifiedUri .getRawQuery ())
@@ -418,7 +417,7 @@ void getSignedUrlWithCustomPolicy_wildCardPolicyResource_allowsAnyPath(KeyTestCa
418417
419418
420419 URI modifiedUri = URI .create (signedUrl .url ().replace ("/s3ObjectKey" ,"/foo/other-file" ));
421- SdkHttpClient client = ApacheHttpClient .create ();
420+ SdkHttpClient client = Apache5HttpClient .create ();
422421 HttpExecuteResponse response = client .prepareRequest (HttpExecuteRequest .builder ()
423422 .request (SdkHttpRequest .builder ()
424423 .encodedPath (modifiedUri .getRawPath () + "?" + modifiedUri .getRawQuery ())
0 commit comments