try {
/*
* To test usability of the digital object instance in web services,
* we simply pass one into the service and expect one back:
*/
DigitalObject input = new DigitalObject.Builder(
Content
.byReference(new File(
"PA/sanselan/test/resources/PlanetsLogo-lowq-png.test")
.toURI().toURL())).permanentUri(
URI.create("http://some")).build();
System.out.println("Input: " + input);
FormatRegistry format = FormatRegistryFactory.getFormatRegistry();
MigrateResult mr = dom.migrate(input, format.createExtensionUri("png"),
format.createExtensionUri("gif"), null);
ServiceReport sr = mr.getReport();
System.out.println("Got Report: " + sr);
DigitalObject doOut = mr.getDigitalObject();
assertTrue("Resulting digital object is null.", doOut != null);
System.out.println("Output: " + doOut);
System.out.println("Output.content: " + doOut.getContent());
File out = new File("PA/sanselan/test/results/test.gif");
DigitalObjectUtils.toFile(doOut, out);
} catch (MalformedURLException e) {
e.printStackTrace();