test.junit.fedora.server.resourceIndex.ResourceIndexModDSIntegrationTest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fcrepo-client Show documentation
Show all versions of fcrepo-client Show documentation
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 org.junit.Test;
import fedora.server.storage.types.DigitalObject;
/**
* Tests modifying objects in the RI, with respect to their datastreams.
*
* Note: All tests run at RI level 1 unless otherwise noted.
*
* @author [email protected]
*/
public class ResourceIndexModDSIntegrationTest
extends ResourceIndexIntegrationTest {
/**
* Add a datastream to an existing object.
*/
@Test
public void testModObjOnceAddDS()
throws Exception {
DigitalObject original = getTestObject("test:1", "test1");
DigitalObject modified = deepCopy(original);
addEDatastream(modified, "DS1");
doModifyTest(1, original, modified);
}
/**
* Delete a datastream from an existing object.
*/
@Test
public void testModObjOnceDelDS()
throws Exception {
DigitalObject original = getTestObject("test:1", "test1");
addEDatastream(original, "DS1");
DigitalObject modified = deepCopy(original);
modified.datastreams("DS1").clear();
doModifyTest(1, original, modified);
}
/**
* Add a datastream and delete another from an existing object.
*/
@Test
public void testModObjOnceAddOneDSDelAnother()
throws Exception {
DigitalObject original = getTestObject("test:1", "test1");
addEDatastream(original, "DS1");
DigitalObject modified = deepCopy(original);
addEDatastream(modified, "DS2");
modified.datastreams("DS1").clear();
doModifyTest(1, original, modified);
}
/**
* Add a Dublin Core field to the DC datastream of an existing object.
*/
@Test
public void testModObjOnceAddOneDCField()
throws Exception {
DigitalObject original = getTestObject("test:1", "test1");
addXDatastream(original, "DC", getDC("test "));
DigitalObject modified = deepCopy(original);
addXDatastream(modified, "DC", getDC("test \n"
+ "id "));
doModifyTest(1, original, modified);
}
/**
* Delete a Dublin Core field from the DC datastream of an existing object.
*/
@Test
public void testModObjOnceDelOneDCField()
throws Exception {
DigitalObject original = getTestObject("test:1", "test1");
addXDatastream(original, "DC", getDC("test \n"
+ "id "));
DigitalObject modified = deepCopy(original);
addXDatastream(modified, "DC", getDC("test "));
doModifyTest(1, original, modified);
}
/**
* Add a Dublin Core field and delete another from the DC datastream of
* an existing object.
*/
@Test
public void testModObjOnceAddOneDCFieldDelAnother()
throws Exception {
DigitalObject original = getTestObject("test:1", "test1");
addXDatastream(original, "DC", getDC("test "));
DigitalObject modified = deepCopy(original);
addXDatastream(modified, "DC", getDC("id "));
doModifyTest(1, original, modified);
}
/**
* Add a relation to the RELS-EXT datastream of an existing object.
*/
@Test
public void testModObjOnceAddOneRELSEXTField()
throws Exception {
String rel1 = "";
String rel2 = "";
DigitalObject original = getTestObject("test:1", "test1");
addXDatastream(original, "RELS-EXT", getRELSEXT(rel1));
DigitalObject modified = deepCopy(original);
addXDatastream(modified, "RELS-EXT", getRELSEXT(rel1 + "\n" + rel2));
doModifyTest(1, original, modified);
}
/**
* Delete a relation from the RELS-EXT datastream of an existing object.
*/
@Test
public void testModObjOnceDelOneRELSEXTField()
throws Exception {
String rel1 = "";
String rel2 = "";
DigitalObject original = getTestObject("test:1", "test1");
addXDatastream(original, "RELS-EXT", getRELSEXT(rel1 + "\n" + rel2));
DigitalObject modified = deepCopy(original);
addXDatastream(modified, "RELS-EXT", getRELSEXT(rel1));
doModifyTest(1, original, modified);
}
/**
* Add a relation and delete another from the RELS-EXT datastream of an
* existing object.
*/
@Test
public void testModObjOnceAddOneRELSEXTFieldDelAnother()
throws Exception {
String rel1 = "";
String rel2 = "";
DigitalObject original = getTestObject("test:1", "test1");
addXDatastream(original, "RELS-EXT", getRELSEXT(rel1));
DigitalObject modified = deepCopy(original);
addXDatastream(modified, "RELS-EXT", getRELSEXT(rel2));
doModifyTest(1, original, modified);
}
// Supports legacy test runners
public static junit.framework.Test suite() {
return new junit.framework.JUnit4TestAdapter(
ResourceIndexModDSIntegrationTest.class);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy