Examples of DigitalObject


Examples of org.fcrepo.server.storage.types.DigitalObject

    //---
    // Instance Helpers
    //---

    protected void doTestXLinkNamespace() throws TransformerException, XpathException {
        DigitalObject obj = createTestObject(FEDORA_OBJECT_3_0);
        final String url = "http://example.org/DS1";
        DatastreamReferencedContent ds = createRDatastream("DS1", url);
        obj.addDatastreamVersion(ds, true);
        Document xml = doSerializeOrFail(obj);
        String xpath =
                ROOT_PATH + "/" + METS.FILE_SEC.qName + "/"
                        + METS.FILE_GRP.qName + "[@ID='DATASTREAMS']" + "/"
                        + METS.FILE_GRP.qName + "[@ID='DS1']" + "/"
View Full Code Here

Examples of org.fcrepo.server.storage.types.DigitalObject

        doTestXLinkNamespace();
    }

    @Test
    public void testVersionAttribute() throws TransformerException, XpathException {
        DigitalObject obj = createTestObject(FEDORA_OBJECT_3_0);
        Document xml = doSerializeOrFail(obj);
        assertXpathExists(ROOT_PATH + "[@EXT_VERSION = '1.1']", xml);
    }
View Full Code Here

Examples of org.fcrepo.server.storage.types.DigitalObject

    // Tests
    //---

    @Test
    public void testDeserializeKnownFormats() {
        DigitalObject obj1 = null;
        DigitalObject obj2 = null;
        try {
            obj1 = doDeserialize(FORMAT_1);
            obj2 = doDeserialize(FORMAT_2);
        } catch (UnsupportedTranslationException e) {
            fail("Deserialization should have succeeded, but threw "
                    + "UnsupportedTranslationException");
        }
        assertEquals(TEST_PID, obj1.getPid());
        assertEquals(FORMAT_1, obj1.getLabel());
        assertEquals(TEST_PID, obj2.getPid());
        assertEquals(FORMAT_2, obj2.getLabel());
    }
View Full Code Here

Examples of org.fcrepo.server.storage.types.DigitalObject

        assertEquals(FORMAT_2, obj2.getLabel());
    }

    @Test
    public void testDeserializeUnknownFormat() {
        DigitalObject obj = null;
        try {
            obj = doDeserialize(FORMAT_UNKNOWN);
            fail("Deserialization should have failed with "
                    + "UnsupportedTranslationException");
        } catch (UnsupportedTranslationException e) {
View Full Code Here

Examples of org.fcrepo.server.storage.types.DigitalObject

    // Instance helpers
    //---

    private DigitalObject doDeserialize(String format)
            throws UnsupportedTranslationException {
        DigitalObject obj = new BasicDigitalObject();
        try {
            InputStream in = getInputStream(format + "\n" + TEST_PID + "\n");
            m_trans.deserialize(in, obj, format, "UTF-8", 0);
            return obj;
        } catch (UnsupportedTranslationException e) {
View Full Code Here

Examples of org.fcrepo.server.storage.types.DigitalObject

        }
    }

    private String[] doSerialize(String format)
            throws UnsupportedTranslationException {
        DigitalObject obj = new BasicDigitalObject();
        obj.setPid(TEST_PID);
        try {
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            m_trans.serialize(obj, out, format, "UTF-8", 0);
            String[] lines = new String(out.toByteArray(), "UTF-8").split("\n");
            for (int i = 0; i < lines.length; i++) {
View Full Code Here

Examples of org.fcrepo.server.storage.types.DigitalObject

        initRI(1);
        addAll(objects, true);
        Set<Triple> origTriples = getExpectedTriples(1, objects);

        // mod at level 0
        DigitalObject original = (DigitalObject) objects.toArray()[0];
        DigitalObject modified = ObjectBuilder.deepCopy(original);
        modified.setLabel("new label");
        initRI(0);
        modify(original, modified, true);

        assertTrue("Did not get expected orig triples after modify at level 0",
                   sameTriples(origTriples, getActualTriples(), true));
View Full Code Here

Examples of org.fcrepo.server.storage.types.DigitalObject

    /**
     * Modify an object's label once.
     */
    @Test
    public void testModObjOnceLabel() throws Exception {
        DigitalObject original = getTestObject("test:1", "test1");

        DigitalObject modified = ObjectBuilder.deepCopy(original);
        modified.setLabel("new label");

        doModifyTest(1, original, modified);
    }
View Full Code Here

Examples of org.fcrepo.server.storage.types.DigitalObject

    @Test
    public void testModObjMultiLabel() throws Exception {

        // prep by initting at lv 1 and adding original object
        initRI(1);
        DigitalObject previous = getTestObject("test:1", "test1");
        Set<DigitalObject> origSet = new HashSet<DigitalObject>();
        origSet.add(previous);
        addAll(origSet, true);

        // modify the label multiple times
        for (int i = 1; i <= 5; i++) {
            DigitalObject modified = ObjectBuilder.deepCopy(previous);
            modified.setLabel("new label " + i);
            doModifyTest(-1, previous, modified);
            previous = modified;
        }

    }
View Full Code Here

Examples of org.fcrepo.server.storage.types.DigitalObject

    @Test
    public void testModObjMultiLabelAsyncFlush() throws Exception {

        // prep by initting at lv 1 and adding original object
        initRI(1);
        DigitalObject original = getTestObject("test:1", "test1");
        DigitalObject previous = original;
        Set<DigitalObject> origSet = new HashSet<DigitalObject>();
        origSet.add(previous);
        addAll(origSet, true);

        // hold on to the original triples so we can compare later
        Set<Triple> origTriples = getExpectedTriples(1, origSet);

        // modify the label multiple times while flushing
        startFlushing(0);
        try {
            for (int i = 0; i <= 5; i++) {
                DigitalObject modified = ObjectBuilder.deepCopy(previous);
                modified.setLabel("new label " + i);
                modify(previous, modified, false);
                previous = modified;
            }
            // last change puts obj back into original state
            modify(previous, original, false);
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.