@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());
  FileStatus stat = vfs.getFileStatus(new Path("/foo/bar/baz", testfilename));
  assertEquals(content.length, stat.getLen());
  // check serialization/deserialization
  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());
}