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.DFSConfigKeys;
|
||||||
import org.apache.hadoop.hdfs.DFSTestUtil;
|
import org.apache.hadoop.hdfs.DFSTestUtil;
|
||||||
import org.apache.hadoop.hdfs.DistributedFileSystem;
|
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.HdfsConstants;
|
||||||
import org.apache.hadoop.hdfs.protocol.SnapshotException;
|
import org.apache.hadoop.hdfs.protocol.SnapshotException;
|
||||||
import org.apache.hadoop.hdfs.web.WebHdfsFileSystem;
|
import org.apache.hadoop.hdfs.web.WebHdfsFileSystem;
|
||||||
@ -1029,13 +1028,9 @@ private void testStoragePolicy() throws Exception {
|
|||||||
Path path = new Path(getProxiedFSTestDir(), "policy.txt");
|
Path path = new Path(getProxiedFSTestDir(), "policy.txt");
|
||||||
FileSystem httpfs = getHttpFSFileSystem();
|
FileSystem httpfs = getHttpFSFileSystem();
|
||||||
// test getAllStoragePolicies
|
// test getAllStoragePolicies
|
||||||
BlockStoragePolicy[] dfsPolicies = (BlockStoragePolicy[]) fs
|
|
||||||
.getAllStoragePolicies().toArray();
|
|
||||||
BlockStoragePolicy[] httpPolicies = (BlockStoragePolicy[]) httpfs
|
|
||||||
.getAllStoragePolicies().toArray();
|
|
||||||
Assert.assertArrayEquals(
|
Assert.assertArrayEquals(
|
||||||
"Policy array returned from the DFS and HttpFS should be equals",
|
"Policy array returned from the DFS and HttpFS should be equals",
|
||||||
dfsPolicies, httpPolicies);
|
fs.getAllStoragePolicies().toArray(), httpfs.getAllStoragePolicies().toArray());
|
||||||
|
|
||||||
// test get/set/unset policies
|
// test get/set/unset policies
|
||||||
DFSTestUtil.createFile(fs, path, 0, (short) 1, 0L);
|
DFSTestUtil.createFile(fs, path, 0, (short) 1, 0L);
|
||||||
|
@ -81,7 +81,6 @@
|
|||||||
import org.apache.hadoop.hdfs.TestDFSClientRetries;
|
import org.apache.hadoop.hdfs.TestDFSClientRetries;
|
||||||
import org.apache.hadoop.hdfs.TestFileCreation;
|
import org.apache.hadoop.hdfs.TestFileCreation;
|
||||||
import org.apache.hadoop.hdfs.client.HdfsClientConfigKeys;
|
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.ErasureCodingPolicy;
|
||||||
import org.apache.hadoop.hdfs.protocol.SystemErasureCodingPolicies;
|
import org.apache.hadoop.hdfs.protocol.SystemErasureCodingPolicies;
|
||||||
import org.apache.hadoop.hdfs.protocol.HdfsConstants;
|
import org.apache.hadoop.hdfs.protocol.HdfsConstants;
|
||||||
@ -1405,11 +1404,8 @@ public void testStoragePolicy() throws Exception {
|
|||||||
conf, WebHdfsConstants.WEBHDFS_SCHEME);
|
conf, WebHdfsConstants.WEBHDFS_SCHEME);
|
||||||
|
|
||||||
// test getAllStoragePolicies
|
// test getAllStoragePolicies
|
||||||
BlockStoragePolicy[] dfsPolicies = (BlockStoragePolicy[]) dfs
|
Assert.assertTrue(Arrays.equals(dfs.getAllStoragePolicies().toArray(),
|
||||||
.getAllStoragePolicies().toArray();
|
webHdfs.getAllStoragePolicies().toArray()));
|
||||||
BlockStoragePolicy[] webHdfsPolicies = (BlockStoragePolicy[]) webHdfs
|
|
||||||
.getAllStoragePolicies().toArray();
|
|
||||||
Assert.assertTrue(Arrays.equals(dfsPolicies, webHdfsPolicies));
|
|
||||||
|
|
||||||
// test get/set/unset policies
|
// test get/set/unset policies
|
||||||
DFSTestUtil.createFile(dfs, path, 0, (short) 1, 0L);
|
DFSTestUtil.createFile(dfs, path, 0, (short) 1, 0L);
|
||||||
|
Loading…
Reference in New Issue
Block a user