Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added basic sanity integration test.
- Loading branch information
1 parent
c4cba57
commit 5284e9c
Showing
5 changed files
with
334 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/test/java/org/fcrepo/migration/handlers/BasicObjectVersionHandlerIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package org.fcrepo.migration.handlers; | ||
|
||
import junit.framework.Assert; | ||
import org.fcrepo.client.FedoraException; | ||
import org.fcrepo.client.FedoraRepository; | ||
import org.fcrepo.migration.Migrator; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
import org.slf4j.Logger; | ||
import org.springframework.context.ConfigurableApplicationContext; | ||
import org.springframework.context.support.ClassPathXmlApplicationContext; | ||
|
||
import javax.xml.stream.XMLStreamException; | ||
|
||
import static org.slf4j.LoggerFactory.getLogger; | ||
|
||
/** | ||
* @author mdurbin | ||
*/ | ||
public class BasicObjectVersionHandlerIT { | ||
|
||
final static Logger LOGGER = getLogger(BasicObjectVersionHandlerIT.class); | ||
|
||
private static FedoraRepository repo; | ||
|
||
@BeforeClass | ||
public static void migrateTestData() throws XMLStreamException { | ||
final ConfigurableApplicationContext context = | ||
new ClassPathXmlApplicationContext("spring/it-setup.xml"); | ||
final Migrator m = (Migrator) context.getBean("migrator"); | ||
repo = (FedoraRepository) context.getBean("fedora4Client"); | ||
m.run(); | ||
context.close(); | ||
} | ||
|
||
@Test | ||
public void testObjectsWereCreated() throws FedoraException { | ||
Assert.assertTrue(repo.exists("migrated-fedora3/example/1")); | ||
Assert.assertTrue(repo.exists("migrated-fedora3/example/2")); | ||
} | ||
|
||
@Test | ||
public void testPlaceholdersWereCreated() throws FedoraException { | ||
Assert.assertTrue(repo.exists("migrated-fedora3/cmodel/1")); | ||
} | ||
|
||
@Test | ||
public void testExample1DatastreamsWereCreated() throws FedoraException { | ||
for (String dsid : new String[] { "DS1", "DS2", "DS3", "DS4" }) { | ||
Assert.assertTrue(repo.exists("migrated-fedora3/example/1/" + dsid)); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<foxml:digitalObject VERSION="1.1" PID="example:2" xmlns:foxml="info:fedora/fedora-system:def/foxml#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="info:fedora/fedora-system:def/foxml# http://www.fedora.info/definitions/1/0/foxml1-1.xsd"> | ||
<foxml:objectProperties> | ||
<foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/> | ||
<foxml:property NAME="info:fedora/fedora-system:def/model#label" VALUE="This is an an example object with a relationship to another object."/> | ||
<foxml:property NAME="info:fedora/fedora-system:def/model#ownerId" VALUE=""/> | ||
<foxml:property NAME="info:fedora/fedora-system:def/model#createdDate" VALUE="2015-05-01T15:43:28.868Z"/> | ||
<foxml:property NAME="info:fedora/fedora-system:def/view#lastModifiedDate" VALUE="2015-05-01T19:22:14.507Z"/> | ||
</foxml:objectProperties> | ||
<foxml:datastream ID="AUDIT" STATE="A" CONTROL_GROUP="X" VERSIONABLE="false"> | ||
<foxml:datastreamVersion ID="AUDIT.0" LABEL="Audit Trail for this object" CREATED="2015-05-01T15:43:28.868Z" MIMETYPE="text/xml" FORMAT_URI="info:fedora/fedora-system:format/xml.fedora.audit"> | ||
<foxml:xmlContent> | ||
<audit:auditTrail xmlns:audit="info:fedora/fedora-system:def/audit#"> | ||
<audit:record ID="AUDREC1"> | ||
<audit:process type="Fedora API-M"/> | ||
<audit:action>addDatastream</audit:action> | ||
<audit:componentID>RELS-EXT</audit:componentID> | ||
<audit:responsibility>fedoraAdmin</audit:responsibility> | ||
<audit:date>2015-05-01T19:22:14.507Z</audit:date> | ||
<audit:justification/> | ||
</audit:record> | ||
</audit:auditTrail> | ||
</foxml:xmlContent> | ||
</foxml:datastreamVersion> | ||
</foxml:datastream> | ||
<foxml:datastream ID="DC" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true"> | ||
<foxml:datastreamVersion ID="DC1.0" LABEL="Dublin Core Record for this object" CREATED="2015-05-01T15:43:28.868Z" MIMETYPE="text/xml" FORMAT_URI="http://www.openarchives.org/OAI/2.0/oai_dc/" SIZE="429"> | ||
<foxml:xmlContent> | ||
<oai_dc:dc xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd"> | ||
<dc:title>This is an an example object with a relationship to another object.</dc:title> | ||
<dc:identifier>example:2</dc:identifier> | ||
</oai_dc:dc> | ||
</foxml:xmlContent> | ||
</foxml:datastreamVersion> | ||
</foxml:datastream> | ||
<foxml:datastream ID="RELS-EXT" STATE="A" CONTROL_GROUP="X" VERSIONABLE="true"> | ||
<foxml:datastreamVersion ID="RELS-EXT.0" LABEL="Fedora object to object relationships." CREATED="2015-05-01T19:22:14.507Z" MIMETYPE="application/rdf+xml" SIZE="381"> | ||
<foxml:xmlContent> | ||
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> | ||
<rdf:Description rdf:about="info:fedora/example:2"> | ||
<isPartOf xmlns="info:fedora/fedora-system:def/relations-external#" rdf:resource="info:fedora/example:1"/> | ||
<hasModel xmlns="info:fedora/fedora-system:def/model#" rdf:resource="info:fedora/cmodel:1"/> | ||
</rdf:Description> | ||
</rdf:RDF> | ||
</foxml:xmlContent> | ||
</foxml:datastreamVersion> | ||
</foxml:datastream> | ||
</foxml:digitalObject> |
Oops, something went wrong.