Debian Codegraph @

test/func/files/IndexTest.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2011.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 or
6 * version 2 as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 */
13 package func.files;
14
15 import java.io.File;
16 import java.io.IOException;
17
18 import uk.me.parabola.imgfmt.fs.DirectoryEntry;
19 import uk.me.parabola.imgfmt.fs.FileSystem;
20
21 import func.Base;
22 import func.lib.Args;
23 import func.lib.Outputs;
24 import func.lib.TestUtils;
25 import org.junit.Test;
26
27 import static org.junit.Assert.*;
28
29 public class IndexTest extends Base {
30 private static final String OVERVIEW_NAME = "testname";
31 private static final String MDR_IMG = OVERVIEW_NAME + "_mdr.img";
32
33 @Test
34 public void testCreateIndex() throws IOException {
35 File f = new File(MDR_IMG);
36 f.delete();
37 assertFalse("does not pre-exist", f.exists());
38
39 Outputs outputs = TestUtils.runAsProcess(
40 Args.TEST_STYLE_ARG,
41 "--index",
42 "--latin1",
43 "--family-id=1002",
44 "--overview-mapname=" + OVERVIEW_NAME,
45 Args.TEST_RESOURCE_IMG + "63240001.img",
46 Args.TEST_RESOURCE_IMG + "63240002.img"
47 );
48 outputs.checkError("Number of ExitExceptions: 0");
49
50 TestUtils.registerFile(MDR_IMG);
51 TestUtils.registerFile(OVERVIEW_NAME+".tdb");
52 TestUtils.registerFile(OVERVIEW_NAME+".mdx");
53 TestUtils.registerFile(OVERVIEW_NAME+".img");
54
55 assertTrue(MDR_IMG + " is created", f.exists());
56
57 FileSystem fs = openFs(MDR_IMG);
58 DirectoryEntry entry = fs.lookup(OVERVIEW_NAME.toUpperCase() + ".MDR");
59 assertNotNull("Contains the MDR file", entry);
60
61 entry = fs.lookup(OVERVIEW_NAME.toUpperCase() + ".SRT");
62 assertNotNull("contains the SRT file", entry);
63 fs.close();
64 }
65 }