Examples of BibtexEntry


Examples of net.sf.jabref.BibtexEntry

                + "  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);

    XMPMetadata metadata = XMPUtil.readRawXMP(pdfFile);
View Full Code Here

Examples of net.sf.jabref.BibtexEntry

   */
  public void testCommandLineSinglePdf() throws Exception {
    {
      // Write XMP to file

      BibtexEntry e = t1BibtexEntry();

      XMPUtil.writeXMP(pdfFile, e, null);

      ByteArrayOutputStream s = new ByteArrayOutputStream();
      PrintStream oldOut = System.out;
      System.setOut(new PrintStream(s));
      XMPUtil.main(new String[] { pdfFile.getAbsolutePath() });
      System.setOut(oldOut);
      s.close();
      String bibtex = s.toString();

      ParserResult result = BibtexParser.parse(new StringReader(bibtex));
      Collection<BibtexEntry> c = result.getDatabase().getEntries();
      assertEquals(1, c.size());
      BibtexEntry x = c.iterator().next();

      assertEquals(e, x);
    }
    {
      // Write XMP to file
      BibtexEntry e = t1BibtexEntry();

      XMPUtil.writeXMP(pdfFile, e, null);

      ByteArrayOutputStream s = new ByteArrayOutputStream();
      PrintStream oldOut = System.out;
View Full Code Here

Examples of net.sf.jabref.BibtexEntry

      List<BibtexEntry> l = XMPUtil.readXMP(pdfFile);

      assertEquals(2, l.size());

      BibtexEntry a = l.get(0);
      BibtexEntry b = l.get(1);

      if (a.getCiteKey().equals("Clarkson06")) {
        BibtexEntry tmp = a;
        a = b;
        b = tmp;
      }

      BibtexEntry t1 = t1BibtexEntry();
      BibtexEntry t3 = t3BibtexEntry();

      // Writing and reading will resolve strings!
      t3.setField("month", "July");

      assertEquals(t1, a);
      assertEquals(t3, b);

    } finally {
View Full Code Here

Examples of net.sf.jabref.BibtexEntry

                + "\n" + "}"));

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

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

    XMPUtil.writeXMP(pdfFile, e, original.getDatabase());

    List<BibtexEntry> l = XMPUtil.readXMP(pdfFile.getAbsoluteFile());
    assertEquals(1, l.size());
    BibtexEntry x = l.get(0);

    assertEquals(
        AuthorList
            .getAuthorList("Crowston, K. and Annabi, H. and Howison, J. and Masango, C."),
        AuthorList.getAuthorList(x.getField("author").toString()));
  }
View Full Code Here

Examples of net.sf.jabref.BibtexEntry

    try {
      XMPUtil.writeXMP(pdfFile, result.getDatabase().getEntryByKey(
          "Patterson06"), result.getDatabase());

      // Test whether we the main function can load the bibtex correctly
      BibtexEntry b = XMPUtil.readXMP(pdfFile).get(0);

      assertEquals(originalAuthors, AuthorList.getAuthorList(b.getField(
          "author").toString()));

      // Next check from Document Information
      PDDocument document = PDDocument.load(pdfFile.getAbsoluteFile());
      try {

        assertEquals(originalAuthors, AuthorList.getAuthorList(document
            .getDocumentInformation().getAuthor()));

        b = XMPUtil.getBibtexEntryFromDocumentInformation(document
            .getDocumentInformation());
        assertEquals(originalAuthors, AuthorList.getAuthorList(b
            .getField("author").toString()));

        // Now check from Dublin Core
        PDDocumentCatalog catalog = document.getDocumentCatalog();
        PDMetadata metaRaw = catalog.getMetadata();

        if (metaRaw == null) {
          fail();
        }

        XMPMetadata meta = new XMPMetadata(XMLUtil.parse(metaRaw
            .createInputStream()));
        meta.addXMLNSMapping(XMPSchemaBibtex.NAMESPACE,
            XMPSchemaBibtex.class);

        List<XMPSchema> schemas = meta
            .getSchemasByNamespaceURI("http://purl.org/dc/elements/1.1/");

        assertEquals(1, schemas.size());

        XMPSchemaDublinCore dcSchema = (XMPSchemaDublinCore) schemas
            .iterator().next();
        assertNotNull(dcSchema);

        assertEquals("David Patterson", dcSchema.getCreators().get(0));
        assertEquals("Arvind", dcSchema.getCreators().get(1));
        assertEquals("Krste Asanov\\'\\i{}c", dcSchema.getCreators()
            .get(2));

        b = XMPUtil.getBibtexEntryFromDublinCore(dcSchema);
        assertEquals(originalAuthors, AuthorList.getAuthorList(b
            .getField("author").toString()));
      } finally {
        document.close();
      }
View Full Code Here

Examples of net.sf.jabref.BibtexEntry

    RisImporter importer = new RisImporter();

    List<BibtexEntry> entries = importer.importEntries(RISImporterTest.class
      .getResourceAsStream("RisImporterTest1.ris"));
    assertEquals(1, entries.size());
    BibtexEntry entry = entries.get(0);
    assertEquals("Editorial: Open Source and Empirical Software Engineering", entry
      .getField("title"));
    assertEquals(
      "Harrison, Warren",
      entry.getField("author"));

    assertEquals(BibtexEntryType.ARTICLE, entry.getType());
    assertEquals("Empirical Software Engineering", entry.getField("journal"));
    assertEquals("2001", entry.getField("year"));
    assertEquals("6", entry.getField("volume"));
    assertEquals("3", entry.getField("number"));
    assertEquals("193--194", entry.getField("pages"));
    assertEquals("#sep#", entry.getField("month"));
  }
