ViewFsFileStatus extends FileStatus { @Override public long getLen() { return myFs.getLen(); } ViewFsFileStatus(FileStatus fs, Path newPath); @Override boolean equals(Object o); @Override int hashCode(); @Override long getLen(); @Override boolean isFile(); @Override boolean isDirectory(); @Override boolean isSymlink(); @Override long getBlockSize(); @Override short getReplication(); @Override long getModificationTime(); @Override long getAccessTime(); @Override FsPermission getPermission(); @Override String getOwner(); @Override String getGroup(); @Override Path getPath(); @Override void setPath(final Path p); @Override Path getSymlink();  }
@Test public void testFileStatusSerialziation() throws IOException, URISyntaxException { String testfilename = "testFileStatusSerialziation"; TEST_DIR.mkdirs(); File infile = new File(TEST_DIR, testfilename); final byte[] content = "dingos".getBytes(); FileOutputStream fos = null; try { fos = new FileOutputStream(infile); fos.write(content); } finally { if (fos != null) { fos.close(); } } assertEquals((long)content.length, infile.length()); Configuration conf = new Configuration(); ConfigUtil.addLink(conf, "/foo/bar/baz", TEST_DIR.toURI()); FileSystem vfs = FileSystem.get(FsConstants.VIEWFS_URI, conf); assertEquals(ViewFileSystem.class, vfs.getClass()); Path path = new Path("/foo/bar/baz", testfilename); FileStatus stat = vfs.getFileStatus(path); assertEquals(content.length, stat.getLen()); ContractTestUtils.assertNotErasureCoded(vfs, path); assertTrue(path + " should have erasure coding unset in " + "FileStatus#toString(): " + stat, stat.toString().contains("isErasureCoded=false")); DataOutputBuffer dob = new DataOutputBuffer(); stat.write(dob); DataInputBuffer dib = new DataInputBuffer(); dib.reset(dob.getData(), 0, dob.getLength()); FileStatus deSer = new FileStatus(); deSer.readFields(dib); assertEquals(content.length, deSer.getLen()); assertFalse(deSer.isErasureCoded()); }