Examples of BibtexEntry


Examples of net.sf.jabref.BibtexEntry

    writeManually(pdfFile, bibtexXPacket(bibtexDescription(bibtex)));

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

    assertNotNull(e);
    assertEquals(BibtexEntryType.ARTICLE, e.getType());
  }
View Full Code Here

Examples of net.sf.jabref.BibtexEntry

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

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

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

    XMPUtil.writeXMP(pdfFile, e, null);

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

    assertEquals(e, x);
  }
View Full Code Here

Examples of net.sf.jabref.BibtexEntry

      writeManually(pdfFile, bibtexXPacket(bibtexDescription(bibtex)));

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

      assertNotNull(e);
      assertEquals("Hallo World this is not an exercise .", e
          .getField("title"));
      assertEquals("Hallo World this is not an exercise .", e
          .getField("tabs"));
      assertEquals("\n\nAbstract preserve\n\t Whitespace\n\n", e
          .getField("abstract"));
    }
  }
View Full Code Here

Examples of net.sf.jabref.BibtexEntry

    List<BibtexEntry> entries = importer.importEntries(IsiImporterTest.class
      .getResourceAsStream("IsiImporterTestMedline.isi"));

    assertEquals(2, entries.size());
    BibtexEntry a = entries.get(0);
    BibtexEntry b = entries.get(1);

    if ((a.getField("title")).startsWith("Estrogen")) {
      BibtexEntry tmp = a;
      a = b;
      b = tmp;
    }

    // Check A
View Full Code Here

Examples of net.sf.jabref.BibtexEntry

    writeManually(pdfFile, bibtexXPacket(bibtex));

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

    assertEquals(t2BibtexEntry(), e);
  }
View Full Code Here

Examples of net.sf.jabref.BibtexEntry

      // Now write new packet and check if it was correctly written
      XMPUtil.writeXMP(pdfFile, t1BibtexEntry(), null);

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

      assertEquals(t1BibtexEntry(), e);

      // This is what we really want to test: Is the rest of the
      // descriptions still there?

      PDDocument document = null;
      try {
        document = PDDocument.load(pdfFile.getAbsoluteFile());
        if (document.isEncrypted()) {
          throw new IOException(
              "Error: Cannot read metadata from encrypted document.");
        }
        PDDocumentCatalog catalog = document.getDocumentCatalog();
        PDMetadata metaRaw = catalog.getMetadata();

        XMPMetadata meta;
        if (metaRaw != null) {
          meta = new XMPMetadata(XMLUtil.parse(metaRaw
              .createInputStream()));
        } else {
          meta = new XMPMetadata();
        }
        meta.addXMLNSMapping(XMPSchemaBibtex.NAMESPACE,
            XMPSchemaBibtex.class);

        List<XMPSchema> schemas = meta.getSchemas();

        assertEquals(4, schemas.size());

        schemas = meta
            .getSchemasByNamespaceURI(XMPSchemaBibtex.NAMESPACE);
        assertEquals(1, schemas.size());

        schemas = meta
            .getSchemasByNamespaceURI(XMPSchemaDublinCore.NAMESPACE);
        assertEquals(1, schemas.size());
        XMPSchemaDublinCore dc = (XMPSchemaDublinCore) schemas.get(0);
        assertEquals("application/pdf", dc.getFormat());

        schemas = meta
            .getSchemasByNamespaceURI(XMPSchemaBasic.NAMESPACE);
        assertEquals(1, schemas.size());
        XMPSchemaBasic bs = (XMPSchemaBasic) schemas.get(0);
        assertEquals("Acrobat PDFMaker 7.0.7", bs.getCreatorTool());

        Calendar c = Calendar.getInstance();
        c.clear();
        c.set(Calendar.YEAR, 2006);
        c.set(Calendar.MONTH, Calendar.AUGUST);
        c.set(Calendar.DATE, 7);
        c.set(Calendar.HOUR, 14);
        c.set(Calendar.MINUTE, 44);
        c.set(Calendar.SECOND, 24);
        c.setTimeZone(TimeZone.getTimeZone("GMT+2"));

        Calendar other = bs.getCreateDate();

        assertEquals(c.get(Calendar.YEAR), other.get(Calendar.YEAR));
        assertEquals(c.get(Calendar.MONTH), other.get(Calendar.MONTH));
        assertEquals(c.get(Calendar.DATE), other.get(Calendar.DATE));
        assertEquals(c.get(Calendar.HOUR), other.get(Calendar.HOUR));
        assertEquals(c.get(Calendar.MINUTE), other.get(Calendar.MINUTE));
        assertEquals(c.get(Calendar.SECOND), other.get(Calendar.SECOND));
        assertTrue(c.getTimeZone().hasSameRules(other.getTimeZone()));

        schemas = meta
            .getSchemasByNamespaceURI(XMPSchemaMediaManagement.NAMESPACE);
        assertEquals(1, schemas.size());
        XMPSchemaMediaManagement mm = (XMPSchemaMediaManagement) schemas
            .get(0);
        assertEquals("17", mm.getSequenceList("xapMM:VersionID").get(0));

      } finally {
        if (document != null) {
          document.close();
        }
      }
    }

    { // Now alter the Bibtex entry, write it and do all the checks again
      BibtexEntry toSet = t1BibtexEntry();
      toSet.setField("author", "Pokemon!");

      XMPUtil.writeXMP(pdfFile, toSet, null);

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

      assertEquals(toSet, e);

      // This is what we really want to test: Is the rest of the
      // descriptions still there?
View Full Code Here

Examples of net.sf.jabref.BibtexEntry

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

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

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

    XMPUtil.writeXMP(pdfFile, e, null);

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

    assertEquals(e, x);
  }
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("foo")) {
      BibtexEntry tmp = a;
      a = b;
      b = tmp;
    }

    assertEquals("canh05", a.getCiteKey());
View Full Code Here

Examples of net.sf.jabref.BibtexEntry

    // Read from file
    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;
    }

    assertEquals(t2BibtexEntry(), a);
View Full Code Here

Examples of net.sf.jabref.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;
    }

    assertEquals(t2BibtexEntry(), a);
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.