Examples of ParserResult


Examples of net.sf.jabref.imports.ParserResult

  public void testParse() throws IOException {

    // Test Standard parsing
    BibtexParser parser = new BibtexParser(new StringReader(
      "@article{test,author={Ed von Test}}"));
    ParserResult result = parser.parse();

    Collection<BibtexEntry> c = result.getDatabase().getEntries();
    assertEquals(1, c.size());

    BibtexEntry e = c.iterator().next();
    assertEquals("test", e.getCiteKey());
    assertEquals(2, e.getAllFields().size());
View Full Code Here

Examples of net.sf.jabref.imports.ParserResult

  public void testParse2() throws IOException {

    BibtexParser parser = new BibtexParser(new StringReader(
      "@article{test,author={Ed von Test}}"));
    ParserResult result = parser.parse();

    BibtexEntry e = new BibtexEntry("", BibtexEntryType.ARTICLE);
    e.setField("author", "Ed von Test");
    e.setField("bibtexkey", "test");

    Collection<BibtexEntry> c = result.getDatabase().getEntries();
    assertEquals(1, c.size());

    BibtexEntry e2 = c.iterator().next();

    assertNotSame(e.getId(), e2.getId());
View Full Code Here

Examples of net.sf.jabref.imports.ParserResult

   *
   * @throws IOException
   */
  public void testBigNumbers() throws IOException {

    ParserResult result = BibtexParser.parse(new StringReader("@article{canh05,"
      + "isbn = 1234567890123456789,\n" + "isbn2 = {1234567890123456789},\n"
      + "small = 1234,\n" + "}"));

    Collection<BibtexEntry> c = result.getDatabase().getEntries();
    BibtexEntry e = c.iterator().next();

    assertEquals("1234567890123456789", e.getField("isbn"));
    assertEquals("1234567890123456789", e.getField("isbn2"));
    assertEquals("1234", e.getField("small"));
View Full Code Here

Examples of net.sf.jabref.imports.ParserResult

    assertEquals("1234", e.getField("small"));
  }

  public void testBigNumbers2() throws IOException {

    ParserResult result = BibtexParser.parse(new StringReader(""
      + "@string{bourdieu = {Bourdieu, Pierre}}"
      + "@book{bourdieu-2002-questions-sociologie, " + "  Address = {Paris},"
      + "  Author = bourdieu," + "  Isbn = 2707318256," + "  Publisher = {Minuit},"
      + "  Title = {Questions de sociologie}," + "  Year = 2002" + "}"));

    Collection<BibtexEntry> c = result.getDatabase().getEntries();
    assertEquals(1, c.size());

    BibtexEntry e = c.iterator().next();

    assertEquals("bourdieu-2002-questions-sociologie", e.getCiteKey());
View Full Code Here

Examples of net.sf.jabref.imports.ParserResult

  }

  private BibtexDatabase getDatabse() {
    Globals.prefs = JabRefPreferences.getInstance();
    File fileToLoad = new File(PATH_TO_TEST_BIBTEX);
    ParserResult pr = JabRef.openBibFile(fileToLoad.getPath(), true);
    BibtexDatabase filledDatabase = pr.getDatabase();
    return filledDatabase;
  }
View Full Code Here

Examples of net.sf.jabref.imports.ParserResult

    }
  }

  public static BibtexEntry bibtexString2BibtexEntry(String s)
      throws IOException {
    ParserResult result = BibtexParser.parse(new StringReader(s));
    Collection<BibtexEntry> c = result.getDatabase().getEntries();
    assertEquals(1, c.size());
    return c.iterator().next();
  }
View Full Code Here

Examples of net.sf.jabref.imports.ParserResult

   * Test that readXMP and writeXMP work together.
   *
   * @throws Exception
   */
  public void testReadWriteXMP() throws Exception {
    ParserResult result = BibtexParser
        .parse(new StringReader(
            "@article{canh05,"
                + "  author = {Crowston, K. and Annabi, H. and Howison, J. and Masango, C.},"
                + "\n"
                + "  title = {Effective work practices for floss development: A model and propositions},"
                + "\n"
                + "  booktitle = {Hawaii International Conference On System Sciences (HICSS)},"
                + "\n"
                + "  year = {2005},"
                + "\n"
                + "  owner = {oezbek},"
                + "\n"
                + "  timestamp = {2006.05.29},"
                + "\n"
                + "  url = {http://james.howison.name/publications.html}"
                + "\n" + "}"));

    Collection<BibtexEntry> c = result.getDatabase().getEntries();
    assertEquals(1, c.size());

    BibtexEntry e = c.iterator().next();

    XMPUtil.writeXMP(pdfFile, e, null);
View Full Code Here

Examples of net.sf.jabref.imports.ParserResult

   *
   * @throws Exception
   *
   */
  public void testXMLEscape() throws Exception {
    ParserResult result = BibtexParser
        .parse(new StringReader(
            "@article{canh05,"
                + "  author = {Crowston, K. and Annabi, H. and Howison, J. and Masango, C.},"
                + "\n"
                + "  title = {</bibtex:title> \" bla \" '' '' && &  for floss development: A model and propositions},"
                + "\n"
                + "  booktitle = {<randomXML>},"
                + "\n"
                + "  year = {2005},"
                + "\n"
                + "  owner = {oezbek},"
                + "\n"
                + "  timestamp = {2006.05.29},"
                + "\n"
                + "  url = {http://james.howison.name/publications.html}"
                + "\n" + "}"));

    Collection<BibtexEntry> c = result.getDatabase().getEntries();
    assertEquals(1, c.size());

    BibtexEntry e = c.iterator().next();

    XMPUtil.writeXMP(pdfFile, e, null);
View Full Code Here

Examples of net.sf.jabref.imports.ParserResult

   *
   * @depends XMPUtilTest.testReadMultiple()
   */
  public void testXMPreadString() throws Exception {

    ParserResult result = BibtexParser.parse(new StringReader(
        "@article{canh05,"
            + "  author = {Crowston, K. and Annabi, H.},\n"
            + "  title = {Title A}}\n" + "@inProceedings{foo,"
            + "  author={Norton Bar}}"));

    Collection<BibtexEntry> c = result.getDatabase().getEntries();
    assertEquals(2, c.size());

    String xmp = XMPUtil.toXMP(c, null);

    /* Test minimal syntaxical completeness */
 
View Full Code Here

Examples of net.sf.jabref.imports.ParserResult

  }

  @SuppressWarnings("unchecked")
  public void testReadRawXMP() throws Exception {

    ParserResult result = BibtexParser
        .parse(new StringReader(
            "@article{canh05,"
                + "  author = {Crowston, K. and Annabi, H. and Howison, J. and Masango, C.},\n"
                + "  title = {Effective work practices for floss development: A model and propositions},\n"
                + "  booktitle = {Hawaii International Conference On System Sciences (HICSS)},\n"
                + "  year = {2005},\n"
                + "  owner = {oezbek},\n"
                + "  timestamp = {2006.05.29},\n"
                + "  url = {http://james.howison.name/publications.html}}"));

    Collection c = result.getDatabase().getEntries();
    assertEquals(1, c.size());

    BibtexEntry e = (BibtexEntry) c.iterator().next();

    XMPUtil.writeXMP(pdfFile, e, null);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.