LoadBalancingKMSClientProvider extends KeyProvider implements
    CryptoExtension,
    KeyProviderDelegationTokenExtension.DelegationTokenExtension { @VisibleForTesting KMSClientProvider[] getProviders() { return providers; } LoadBalancingKMSClientProvider(KMSClientProvider[] providers,
      Configuration conf); @VisibleForTesting  LoadBalancingKMSClientProvider(KMSClientProvider[] providers, long seed,
      Configuration conf); @Override Token<?>[] addDelegationTokens(final String renewer, final Credentials credentials); @Override void warmUpEncryptedKeys(String... keyNames); @Override void drain(String keyName); @Override EncryptedKeyVersion generateEncryptedKey(final String encryptionKeyName); @Override KeyVersion decryptEncryptedKey(final EncryptedKeyVersion encryptedKeyVersion); @Override KeyVersion getKeyVersion(final String versionName); @Override List<String> getKeys(); @Override Metadata[] getKeysMetadata(final String... names); @Override List<KeyVersion> getKeyVersions(final String name); @Override KeyVersion getCurrentKey(final String name); @Override Metadata getMetadata(final String name); @Override KeyVersion createKey(final String name, final byte[] material,
      final Options options); @Override KeyVersion createKey(final String name, final Options options); @Override void deleteKey(final String name); @Override KeyVersion rollNewVersion(final String name, final byte[] material); @Override KeyVersion rollNewVersion(final String name); @Override void close(); @Override void flush(); static Logger LOG; }
@Test public void testCreation() throws Exception { Configuration conf = new Configuration(); KeyProvider kp = new KMSClientProvider.Factory().createProvider(new URI( "kms: assertTrue(kp instanceof KMSClientProvider); assertEquals("http: ((KMSClientProvider) kp).getKMSUrl()); kp = new KMSClientProvider.Factory().createProvider(new URI( "kms: assertTrue(kp instanceof LoadBalancingKMSClientProvider); KMSClientProvider[] providers = ((LoadBalancingKMSClientProvider) kp).getProviders(); assertEquals(3, providers.length); assertEquals(Sets.newHashSet("http: "http: "http: Sets.newHashSet(providers[0].getKMSUrl(), providers[1].getKMSUrl(), providers[2].getKMSUrl())); kp = new KMSClientProvider.Factory().createProvider(new URI( "kms: assertTrue(kp instanceof LoadBalancingKMSClientProvider); providers = ((LoadBalancingKMSClientProvider) kp).getProviders(); assertEquals(3, providers.length); assertEquals(Sets.newHashSet("http: "http: "http: Sets.newHashSet(providers[0].getKMSUrl(), providers[1].getKMSUrl(), providers[2].getKMSUrl())); }