From 71cfff6aba1552025b411c42f956df597bf808d9 Mon Sep 17 00:00:00 2001 From: David Kocher Date: Thu, 28 Nov 2024 15:09:53 +0100 Subject: [PATCH] Fix tests. --- .../core/s3/RequestEntityRestStorageServiceTest.java | 3 +-- .../ch/cyberduck/core/s3/S3AttributesFinderFeatureTest.java | 4 ++-- .../java/ch/cyberduck/core/s3/S3LocationFeatureTest.java | 5 ++--- .../ch/cyberduck/core/s3/S3PresignedUrlProviderTest.java | 6 +++--- .../test/java/ch/cyberduck/core/s3/S3UrlProviderTest.java | 4 +--- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/s3/src/test/java/ch/cyberduck/core/s3/RequestEntityRestStorageServiceTest.java b/s3/src/test/java/ch/cyberduck/core/s3/RequestEntityRestStorageServiceTest.java index 5b5de11fb54..6af4b6cd9b6 100644 --- a/s3/src/test/java/ch/cyberduck/core/s3/RequestEntityRestStorageServiceTest.java +++ b/s3/src/test/java/ch/cyberduck/core/s3/RequestEntityRestStorageServiceTest.java @@ -22,7 +22,6 @@ import ch.cyberduck.core.TestProtocol; import ch.cyberduck.core.http.HttpConnectionPoolBuilder; import ch.cyberduck.core.proxy.DisabledProxyFinder; -import ch.cyberduck.core.proxy.Proxy; import ch.cyberduck.core.ssl.DefaultX509KeyManager; import ch.cyberduck.core.ssl.DisabledX509TrustManager; import ch.cyberduck.core.ssl.ThreadLocalHostnameDelegatingTrustManager; @@ -76,7 +75,7 @@ public void testSetupConnectionVirtualHost() throws Exception { final String key = new AlphanumericRandomStringService().random(); { final HttpUriRequest request = service.setupConnection("GET", "", key, Collections.emptyMap()); - assertEquals(String.format("https://test-eu-west-3-cyberduck.s3.amazonaws.com:443/%s", key), request.getURI().toString()); + assertEquals(String.format("https://test-eu-central-1-cyberduck.s3.amazonaws.com:443/%s", key), request.getURI().toString()); } } } \ No newline at end of file diff --git a/s3/src/test/java/ch/cyberduck/core/s3/S3AttributesFinderFeatureTest.java b/s3/src/test/java/ch/cyberduck/core/s3/S3AttributesFinderFeatureTest.java index 8af76124510..172e09cbcf6 100644 --- a/s3/src/test/java/ch/cyberduck/core/s3/S3AttributesFinderFeatureTest.java +++ b/s3/src/test/java/ch/cyberduck/core/s3/S3AttributesFinderFeatureTest.java @@ -283,8 +283,8 @@ public void testVirtualHostStyle() throws Exception { @Test(expected = NotfoundException.class) public void testDetermineRegionVirtualHostStyle() throws Exception { - assertEquals("eu-west-3", virtualhost.getClient().getRegionEndpointCache().getRegionForBucketName("")); - assertEquals("eu-west-3", virtualhost.getClient().getRegionEndpointCache().getRegionForBucketName("test-eu-west-3-cyberduck")); + assertEquals("eu-central-1", virtualhost.getClient().getRegionEndpointCache().getRegionForBucketName("")); + assertEquals("eu-central-1", virtualhost.getClient().getRegionEndpointCache().getRegionForBucketName("test-eu-central-1-cyberduck")); final S3AttributesFinderFeature f = new S3AttributesFinderFeature(virtualhost, new S3AccessControlListFeature(virtualhost)); final Path file = new Path(new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)); // No region is cached and must be determined although HEAD request will not allow S3 to return correct region to use in AWS4 signature diff --git a/s3/src/test/java/ch/cyberduck/core/s3/S3LocationFeatureTest.java b/s3/src/test/java/ch/cyberduck/core/s3/S3LocationFeatureTest.java index 81fbcd995ab..19278876493 100644 --- a/s3/src/test/java/ch/cyberduck/core/s3/S3LocationFeatureTest.java +++ b/s3/src/test/java/ch/cyberduck/core/s3/S3LocationFeatureTest.java @@ -34,7 +34,6 @@ import ch.cyberduck.core.features.Location; import ch.cyberduck.core.preferences.PreferencesFactory; import ch.cyberduck.core.proxy.DisabledProxyFinder; -import ch.cyberduck.core.proxy.Proxy; import ch.cyberduck.core.serializer.impl.dd.ProfilePlistReader; import ch.cyberduck.test.IntegrationTest; @@ -141,10 +140,10 @@ public String getProperty(final String key) { @Test public void testAccessBucketNameInHostname() throws Exception { final RegionEndpointCache cache = virtualhost.getClient().getRegionEndpointCache(); - assertEquals(new S3LocationFeature.S3Region("eu-west-3"), new S3LocationFeature(virtualhost, cache).getLocation( + assertEquals(new S3LocationFeature.S3Region("eu-central-1"), new S3LocationFeature(virtualhost, cache).getLocation( new Path("/", EnumSet.of(Path.Type.directory)) )); - assertEquals("eu-west-3", cache.getRegionForBucketName("")); + assertEquals("eu-central-1", cache.getRegionForBucketName("")); } @Test diff --git a/s3/src/test/java/ch/cyberduck/core/s3/S3PresignedUrlProviderTest.java b/s3/src/test/java/ch/cyberduck/core/s3/S3PresignedUrlProviderTest.java index 5ff3e66f6fd..95cd4101c9c 100644 --- a/s3/src/test/java/ch/cyberduck/core/s3/S3PresignedUrlProviderTest.java +++ b/s3/src/test/java/ch/cyberduck/core/s3/S3PresignedUrlProviderTest.java @@ -63,10 +63,10 @@ public void testCreateVirtualHost() throws Exception { final Calendar expiry = Calendar.getInstance(TimeZone.getTimeZone("UTC")); expiry.add(Calendar.MILLISECOND, (int) TimeUnit.DAYS.toMillis(7)); final String url = new S3PresignedUrlProvider(virtualhost).create(System.getProperties().getProperty("s3.secret"), - "test-eu-west-3-cyberduck", "eu-west-3", "f", "GET", expiry.getTimeInMillis()); + "test-eu-central-1-cyberduck", "eu-central-1", "f", "GET", expiry.getTimeInMillis()); assertNotNull(url); - assertEquals("test-eu-west-3-cyberduck.s3.amazonaws.com", URI.create(url).getHost()); - assertTrue(url, url.startsWith("https://test-eu-west-3-cyberduck.s3.amazonaws.com/f")); + assertEquals("test-eu-central-1-cyberduck.s3.amazonaws.com", URI.create(url).getHost()); + assertTrue(url, url.startsWith("https://test-eu-central-1-cyberduck.s3.amazonaws.com/f")); } @Test diff --git a/s3/src/test/java/ch/cyberduck/core/s3/S3UrlProviderTest.java b/s3/src/test/java/ch/cyberduck/core/s3/S3UrlProviderTest.java index ba75d72e12a..19a38363dc9 100644 --- a/s3/src/test/java/ch/cyberduck/core/s3/S3UrlProviderTest.java +++ b/s3/src/test/java/ch/cyberduck/core/s3/S3UrlProviderTest.java @@ -1,6 +1,5 @@ package ch.cyberduck.core.s3; -import ch.cyberduck.core.AbstractPath; import ch.cyberduck.core.Credentials; import ch.cyberduck.core.DescriptiveUrl; import ch.cyberduck.core.DescriptiveUrlBag; @@ -12,7 +11,6 @@ import ch.cyberduck.core.Path; import ch.cyberduck.core.exception.BackgroundException; import ch.cyberduck.core.proxy.DisabledProxyFinder; -import ch.cyberduck.core.proxy.Proxy; import ch.cyberduck.test.IntegrationTest; import org.junit.Test; @@ -181,7 +179,7 @@ public String findLoginPassword(final Host bookmark) { }); final String url = provider.toSignedUrl(new Path("/t", EnumSet.of(Path.Type.file)), 30).getUrl(); assertTrue(url, url.startsWith( - "https://test-eu-west-3-cyberduck.s3.amazonaws.com/t?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=")); + "https://test-eu-central-1-cyberduck.s3.amazonaws.com/t?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=")); } @Test