HDFS-13932. [JDK 11] Casts to BlockStoragePolicy[] in unit tests raise ClassCastExceptions. Contributed by Andrew Purtell.
This commit is contained in:
parent
6b988d821e
commit
f9c0221623
@ -38,7 +38,6 @@
|
||||
import org.apache.hadoop.hdfs.DFSConfigKeys;
|
||||
import org.apache.hadoop.hdfs.DFSTestUtil;
|
||||
import org.apache.hadoop.hdfs.DistributedFileSystem;
|
||||
import org.apache.hadoop.hdfs.protocol.BlockStoragePolicy;
|
||||
import org.apache.hadoop.hdfs.protocol.HdfsConstants;
|
||||
import org.apache.hadoop.hdfs.protocol.SnapshotException;
|
||||
import org.apache.hadoop.hdfs.web.WebHdfsFileSystem;
|
||||
@ -1029,13 +1028,9 @@ private void testStoragePolicy() throws Exception {
|
||||
Path path = new Path(getProxiedFSTestDir(), "policy.txt");
|
||||
FileSystem httpfs = getHttpFSFileSystem();
|
||||
// test getAllStoragePolicies
|
||||
BlockStoragePolicy[] dfsPolicies = (BlockStoragePolicy[]) fs
|
||||
.getAllStoragePolicies().toArray();
|
||||
BlockStoragePolicy[] httpPolicies = (BlockStoragePolicy[]) httpfs
|
||||
.getAllStoragePolicies().toArray();
|
||||
Assert.assertArrayEquals(
|
||||
"Policy array returned from the DFS and HttpFS should be equals",
|
||||
dfsPolicies, httpPolicies);
|
||||
fs.getAllStoragePolicies().toArray(), httpfs.getAllStoragePolicies().toArray());
|
||||
|
||||
// test get/set/unset policies
|
||||
DFSTestUtil.createFile(fs, path, 0, (short) 1, 0L);
|
||||
|
@ -81,7 +81,6 @@
|
||||
import org.apache.hadoop.hdfs.TestDFSClientRetries;
|
||||
import org.apache.hadoop.hdfs.TestFileCreation;
|
||||
import org.apache.hadoop.hdfs.client.HdfsClientConfigKeys;
|
||||
import org.apache.hadoop.hdfs.protocol.BlockStoragePolicy;
|
||||
import org.apache.hadoop.hdfs.protocol.ErasureCodingPolicy;
|
||||
import org.apache.hadoop.hdfs.protocol.SystemErasureCodingPolicies;
|
||||
import org.apache.hadoop.hdfs.protocol.HdfsConstants;
|
||||
@ -1405,11 +1404,8 @@ public void testStoragePolicy() throws Exception {
|
||||
conf, WebHdfsConstants.WEBHDFS_SCHEME);
|
||||
|
||||
// test getAllStoragePolicies
|
||||
BlockStoragePolicy[] dfsPolicies = (BlockStoragePolicy[]) dfs
|
||||
.getAllStoragePolicies().toArray();
|
||||
BlockStoragePolicy[] webHdfsPolicies = (BlockStoragePolicy[]) webHdfs
|
||||
.getAllStoragePolicies().toArray();
|
||||
Assert.assertTrue(Arrays.equals(dfsPolicies, webHdfsPolicies));
|
||||
Assert.assertTrue(Arrays.equals(dfs.getAllStoragePolicies().toArray(),
|
||||
webHdfs.getAllStoragePolicies().toArray()));
|
||||
|
||||
// test get/set/unset policies
|
||||
DFSTestUtil.createFile(dfs, path, 0, (short) 1, 0L);
|
||||
|
Loading…
Reference in New Issue
Block a user