Examples of XMPSchema


Examples of org.apache.jempbox.xmp.XMPSchema

     */
    public void testRDFDescription() throws IOException, ParserConfigurationException
    {
        // Check constructor using an element
        XMPMetadata xmp = new XMPMetadata();
        XMPSchema basic = new XMPSchema(xmp, "test", "http://test.com/test");

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

        // Then Check using the Document Builder Factory
        DocumentBuilderFactory builderFactory = DocumentBuilderFactory
                .newInstance();
        DocumentBuilder builder = builderFactory.newDocumentBuilder();
        Element e = builder.newDocument().createElement("rdf:Description");

        XMPSchema schema = new XMPSchema(e, "test");

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

Examples of org.apache.jempbox.xmp.XMPSchema

     * @throws IOException Signals an error with the XMP processing.
     */
    public void testTextProperty() throws IOException
    {
        XMPMetadata xmp = new XMPMetadata();
        XMPSchema schema = new XMPSchema(xmp, "test", "http://test.com/test");

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

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

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

        schema.setTextProperty("test:title",
                "Bacon's Dictum and Healey's Heaven");

        e = schema.getElement();
        assertEquals("Bacon's Dictum and Healey's Heaven", e
                .getAttribute("test:title"));

        assertEquals("Bacon's Dictum and Healey's Heaven", schema
                .getTextProperty("test:title"));

        schema
                .setTextProperty(
                        "test: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.",
                schema.getTextProperty("test:abstract"));
    }
View Full Code Here

Examples of org.apache.jempbox.xmp.XMPSchema

     */
    public void testBags() throws IOException
    {

        XMPMetadata xmp = new XMPMetadata();
        XMPSchema schema = new XMPSchema(xmp, "test", "http://test.com/test");

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

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

Examples of org.apache.jempbox.xmp.XMPSchema

     * @throws IOException Signals an error with the XMP processing.
     */
    public void testSeqList() throws IOException
    {
        XMPMetadata xmp = new XMPMetadata();
        XMPSchema schema = new XMPSchema(xmp, "test", "http://test.com/test");

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

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

            assertEquals(2, l.size());

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

Examples of org.apache.jempbox.xmp.XMPSchema

     * @throws IOException Signals an error with the XMP processing.
     */
    public void testDateList() throws IOException
    {
        XMPMetadata xmp = new XMPMetadata();
        XMPSchema schema = new XMPSchema(xmp, "test", "http://test.com/test");

        Calendar c1 = Calendar.getInstance();
        c1.set(1999, 11, 31, 0, 0, 0);
        c1.set(Calendar.MILLISECOND, 0);

        Calendar c2 = Calendar.getInstance();
        c2.set(2000, 11, 31, 0, 0, 0);
        c2.set(Calendar.MILLISECOND, 0);
        // System.out.println( DateConverter.toISO8601(c1));

        schema.addSequenceDateValue("test:importantDates", c1);
        schema.addSequenceDateValue("test:importantDates", c2);

        List<Calendar> l = schema.getSequenceDateList("test:importantDates");

        assertEquals(2, l.size());

        assertEquals(c1, (Calendar) l.get(0));
        assertEquals(c2, (Calendar) l.get(1));

        schema.removeSequenceDateValue("test:importantDates", c1);

        l = schema.getSequenceDateList("test:importantDates");

        assertEquals(1, l.size());

        assertEquals(c2, (Calendar) l.get(0));

        // Already removed
        schema.removeSequenceDateValue("test:importantDates", c1);
        l = schema.getSequenceDateList("test:importantDates");
        assertEquals(1, l.size());
        assertEquals(c2, (Calendar) l.get(0));

        // Duplicates Allowed
        schema.addSequenceDateValue("test:importantDates", c2);
        l = schema.getSequenceDateList("test:importantDates");
        assertEquals(2, l.size());
        assertEquals(c2, (Calendar) l.get(0));
        assertEquals(c2, (Calendar) l.get(1));

        // Remvoes all
        schema.removeSequenceDateValue("test:importantDates", c2);
        l = schema.getSequenceDateList("test:importantDates");
        assertEquals(0, l.size());
    }
View Full Code Here

Examples of org.apache.jempbox.xmp.XMPSchema

     */
    public void testRDFDescription() throws IOException, ParserConfigurationException
    {
        // Check constructor using an element
        XMPMetadata xmp = new XMPMetadata();
        XMPSchema basic = new XMPSchema(xmp, "test", "http://test.com/test");

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

        // Then Check using the Document Builder Factory
        DocumentBuilderFactory builderFactory = DocumentBuilderFactory
                .newInstance();
        DocumentBuilder builder = builderFactory.newDocumentBuilder();
        Element e = builder.newDocument().createElement("rdf:Description");

        XMPSchema schema = new XMPSchema(e, "test");

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

Examples of org.apache.jempbox.xmp.XMPSchema

     * @throws IOException Signals an error with the XMP processing.
     */
    public void testTextProperty() throws IOException
    {
        XMPMetadata xmp = new XMPMetadata();
        XMPSchema schema = new XMPSchema(xmp, "test", "http://test.com/test");

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

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

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

        schema.setTextProperty("test:title",
                "Bacon's Dictum and Healey's Heaven");

        e = schema.getElement();
        assertEquals("Bacon's Dictum and Healey's Heaven", e
                .getAttribute("test:title"));

        assertEquals("Bacon's Dictum and Healey's Heaven", schema
                .getTextProperty("test:title"));

        schema
                .setTextProperty(
                        "test: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.",
                schema.getTextProperty("test:abstract"));
    }
View Full Code Here

Examples of org.apache.jempbox.xmp.XMPSchema

     * @throws IOException Signals an error with the XMP processing.
     */
    public void testIntegerProperty() throws IOException
    {
        XMPMetadata xmp = new XMPMetadata();
        XMPSchema schema = new XMPSchema(xmp, "test", "http://test.com/test");
       
        schema.setIntegerProperty("test:intvalue", new Integer(14));
       
        Element e = schema.getElement();
        assertEquals("14", e.getAttribute("test:intvalue"));
       
        assertEquals(new Integer(14),schema.getIntegerProperty("test:intvalue"));
       
        schema.setIntegerProperty("test:intvalue",new Integer(16));
       
        e = schema.getElement();
        assertEquals("16", e.getAttribute("test:intvalue"));
       
        assertEquals(new Integer(16), schema.getIntegerProperty("test:intvalue"));
    }
View Full Code Here

Examples of org.apache.jempbox.xmp.XMPSchema

     */
    public void testBags() throws IOException
    {

        XMPMetadata xmp = new XMPMetadata();
        XMPSchema schema = new XMPSchema(xmp, "test", "http://test.com/test");

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

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

Examples of org.apache.jempbox.xmp.XMPSchema

     * @throws IOException Signals an error with the XMP processing.
     */
    public void testSeqList() throws IOException
    {
        XMPMetadata xmp = new XMPMetadata();
        XMPSchema schema = new XMPSchema(xmp, "test", "http://test.com/test");

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

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

            assertEquals(2, l.size());

            assertEquals("Tom DeMarco", l.get(0));
            assertEquals("Kent Beck", l.get(1));
        }
        {
            schema.removeSequenceValue("author", "Tom DeMarco");
            List<String> l = schema.getSequenceList("author");
            assertEquals(1, l.size());
            assertTrue(l.get(0).equals("Kent Beck"));
        }
        { // Already removed
            schema.removeSequenceValue("author", "Tom DeMarco");
            List<String> l = schema.getSequenceList("author");
            assertEquals(1, l.size());
            assertTrue(l.get(0).equals("Kent Beck"));
        }
        { // Duplicates allowed!
            schema.addSequenceValue("author", "Kent Beck");
            List<String> l = schema.getSequenceList("author");
            assertEquals(2, l.size());
            assertTrue(l.get(0).equals("Kent Beck"));
            assertTrue(l.get(1).equals("Kent Beck"));
        }
        { // Remvoes all
            schema.removeSequenceValue("author", "Kent Beck");
            List<String> l = schema.getSequenceList("author");
            assertEquals(0, l.size());
        }
    }
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.