View Full Code Here

Examples of net.sf.jabref.BibtexEntry

    CopacImporter importer = new CopacImporter();

    List<BibtexEntry> entries = importer.importEntries(CopacImporterTest.class
      .getResourceAsStream("CopacImporterTest1.txt"));
    assertEquals(1, entries.size());
    BibtexEntry entry = entries.get(0);
   
    assertEquals("The SIS project : software reuse with a natural language approach", entry.getField("title"));
    assertEquals(
      "Prechelt, Lutz and Universit�t Karlsruhe. Fakult�t f�r Informatik",
      entry.getField("author"));
    assertEquals("Interner Bericht ; Nr.2/92", entry.getField("series"));
    assertEquals("1992", entry.getField("year"));
    assertEquals("Karlsruhe :  Universitat Karlsruhe, Fakultat fur Informatik", entry.getField("publisher"));
    assertEquals(BibtexEntryType.BOOK, entry.getType());
  }
View Full Code Here

Examples of net.sf.jabref.BibtexEntry

    CopacImporter importer = new CopacImporter();

    List<BibtexEntry> entries = importer.importEntries(CopacImporterTest.class
      .getResourceAsStream("CopacImporterTest2.txt"));
    assertEquals(2, entries.size());
    BibtexEntry one = entries.get(0);
   
    assertEquals("Computing and operational research at the London Hospital", one.getField("title"));
   
    BibtexEntry two = entries.get(1);
 
    assertEquals("Real time systems : management and design", two.getField("title"));
  }
View Full Code Here

Examples of net.sf.jabref.BibtexEntry

*/
public class DuplicateCheckTest extends TestCase {

    public void testDuplicateDetection() {

        BibtexEntry one = new BibtexEntry(Util.createNeutralId(), BibtexEntryType.ARTICLE);

        BibtexEntry two = new BibtexEntry(Util.createNeutralId(), BibtexEntryType.ARTICLE);

        one.setField("author", "Billy Bob");
        two.setField("author", "Billy Bob");
        assertTrue(DuplicateCheck.isDuplicate(one, two));

        two.setField("author", "James Joyce");
        assertFalse(DuplicateCheck.isDuplicate(one, two));

        two.setField("author", "Billy Bob");
        two.setType(BibtexEntryType.BOOK);
        assertFalse(DuplicateCheck.isDuplicate(one, two));

        two.setType(BibtexEntryType.ARTICLE);
        one.setField("year", "2005");
        two.setField("year", "2005");
        one.setField("title", "A title");
        two.setField("title", "A title");
        one.setField("journal", "A");
        two.setField("journal", "A");
        one.setField("number", "1");
        two.setField("number", "1");
        one.setField("volume", "21");
        two.setField("volume", "21");
        assertTrue(DuplicateCheck.isDuplicate(one, two));

        two.setField("volume", "22");
        assertTrue(DuplicateCheck.isDuplicate(one, two));

        two.setField("title", "Another title");
        two.setField("journal", "B");
        assertFalse(DuplicateCheck.isDuplicate(one, two));
    }
View Full Code Here

Examples of net.sf.jabref.BibtexEntry

  public void testSetBibtexEntry() throws IOException {

    XMPMetadata xmp = new XMPMetadata();
    XMPSchemaBibtex bibtex = new XMPSchemaBibtex(xmp);

    BibtexEntry e = FileBasedTestCase.getBibtexEntry();
    bibtex.setBibtexEntry(e, null);

    BibtexEntry e2 = bibtex.getBibtexEntry();

    assertEquals(e, e2);
  }
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.