|
| 1 | +/** |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + * or more contributor license agreements. See the NOTICE file |
| 4 | + * distributed with this work for additional information |
| 5 | + * regarding copyright ownership. The ASF licenses this file |
| 6 | + * to you under the Apache License, Version 2.0 (the |
| 7 | + * "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, software |
| 13 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + * See the License for the specific language governing permissions and |
| 16 | + * limitations under the License. |
| 17 | + */ |
1 | 18 | package org.apache.hadoop.hdfs.server.federation.router.async;
|
2 | 19 |
|
3 | 20 | import org.apache.hadoop.crypto.CryptoProtocolVersion;
|
|
9 | 26 | import org.apache.hadoop.hdfs.protocol.DirectoryListing;
|
10 | 27 | import org.apache.hadoop.hdfs.protocol.HdfsConstants;
|
11 | 28 | import org.apache.hadoop.hdfs.protocol.HdfsFileStatus;
|
| 29 | +import org.apache.hadoop.hdfs.server.federation.resolver.RemoteLocation; |
12 | 30 | import org.apache.hadoop.hdfs.server.federation.router.RouterClientProtocol;
|
13 | 31 | import org.apache.hadoop.io.EnumSetWritable;
|
14 | 32 | import org.apache.hadoop.util.Lists;
|
|
29 | 47 | import static org.apache.hadoop.hdfs.server.federation.router.async.utils.AsyncUtil.syncReturn;
|
30 | 48 | import static org.apache.hadoop.hdfs.server.namenode.AclTestHelpers.aclEntry;
|
31 | 49 | import static org.junit.Assert.assertEquals;
|
| 50 | +import static org.junit.Assert.assertNotNull; |
32 | 51 | import static org.junit.Assert.assertTrue;
|
33 | 52 |
|
34 | 53 | /**
|
@@ -84,12 +103,19 @@ public void testClientProtocolRpc() throws Exception {
|
84 | 103 | asyncClientProtocol.create(testPath + "/testCreate.file",
|
85 | 104 | new FsPermission(ALL, ALL, ALL), "testAsyncClient",
|
86 | 105 | new EnumSetWritable<>(EnumSet.of(CreateFlag.CREATE)),
|
87 |
| - false, (short) 1, 128 * 1024 * 1024L, new CryptoProtocolVersion[]{ENCRYPTION_ZONES}, |
| 106 | + false, (short) 1, 128 * 1024 * 1024L, |
| 107 | + new CryptoProtocolVersion[]{ENCRYPTION_ZONES}, |
88 | 108 | null, null);
|
89 | 109 | hdfsFileStatus = syncReturn(HdfsFileStatus.class);
|
90 | 110 | assertTrue(hdfsFileStatus.isFile());
|
91 | 111 | assertEquals(128 * 1024 * 1024, hdfsFileStatus.getBlockSize());
|
92 | 112 |
|
| 113 | + asyncClientProtocol.getFileRemoteLocation(testPath); |
| 114 | + RemoteLocation remoteLocation = syncReturn(RemoteLocation.class); |
| 115 | + assertNotNull(remoteLocation); |
| 116 | + assertEquals(getNs0(), remoteLocation.getNameserviceId()); |
| 117 | + assertEquals(testPath, remoteLocation.getSrc()); |
| 118 | + |
93 | 119 | asyncClientProtocol.getListing(testPath, new byte[1], true);
|
94 | 120 | DirectoryListing directoryListing = syncReturn(DirectoryListing.class);
|
95 | 121 | assertEquals(1, directoryListing.getPartialListing().length);
|
|
0 commit comments