Package net.sf.jabref.util

Examples of net.sf.jabref.util.XMPSchemaBibtex


    assertEquals("Kent Beck", authors.get(1));
  }

  public void testSetGetTextPropertyString() throws IOException {
    XMPMetadata xmp = new XMPMetadata();
    XMPSchemaBibtex bibtex = new XMPSchemaBibtex(xmp);

    bibtex.setTextProperty("title",
      "The advanced Flux-Compensation for Delawney-Separation");

    Element e = bibtex.getElement();
    assertEquals("The advanced Flux-Compensation for Delawney-Separation",
      e.getAttribute("bibtex:title"));

    assertEquals("The advanced Flux-Compensation for Delawney-Separation",
      bibtex.getTextProperty("title"));

    bibtex.setTextProperty("title",
      "The advanced Flux-Correlation for Delawney-Separation");

    e = bibtex.getElement();
    assertEquals("The advanced Flux-Correlation for Delawney-Separation", e
      .getAttribute("bibtex:title"));

    assertEquals("The advanced Flux-Correlation for Delawney-Separation",
      bibtex.getTextProperty("title"));

    bibtex
      .setTextProperty(
        "abstract",
        "   The abstract\n can go \n \n on several \n lines with \n many \n\n empty ones in \n between.");
    assertEquals(
      "   The abstract\n can go \n \n on several \n lines with \n many \n\n empty ones in \n between.",
      bibtex.getTextProperty("abstract"));
  }
View Full Code Here


  }

  public void testSetGetBagListString() throws IOException {

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

    bibtex.addBagValue("author", "Tom DeMarco");
    bibtex.addBagValue("author", "Kent Beck");
    {

      List<String> l = bibtex.getBagList("author");

      assertEquals(2, l.size());

      assertTrue(l.get(0).equals("Tom DeMarco")
        || l.get(1).equals("Tom DeMarco"));
      assertTrue(l.get(0).equals("Kent Beck")
        || l.get(1).equals("Kent Beck"));
    }
    {
      bibtex.removeBagValue("author", "Kent Beck");
      List<String> l = bibtex.getBagList("author");
      assertEquals(1, l.size());
      assertTrue(l.get(0).equals("Tom DeMarco"));
    }
    { // Already removed
      bibtex.removeBagValue("author", "Kent Beck");
      List<String> l = bibtex.getBagList("author");
      assertEquals(1, l.size());
      assertTrue(l.get(0).equals("Tom DeMarco"));
    }
    { // Duplicates allowed!
      bibtex.addBagValue("author", "Tom DeMarco");
      List<String> l = bibtex.getBagList("author");
      assertEquals(2, l.size());
      assertTrue(l.get(0).equals("Tom DeMarco"));
      assertTrue(l.get(1).equals("Tom DeMarco"));
    }
    { // Removes both
      bibtex.removeBagValue("author", "Tom DeMarco");
      List<String> l = bibtex.getBagList("author");
      assertEquals(0, l.size());
    }
  }
View Full Code Here

  }

  public void testGetSequenceListString() throws IOException {

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

    bibtex.addSequenceValue("author", "Tom DeMarco");
    bibtex.addSequenceValue("author", "Kent Beck");
    {

      List<String> l = bibtex.getSequenceList("author");

      assertEquals(2, l.size());

      assertEquals("Tom DeMarco", l.get(0));
      assertEquals("Kent Beck", l.get(1));
    }
    {
      bibtex.removeSequenceValue("author", "Tom DeMarco");
      List<String> l = bibtex.getSequenceList("author");
      assertEquals(1, l.size());
      assertTrue(l.get(0).equals("Kent Beck"));
    }
    { // Already removed
      bibtex.removeSequenceValue("author", "Tom DeMarco");
      List<String> l = bibtex.getSequenceList("author");
      assertEquals(1, l.size());
      assertTrue(l.get(0).equals("Kent Beck"));
    }
    { // Duplicates allowed!
      bibtex.addSequenceValue("author", "Kent Beck");
      List<String> l = bibtex.getSequenceList("author");
      assertEquals(2, l.size());
      assertTrue(l.get(0).equals("Kent Beck"));
      assertTrue(l.get(1).equals("Kent Beck"));
    }
    { // Remvoes all
      bibtex.removeSequenceValue("author", "Kent Beck");
      List<String> l = bibtex.getSequenceList("author");
      assertEquals(0, l.size());
    }
  }
