|
35 | 35 | import java.util.Collection; |
36 | 36 | import java.util.EnumSet; |
37 | 37 | import java.util.List; |
38 | | -import java.util.Map; |
39 | 38 | import java.util.concurrent.Callable; |
40 | 39 | import java.util.concurrent.CountDownLatch; |
41 | 40 | import java.util.concurrent.ExecutionException; |
|
68 | 67 | import org.apache.hadoop.fs.FileSystem; |
69 | 68 | import org.apache.hadoop.fs.FileSystemTestHelper; |
70 | 69 | import org.apache.hadoop.fs.FileSystemTestWrapper; |
71 | | -import org.apache.hadoop.fs.FileUtil; |
72 | 70 | import org.apache.hadoop.fs.FsServerDefaults; |
73 | 71 | import org.apache.hadoop.fs.FsShell; |
74 | 72 | import org.apache.hadoop.fs.Path; |
@@ -330,72 +328,6 @@ public Object run() throws Exception { |
330 | 328 | }); |
331 | 329 | } |
332 | 330 |
|
333 | | - /** |
334 | | - * Tests encrypted files with same original content placed in two different |
335 | | - * EZ are not same in encrypted form. |
336 | | - */ |
337 | | - @Test |
338 | | - public void testEncryptionZonesDictCp() throws Exception { |
339 | | - final String testkey1 = "testkey1"; |
340 | | - final String testkey2 = "testkey2"; |
341 | | - DFSTestUtil.createKey(testkey1, cluster, conf); |
342 | | - DFSTestUtil.createKey(testkey2, cluster, conf); |
343 | | - |
344 | | - final int len = 8196; |
345 | | - final Path zone1 = new Path("/zone1"); |
346 | | - final Path zone1File = new Path(zone1, "file"); |
347 | | - final Path raw1File = new Path("/.reserved/raw/zone1/file"); |
348 | | - |
349 | | - final Path zone2 = new Path("/zone2"); |
350 | | - final Path zone2File = new Path(zone2, "file"); |
351 | | - final Path raw2File = new Path(zone2, "/.reserved/raw/zone2/file"); |
352 | | - |
353 | | - // 1. Create two encrypted zones |
354 | | - fs.mkdirs(zone1, new FsPermission(700)); |
355 | | - dfsAdmin.createEncryptionZone(zone1, testkey1, NO_TRASH); |
356 | | - |
357 | | - fs.mkdirs(zone2, new FsPermission(700)); |
358 | | - dfsAdmin.createEncryptionZone(zone2, testkey2, NO_TRASH); |
359 | | - |
360 | | - // 2. Create a file in one of the zones |
361 | | - DFSTestUtil.createFile(fs, zone1File, len, (short) 1, 0xFEED); |
362 | | - // 3. Copy it to the other zone through /.raw/reserved |
363 | | - FileUtil.copy(fs, raw1File, fs, raw2File, false, conf); |
364 | | - Map<String, byte[]> attrs = fs.getXAttrs(raw1File); |
365 | | - if (attrs != null) { |
366 | | - for (Map.Entry<String, byte[]> entry : attrs.entrySet()) { |
367 | | - String xattrName = entry.getKey(); |
368 | | - |
369 | | - try { |
370 | | - fs.setXAttr(raw2File, xattrName, entry.getValue()); |
371 | | - fail("Exception should be thrown while setting: " + |
372 | | - xattrName + " on file:" + raw2File); |
373 | | - } catch (RemoteException e) { |
374 | | - Assert.assertEquals(e.getClassName(), |
375 | | - IllegalArgumentException.class.getCanonicalName()); |
376 | | - Assert.assertTrue(e.getMessage(). |
377 | | - contains("does not belong to the key")); |
378 | | - } |
379 | | - } |
380 | | - } |
381 | | - |
382 | | - assertEquals("File can be created on the root encryption zone " + |
383 | | - "with correct length", len, fs.getFileStatus(zone1File).getLen()); |
384 | | - assertTrue("/zone1 dir is encrypted", |
385 | | - fs.getFileStatus(zone1).isEncrypted()); |
386 | | - assertTrue("File is encrypted", fs.getFileStatus(zone1File).isEncrypted()); |
387 | | - |
388 | | - assertTrue("/zone2 dir is encrypted", |
389 | | - fs.getFileStatus(zone2).isEncrypted()); |
390 | | - assertTrue("File is encrypted", fs.getFileStatus(zone2File).isEncrypted()); |
391 | | - |
392 | | - // 4. Now the decrypted contents of the files should be different. |
393 | | - DFSTestUtil.verifyFilesNotEqual(fs, zone1File, zone2File, len); |
394 | | - |
395 | | - // 5. Encrypted contents of the files should be same. |
396 | | - DFSTestUtil.verifyFilesEqual(fs, raw1File, raw2File, len); |
397 | | - } |
398 | | - |
399 | 331 | /** |
400 | 332 | * Make sure hdfs crypto -provisionTrash command creates a trash directory |
401 | 333 | * with sticky bits. |
|
0 commit comments