
test.junit.fedora.test.integration.TestCommandLineUtilities 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.test.integration;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.custommonkey.xmlunit.SimpleXpathEngine;
import fedora.client.FedoraClient;
import fedora.server.management.FedoraAPIM;
import fedora.test.DemoObjectTestSetup;
import fedora.test.FedoraServerTestCase;
import fedora.utilities.ExecUtility;
/**
* @author Edwin Shin
*
*/
public class TestCommandLineUtilities extends FedoraServerTestCase
{
static ByteArrayOutputStream sbOut = null;
static ByteArrayOutputStream sbErr = null;
static TestCommandLineUtilities curTest = null;
public static Test suite()
{
TestSuite suite = new TestSuite("Command Line Utilities TestSuite");
suite.addTestSuite(TestCommandLineUtilities.class);
return new DemoObjectTestSetup(suite);
}
public void testFedoraPurgeAndIngest()
{
System.out.println("Purging object demo:5");
System.out.println("FEDORA-HOME = " + FEDORA_HOME);
purgeUsingScript("demo:5");
assertEquals(0, sbErr.size());
System.out.println("Re-ingesting object demo:5");
ingestFoxmlFile(new File(FEDORA_HOME + "/client/demo/foxml/local-server-demos/simple-image-demo/obj_demo_5.xml"));
String out = sbOut.toString();
String err = sbErr.toString();
assertEquals(out.indexOf("Ingested PID: demo:5")!= -1, true );
System.out.println("Purge and ingest test succeeded");
}
public void testBatchBuildAndBatchIngestAndPurge() throws Exception
{
System.out.println("Building batch objects");
batchBuild(new File(FEDORA_HOME + "/client/demo/batch-demo/foxml-template.xml"),
new File(FEDORA_HOME + "/client/demo/batch-demo/object-specifics"),
new File(FEDORA_HOME + "/client/demo/batch-demo/objects"),
new File(FEDORA_HOME + "/client/logs/build.log"));
String out = sbOut.toString();
String err = sbErr.toString();
assertEquals(err, true, err.indexOf("10 Fedora FOXML XML documents successfully created")!= -1);
System.out.println("Ingesting batch objects");
batchIngest(new File(FEDORA_HOME + "/client/demo/batch-demo/objects"),
new File(FEDORA_HOME + "/server/logs/junit_ingest.log"));
out = sbOut.toString();
err = sbErr.toString();
assertEquals(err.indexOf("10 objects successfully ingested into Fedora")!= -1, true );
String batchObjs[] = { "demo:3010", "demo:3011", "demo:3012", "demo:3013", "demo:3014",
"demo:3015", "demo:3016", "demo:3017", "demo:3018", "demo:3019"};
System.out.println("Purging batch objects");
purgeFast(batchObjs);
System.out.println("Build and ingest test succeeded");
}
public void testBatchBuildIngestAndPurge() throws Exception
{
System.out.println("Building and Ingesting batch objects");
batchBuildIngest(new File(FEDORA_HOME + "/client/demo/batch-demo/foxml-template.xml"),
new File(FEDORA_HOME + "/client/demo/batch-demo/object-specifics"),
new File(FEDORA_HOME + "/client/demo/batch-demo/objects"),
new File(FEDORA_HOME + "/server/logs/junit_buildingest.log"));
String out = sbOut.toString();
String err = sbErr.toString();
assertEquals("Response did not contain expected string re: FOXML XML documents: " + err + "", err.indexOf("10 Fedora FOXML XML documents successfully created")!= -1, true );
assertEquals("Response did not contain expected string re: objects successfully ingested: " + err + "
© 2015 - 2025 Weber Informatics LLC | Privacy Policy