|
9 | 9 | import ch.cyberduck.core.preferences.Preferences; |
10 | 10 | import ch.cyberduck.core.preferences.PreferencesFactory; |
11 | 11 | import ch.cyberduck.core.profiles.LocalProfilesFinder; |
| 12 | +import ch.cyberduck.core.serviceloader.AnnotationAutoServiceLoader; |
12 | 13 | import ch.cyberduck.core.ssl.DefaultX509KeyManager; |
13 | 14 | import ch.cyberduck.core.ssl.DefaultX509TrustManager; |
14 | 15 | import ch.cyberduck.core.vault.VaultRegistryFactory; |
|
28 | 29 |
|
29 | 30 | import cloud.katta.core.DeviceSetupCallback; |
30 | 31 | import cloud.katta.model.AccountKeyAndDeviceName; |
31 | | -import cloud.katta.protocols.hub.HubProtocol; |
32 | 32 | import cloud.katta.protocols.hub.HubSession; |
33 | 33 | import cloud.katta.protocols.hub.HubUVFVault; |
34 | 34 | import cloud.katta.protocols.hub.HubVaultRegistry; |
35 | | -import cloud.katta.protocols.s3.S3AssumeRoleProtocol; |
36 | 35 |
|
37 | 36 | import static org.junit.jupiter.api.Assertions.assertNotNull; |
38 | 37 | import static org.junit.jupiter.api.Assertions.assertTrue; |
@@ -165,17 +164,10 @@ private static String staticSetupCode() { |
165 | 164 |
|
166 | 165 | protected static HubSession setupConnection(final HubTestConfig.Setup setup) throws Exception { |
167 | 166 | final ProtocolFactory factory = ProtocolFactory.get(); |
168 | | - // ProtocolFactory.get() is static, the profiles contains OAuth token URL, leads to invalid grant exceptions when this changes during class loading lifetime (e.g. if the same storage profile ID is deployed to the LOCAL and the HYBRID hub). |
169 | | - for(final Protocol protocol : factory.find()) { |
170 | | - if(protocol instanceof Profile) { |
171 | | - factory.unregister((Profile) protocol); |
172 | | - } |
173 | | - } |
174 | 167 | // Register parent protocol definitions |
175 | | - factory.register( |
176 | | - new HubProtocol(), |
177 | | - new S3AssumeRoleProtocol("PasswordGrant") |
178 | | - ); |
| 168 | + for(Protocol p : new AnnotationAutoServiceLoader<Protocol>().load(Protocol.class)) { |
| 169 | + factory.register(p); |
| 170 | + } |
179 | 171 | // Load bundled profiles |
180 | 172 | factory.load(new LocalProfilesFinder(factory, new Local(AbstractHubTest.class.getResource("/").toURI().getPath()))); |
181 | 173 | assertNotNull(factory.forName("hub")); |
|
0 commit comments