public virtual void TestMetaSave() { for (int i = 0; i < 2; i++) { Path file = new Path("/filestatus" + i); CreateFile(fileSys, file); } cluster.StopDataNode(1); // wait for namenode to discover that a datanode is dead Sharpen.Thread.Sleep(15000); nnRpc.SetReplication("/filestatus0", (short)4); nnRpc.MetaSave("metasave.out.txt"); // Verification FileInputStream fstream = new FileInputStream(GetLogFile("metasave.out.txt")); DataInputStream @in = new DataInputStream(fstream); BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(@in)); string line = reader.ReadLine(); NUnit.Framework.Assert.IsTrue(line.Equals("3 files and directories, 2 blocks = 5 total" )); line = reader.ReadLine(); NUnit.Framework.Assert.IsTrue(line.Equals("Live Datanodes: 1")); line = reader.ReadLine(); NUnit.Framework.Assert.IsTrue(line.Equals("Dead Datanodes: 1")); reader.ReadLine(); line = reader.ReadLine(); NUnit.Framework.Assert.IsTrue(line.Matches("^/filestatus[01]:.*")); } finally { if (reader != null) { reader.Close(); } } }