Path p = new Path("preadtest.dat"); DFSTestUtil.createFile(fileSys, p, 12 * blockSize, 12 * blockSize, blockSize, (short) 3, seed); pReadFile(fileSys, p);
/** create a file with a length of <code>fileLen</code> */ private void createFile(String fileName, long fileLen) throws IOException { filelist.add(hftpURI + fileName); final Path filePath = new Path(fileName); DFSTestUtil.createFile(fs, filePath, fileLen, (short) 1, r.nextLong()); }
/** create a file with a length of <code>fileLen</code> */ private void createFile(String fileName, long fileLen) throws IOException { FileSystem fs = cluster.getFileSystem(); Path filePath = new Path(fileName); DFSTestUtil.createFile(fs, filePath, fileLen, (short) 1, r.nextLong()); }
public static void createFile(FileSystem fs, Path fileName, int bufferLen, long fileLen, long blockSize, short replFactor, long seed) throws IOException { createFile(fs, fileName, false, bufferLen, fileLen, blockSize, replFactor, seed, false); }
private void initData5(Path dir) throws Exception { final Path d1 = new Path(dir, "d1"); final Path d2 = new Path(dir, "d2"); final Path f1 = new Path(d1, "f1"); final Path f2 = new Path(d2, "f2"); DFSTestUtil.createFile(dfs, f1, BLOCK_SIZE, DATA_NUM, 0L); DFSTestUtil.createFile(dfs, f2, BLOCK_SIZE, DATA_NUM, 0L); }
private void changeData9(Path dir) throws Exception { final Path foo = new Path(dir, "foo"); final Path foo_f2 = new Path(foo, "f2"); DFSTestUtil.createFile(dfs, foo_f2, BLOCK_SIZE, DATA_NUM, 0L); }
private void initData5(Path dir) throws Exception { final Path d1 = new Path(dir, "d1"); final Path d2 = new Path(dir, "d2"); final Path f1 = new Path(d1, "f1"); final Path f2 = new Path(d2, "f2"); DFSTestUtil.createFile(dfs, f1, blockSize, dataNum, 0L); DFSTestUtil.createFile(dfs, f2, blockSize, dataNum, 0L); }
private void initData6(Path dir) throws Exception { final Path foo = new Path(dir, "foo"); final Path bar = new Path(dir, "bar"); final Path foo_f1 = new Path(foo, "f1"); final Path bar_f1 = new Path(bar, "f1"); DFSTestUtil.createFile(dfs, foo_f1, BLOCK_SIZE, DATA_NUM, 0L); DFSTestUtil.createFile(dfs, bar_f1, BLOCK_SIZE, DATA_NUM, 0L); }
private void initData7(Path dir) throws Exception { final Path foo = new Path(dir, "foo"); final Path bar = new Path(dir, "bar"); final Path foo_f1 = new Path(foo, "f1"); final Path bar_f1 = new Path(bar, "f1"); DFSTestUtil.createFile(dfs, foo_f1, BLOCK_SIZE, DATA_NUM, 0L); DFSTestUtil.createFile(dfs, bar_f1, BLOCK_SIZE, DATA_NUM, 0L); }
/** create a file with a length of <code>fileLen</code> */ private void createFile(String fileName, long fileLen) throws IOException { filelist.add(hftpURI + fileName); final Path filePath = new Path(fileName); DFSTestUtil.createFile(fs, filePath, fileLen, (short) 1, r.nextLong()); }
/** create a file with a length of <code>filelen</code> */ private void createFile(final String fileName, final long filelen) throws IOException { FileSystem fs = mc.getFileSystem(); Path filePath = new Path(fileName); DFSTestUtil.createFile(fs, filePath, filelen, (short) 1, 0); }
@Override void prepare() throws Exception { final Path filePath = new Path(fileName); if (!dfs.exists(filePath)) { DFSTestUtil.createFile(dfs, filePath, BlockSize / 2, DataNodes, 0); } }
@Override void prepare() throws Exception { final Path filePath = new Path(oldName); if (!dfs.exists(filePath)) { DFSTestUtil.createFile(dfs, filePath, BlockSize, DataNodes, 0); } }
@Override void prepare() throws Exception { Path p = new Path(target); if (!dfs.exists(p)) { expectedUpdateCount++; DFSTestUtil.createFile(dfs, p, BlockSize, DataNodes, 0); } }
private void doTestUnreadableBySuperuserXAttr(FileSystem userFs, boolean expectOpenFailure) throws Exception { FileSystem.mkdirs(fs, path, FsPermission.createImmutable((short) 0777)); DFSTestUtil.createFile(userFs, filePath, 8192, (short) 1, 0xFEED); try { doTUBSXAInt(userFs, expectOpenFailure); // Deleting the file is allowed. userFs.delete(filePath, false); } finally { fs.delete(path, true); } }
private ArrayList<Block> prepareForRide(final Path filePath, final String METHOD_NAME, long fileSize) throws IOException { LOG.info("Running test " + METHOD_NAME); DFSTestUtil.createFile(fs, filePath, fileSize, REPL_FACTOR, rand.nextLong()); return locatedToBlocks(cluster.getNameNodeRpc() .getBlockLocations(filePath.toString(), FILE_START, fileSize).getLocatedBlocks(), null); }
private LocatedBlocks createFileGetBlocks(String filenamePrefix) throws IOException { Path filePath = new Path("/" + filenamePrefix + ".dat"); // Write out a file with a few blocks, get block locations. DFSTestUtil.createFile(fs, filePath, BLOCK_SIZE, BLOCK_SIZE * NUM_BLOCKS, BLOCK_SIZE, NUM_DATANODES, seed); // Get the block list for the file with the block locations. LocatedBlocks blocks = client.getLocatedBlocks( filePath.toString(), 0, BLOCK_SIZE * NUM_BLOCKS); assertThat(cluster.getNamesystem().getUnderReplicatedBlocks(), is(0L)); return blocks; }
@Test(timeout = 60000) public void TestSnapshotWithInvalidName1() throws Exception{ Path file1 = new Path(dir1, file1Name); DFSTestUtil.createFile(hdfs, file1, BLOCKSIZE, REPLICATION, SEED); hdfs.allowSnapshot(dir1); try { hdfs.createSnapshot(dir1, snapshot2); } catch (RemoteException e) { } } }
@Before public void setUp() throws Exception { conf = new Configuration(); cluster = new MiniDFSCluster.Builder(conf) .numDataNodes(REPLICATION) .build(); cluster.waitActive(); hdfs = cluster.getFileSystem(); DFSTestUtil.createFile(hdfs, file1, 1024, REPLICATION, seed); DFSTestUtil.createFile(hdfs, file2, 1024, REPLICATION, seed); }
@Override public void prepare() throws Exception { // original size: 2.5 blocks DFSTestUtil.createFile(dfs, file, BLOCKSIZE * 2 + BLOCKSIZE / 2, REPLICATION, 0L); SnapshotTestHelper.createSnapshot(dfs, dir, "s1"); // truncate to 1.5 block dfs.truncate(file, BLOCKSIZE + BLOCKSIZE / 2); TestFileTruncate.checkBlockRecovery(file, dfs); // append another 1 BLOCK DFSTestUtil.appendFile(dfs, file, BLOCKSIZE); }