All Downloads are FREE. Search and download functionalities are using the official Maven repository.

test.junit.fedora.server.resourceIndex.ResourceIndexAddDelMiscIntegrationTest Maven / Gradle / Ivy

Go to download

The Fedora Client is a Java Library that allows API access to a Fedora Repository. The client is typically one part of a full Fedora installation.

The newest version!
package fedora.server.resourceIndex;

import java.util.Collections;
import java.util.Set;

import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import org.jrdf.graph.Triple;

import fedora.server.storage.types.DigitalObject;

/**
 * Miscellaneous tests of adding and deleting objects from the RI.
 *
 * Note: All tests run at RI level 1 unless otherwise noted.
 *
 * @author [email protected]
 */
public class ResourceIndexAddDelMiscIntegrationTest
        extends ResourceIndexIntegrationTest {

    /**
     * Add, then delete an object with the RI at level 0.
     *
     * This test ensures that adds and deletes at level 0 don't do anything.
     */
    @Test
    public void testAddDelObjLv0()
            throws Exception {
        Set objects = getTestObjects(1, 0);

        // add at level 0
        initRI(0);
        addAll(objects, true);

        assertEquals("Did not get expected triples after add",
                     Collections.EMPTY_SET,
                     getActualTriples());

        // add at level 1
        initRI(1);
        addAll(objects, true);
        Set expected = getExpectedTriples(1, objects);

        // delete at level 0
        initRI(0);
        deleteAll(objects, true);

        assertTrue("Did not get expected triples after delete",
                   sameTriples(expected, getActualTriples(), true));
    }

    /**
     * Add, then delete several objects, each with one datastream.
     */
    @Test
    public void testAddDelMultiObjOneDS()
            throws Exception {
        Set objects = getTestObjects(5, 1);
        doAddDelTest(1, objects);
    }

    /**
     * Add, then delete several objects, each with several datastreams.
     */
    @Test
    public void testAddDelMultiObjMultiDS()
            throws Exception {
        Set objects = getTestObjects(5, 5);
        doAddDelTest(1, objects);
    }

    // Supports legacy test runners
    public static junit.framework.Test suite() {
        return new junit.framework.JUnit4TestAdapter(
                ResourceIndexAddDelMiscIntegrationTest.class);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy