66import ch .cyberduck .core .DisabledCancelCallback ;
77import ch .cyberduck .core .DisabledHostKeyCallback ;
88import ch .cyberduck .core .DisabledLoginCallback ;
9- import ch .cyberduck .core .DisabledPasswordStore ;
109import ch .cyberduck .core .Host ;
1110import ch .cyberduck .core .Path ;
1211import ch .cyberduck .core .exception .BackgroundException ;
@@ -45,12 +44,7 @@ public RequestEntityRestStorageService getClient() {
4544 }
4645 };
4746 Path p = new Path ("/bucket/f/key f" , EnumSet .of (Path .Type .file ));
48- assertEquals (5 , new S3UrlProvider (session , Collections .emptyMap (), new DisabledPasswordStore () {
49- @ Override
50- public String findLoginPassword (final Host bookmark ) {
51- return "k" ;
52- }
53- }).toUrl (p ).filter (DescriptiveUrl .Type .signed ).size ());
47+ assertEquals (5 , new S3UrlProvider (session , Collections .emptyMap ()).toUrl (p ).filter (DescriptiveUrl .Type .signed ).size ());
5448 }
5549
5650 @ Test
@@ -122,12 +116,7 @@ public RequestEntityRestStorageService getClient() {
122116 }
123117 };
124118 assertEquals (DescriptiveUrl .EMPTY ,
125- new S3UrlProvider (session , Collections .emptyMap (), new DisabledPasswordStore () {
126- @ Override
127- public String findLoginPassword (final Host bookmark ) {
128- return "k" ;
129- }
130- }).toUrl (new Path ("/test-eu-west-1-cyberduck/test f" , EnumSet .of (Path .Type .file ))).find (DescriptiveUrl .Type .signed )
119+ new S3UrlProvider (session , Collections .emptyMap ()).toUrl (new Path ("/test-eu-west-1-cyberduck/test f" , EnumSet .of (Path .Type .file ))).find (DescriptiveUrl .Type .signed )
131120 );
132121 }
133122
@@ -146,37 +135,22 @@ public RequestEntityRestStorageService getClient() {
146135 }
147136 }
148137 };
149- final S3UrlProvider provider = new S3UrlProvider (session , Collections .emptyMap (), new DisabledPasswordStore () {
150- @ Override
151- public String findLoginPassword (final Host bookmark ) {
152- return "k" ;
153- }
154- });
138+ final S3UrlProvider provider = new S3UrlProvider (session , Collections .emptyMap ());
155139 assertNotNull (
156140 provider .toUrl (new Path ("/test-eu-west-1-cyberduck/test" , EnumSet .of (Path .Type .file ))).find (DescriptiveUrl .Type .signed )
157141 );
158142 }
159143
160144 @ Test
161145 public void testToSignedUrl () {
162- final S3UrlProvider provider = new S3UrlProvider (session , Collections .emptyMap (), new DisabledPasswordStore () {
163- @ Override
164- public String findLoginPassword (final Host bookmark ) {
165- return "k" ;
166- }
167- });
146+ final S3UrlProvider provider = new S3UrlProvider (session , Collections .emptyMap ());
168147 assertTrue (provider .toSignedUrl (new Path ("/test-eu-west-1-cyberduck/test" , EnumSet .of (Path .Type .file )), 30 ).getUrl ().startsWith (
169148 "https://test-eu-west-1-cyberduck.s3.amazonaws.com/test?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=" ));
170149 }
171150
172151 @ Test
173152 public void testToSignedUrlVirtualHost () {
174- final S3UrlProvider provider = new S3UrlProvider (virtualhost , Collections .emptyMap (), new DisabledPasswordStore () {
175- @ Override
176- public String findLoginPassword (final Host bookmark ) {
177- return "k" ;
178- }
179- });
153+ final S3UrlProvider provider = new S3UrlProvider (virtualhost , Collections .emptyMap ());
180154 final String url = provider .toSignedUrl (new Path ("/t" , EnumSet .of (Path .Type .file )), 30 ).getUrl ();
181155 assertTrue (url , url .startsWith (
182156 "https://test-eu-central-1-cyberduck.s3.amazonaws.com/t?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=" ));
0 commit comments