Пример #1
0
  @Test
  public void testSearchCandidates() throws Exception {
    Path outputBaseDir = mktempdir();
    Path emptyInputDir = outputBaseDir.resolve("dummy-input");
    Files.createDirectories(emptyInputDir);
    CommandLineExecuter.main(
        new String[] {
          "--pdf-dir",
          getResourcePath("/examples/minimal-pdf"),
          "--text-dir",
          outputBaseDir.resolve("text").toString(),
          "--db-dir",
          outputBaseDir.resolve("db").toString(),
          "--index-dir",
          outputBaseDir.resolve("index").toString(),
          "--search-candidates",
          "--convert-to-text",
          "--tag",
          "foo-bar",
          "--queries-file",
          getResourcePath("/commandLine/queryTerms.csv")
        });
    log.debug("OutputBase exists at " + outputBaseDir.toFile());

    FileUtils.deleteDirectory(outputBaseDir.toFile());
  }
Пример #2
0
 @Test
 public void testDouble() throws Exception {
   Path outputBaseDir = mktempdir();
   Path emptyInputDir = outputBaseDir.resolve("dummy-input");
   Files.createDirectories(emptyInputDir);
   CommandLineExecuter.main(
       new String[] {
         "--json",
         getResourcePath("/commandLine/double.json"),
         "--pdf-dir",
         emptyInputDir.toString(),
         "--text-dir",
         outputBaseDir.resolve("text").toString(),
         "--db-dir",
         outputBaseDir.resolve("db").toString(),
         "--convert-to-text",
         "--tag",
         "foo-bar"
       });
   FileUtils.forceDelete(outputBaseDir.toFile());
 }
Пример #3
0
 @Test
 public void testConvertOnly() throws Exception {
   Path outputBaseDir = mktempdir();
   String tag = "foo-bar";
   CommandLineExecuter.main(
       new String[] {
         "--pdf-dir",
         getResourcePath("/examples/minimal-pdf/"),
         "--text-dir",
         outputBaseDir.resolve("text").toString(),
         "--db-dir",
         outputBaseDir.resolve("db").toString(),
         "--convert-to-text",
         "--tag",
         tag,
       });
   Path expectedDump = outputBaseDir.resolve("db").resolve(tag + ".json");
   assertTrue("dump exists at " + expectedDump, Files.exists(expectedDump));
   Path expectedText = outputBaseDir.resolve("text").resolve("4493.txt");
   assertTrue("text exists at " + expectedText, Files.exists(expectedText));
   FileUtils.deleteDirectory(outputBaseDir.toFile());
 }