KeyProviderFactory { public static KeyProvider get(URI uri, Configuration conf) throws IOException { KeyProvider kp = null; for (KeyProviderFactory factory : serviceLoader) { kp = factory.createProvider(uri, conf); if (kp != null) { break; } } return kp; }  abstract KeyProvider createProvider(URI providerName,
                                             Configuration conf
                                             ); static List<KeyProvider> getProviders(Configuration conf
                                               ); static KeyProvider get(URI uri, Configuration conf); static final String KEY_PROVIDER_PATH; }
@Test public void testGetProviderViaURI() throws Exception { Configuration conf = new Configuration(false); final Path jksPath = new Path(testRootDir.toString(), "test.jks"); URI uri = new URI(JavaKeyStoreProvider.SCHEME_NAME + ": KeyProvider kp = KeyProviderFactory.get(uri, conf); Assert.assertNotNull(kp); Assert.assertEquals(JavaKeyStoreProvider.class, kp.getClass()); uri = new URI("foo: kp = KeyProviderFactory.get(uri, conf); Assert.assertNull(kp); }