}
@Test
public void test2() throws IOException {
FileSystem fs = FileSystem.getLocal(new Configuration());
PrefixEncodedLexicographicallySortedDictionary m =
PrefixEncodedLexicographicallySortedDictionary.loadFromPlainTextFile(
new Path("etc/dictionary-test.txt"), fs, 8);
assertEquals(0, m.getId("a"));
assertEquals(1, m.getId("a1"));
assertEquals(248, m.getId("aardvark"));
assertEquals(2291, m.getId("affair"));
assertEquals(3273, m.getId("airwolf"));
assertEquals(6845, m.getId("anntaylor"));
assertEquals(11187, m.getId("augustus"));
assertEquals(12339, m.getId("azzuz"));
assertEquals(0.5631129, m.getCompresssionRatio(), 10e-6);
m.store("tmp.dat", fs);
PrefixEncodedLexicographicallySortedDictionary n =
PrefixEncodedLexicographicallySortedDictionary.load(
new Path("tmp.dat"), fs);
assertEquals(0, n.getId("a"));
assertEquals(1, n.getId("a1"));
assertEquals(248, n.getId("aardvark"));
assertEquals(2291, n.getId("affair"));
assertEquals(3273, n.getId("airwolf"));
assertEquals(6845, n.getId("anntaylor"));
assertEquals(11187, n.getId("augustus"));
assertEquals(12339, n.getId("azzuz"));
fs.delete(new Path("tmp.dat"), true);
}