View Full Code Here

    // We don't use this...
  }

  public void testGetAllProperties() throws IOException {
    XMPMetadata xmp = new XMPMetadata();
    XMPSchemaBibtex bibtex = new XMPSchemaBibtex(xmp);

    bibtex.setTextProperty("title", "BlaBla Ta Ta\nHello World");
    bibtex.setTextProperty("abstract", "BlaBla Ta Ta\nHello World");
    bibtex.setTextProperty("review", "BlaBla Ta Ta\nHello World");
    bibtex.setTextProperty("note", "BlaBla Ta Ta\nHello World");
    bibtex.setPersonList("author", "Mouse, Mickey and Bond, James");

    Map<String, String> s = XMPSchemaBibtex.getAllProperties(bibtex,
      "bibtex");

    assertEquals(5, s.size());
View Full Code Here

  }

  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

    List<XMPSchema> schemas = metadata.getSchemas();
    assertEquals(2, schemas.size());
    schemas = metadata.getSchemasByNamespaceURI(XMPSchemaBibtex.NAMESPACE);
    assertEquals(1, schemas.size());
    XMPSchemaBibtex bib = (XMPSchemaBibtex) schemas.get(0);

    List<String> authors = bib.getSequenceList("author");
    assertEquals(4, authors.size());
    assertEquals("K. Crowston", authors.get(0));
    assertEquals("H. Annabi", authors.get(1));
    assertEquals("J. Howison", authors.get(2));
    assertEquals("C. Masango", authors.get(3));

    assertEquals("Article", bib.getTextProperty("entrytype"));
    assertEquals(
        "Effective work practices for floss development: A model and propositions",
        bib.getTextProperty("title"));
    assertEquals(
        "Hawaii International Conference On System Sciences (HICSS)",
        bib.getTextProperty("booktitle"));
    assertEquals("2005", bib.getTextProperty("year"));
    assertEquals("oezbek", bib.getTextProperty("owner"));
    assertEquals("http://james.howison.name/publications.html", bib
        .getTextProperty("url"));

  }
View Full Code Here

  }

  public void testXMPSchemaBibtexXMPMetadata() throws IOException {

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

    assertNotNull(bibtex.getElement());
    assertEquals("rdf:Description", bibtex.getElement().getTagName());

  }
View Full Code Here

    DocumentBuilderFactory builderFactory = DocumentBuilderFactory
      .newInstance();
    DocumentBuilder builder = builderFactory.newDocumentBuilder();
    Element e = builder.newDocument().createElement("rdf:Description");

    XMPSchemaBibtex bibtex = new XMPSchemaBibtex(e, "bibtex");

    assertEquals(e, bibtex.getElement());
    assertEquals("rdf:Description", bibtex.getElement().getTagName());
  }
View Full Code Here

    assertEquals("rdf:Description", bibtex.getElement().getTagName());
  }

  public void testGetSetPersonList() throws IOException {
    XMPMetadata xmp = new XMPMetadata();
    XMPSchemaBibtex bibtex = new XMPSchemaBibtex(xmp);

    bibtex.setPersonList("author", "Tom DeMarco and Kent Beck");

    Element e = bibtex.getElement();

    NodeList l1 = e.getElementsByTagName("bibtex:author");
    assertEquals(1, l1.getLength());

    NodeList l = e.getElementsByTagName("rdf:li");

    assertEquals(2, l.getLength());

    assertEquals("Tom DeMarco", XMLUtil
      .getStringValue(((Element) l.item(0))));
    assertEquals("Kent Beck", XMLUtil.getStringValue(((Element) l.item(1))));

    List<String> authors = bibtex.getPersonList("author");
    assertEquals(2, authors.size());

    assertEquals("Tom DeMarco", authors.get(0));
    assertEquals("Kent Beck", authors.get(1));
  }
View Full Code Here

TOP

Related Classes of net.sf.jabref.util.XMPSchemaBibtex

Copyright © 2018 www.massapicom. 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.