|
@@ -25,6 +25,7 @@ import java.io.PrintWriter;
|
|
|
import java.io.RandomAccessFile;
|
|
|
import java.io.StringReader;
|
|
|
import java.io.StringWriter;
|
|
|
+import java.net.URI;
|
|
|
import java.security.PrivilegedExceptionAction;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
@@ -125,7 +126,7 @@ public class TestEncryptionZones {
|
|
|
// Set up java key store
|
|
|
String testRoot = fsHelper.getTestRootDir();
|
|
|
testRootDir = new File(testRoot).getAbsoluteFile();
|
|
|
- conf.set(KeyProviderFactory.KEY_PROVIDER_PATH, getKeyProviderURI());
|
|
|
+ conf.set(DFSConfigKeys.DFS_ENCRYPTION_KEY_PROVIDER_URI, getKeyProviderURI());
|
|
|
conf.setBoolean(DFSConfigKeys.DFS_NAMENODE_DELEGATION_TOKEN_ALWAYS_USE_KEY, true);
|
|
|
// Lower the batch size for testing
|
|
|
conf.setInt(DFSConfigKeys.DFS_NAMENODE_LIST_ENCRYPTION_ZONES_NUM_RESPONSES,
|
|
@@ -670,7 +671,8 @@ public class TestEncryptionZones {
|
|
|
// Check KeyProvider state
|
|
|
// Flushing the KP on the NN, since it caches, and init a test one
|
|
|
cluster.getNamesystem().getProvider().flush();
|
|
|
- KeyProvider provider = KeyProviderFactory.getProviders(conf).get(0);
|
|
|
+ KeyProvider provider = KeyProviderFactory
|
|
|
+ .get(new URI(conf.get(DFSConfigKeys.DFS_ENCRYPTION_KEY_PROVIDER_URI)), conf);
|
|
|
List<String> keys = provider.getKeys();
|
|
|
assertEquals("Expected NN to have created one key per zone", 1,
|
|
|
keys.size());
|
|
@@ -694,7 +696,7 @@ public class TestEncryptionZones {
|
|
|
public void testCreateEZWithNoProvider() throws Exception {
|
|
|
// Unset the key provider and make sure EZ ops don't work
|
|
|
final Configuration clusterConf = cluster.getConfiguration(0);
|
|
|
- clusterConf.set(KeyProviderFactory.KEY_PROVIDER_PATH, "");
|
|
|
+ clusterConf.unset(DFSConfigKeys.DFS_ENCRYPTION_KEY_PROVIDER_URI);
|
|
|
cluster.restartNameNode(true);
|
|
|
cluster.waitActive();
|
|
|
final Path zone1 = new Path("/zone1");
|
|
@@ -706,7 +708,7 @@ public class TestEncryptionZones {
|
|
|
assertExceptionContains("since no key provider is available", e);
|
|
|
}
|
|
|
final Path jksPath = new Path(testRootDir.toString(), "test.jks");
|
|
|
- clusterConf.set(KeyProviderFactory.KEY_PROVIDER_PATH,
|
|
|
+ clusterConf.set(DFSConfigKeys.DFS_ENCRYPTION_KEY_PROVIDER_URI,
|
|
|
JavaKeyStoreProvider.SCHEME_NAME + "://file" + jksPath.toUri()
|
|
|
);
|
|
|
// Try listing EZs as well
|