/** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { apim = s_client.getAPIM(); apia = s_client.getAPIA(); System.setProperty("fedoraServerHost", "localhost"); System.setProperty("fedoraServerPort", "8080"); }
/** * Test for the existence of a given datastream in VITAL. * * @param fedora An instantiated fedora client * @param vitalPid The VITAL PID to use * @param dsPid The datastream ID on the object * @returns boolean True is found, False if not found or there are errors */ private boolean datastreamExists(FedoraClient fedora, String vitalPid, String dsPid) { try { // Some options: // * getAPIA().listDatastreams... seems best // * getAPIM().getDatastream... causes Exceptions against new IDs // * getAPIM().getDatastreams... is limited to a single state DatastreamDef[] streams = fedora.getAPIA().listDatastreams( vitalPid, null); for (DatastreamDef stream : streams) { if (stream.getID().equals(dsPid)) { return true; } } } catch (Exception ex) { log.error("API Query error: ", ex); } return false; }
@Before public void setUp() throws Exception { apim = s_client.getAPIM(); apia = s_client.getAPIA(); Map<String, String> nsMap = new HashMap<String, String>(); nsMap.put("oai_dc", "http://www.openarchives.org/OAI/2.0/oai_dc/"); nsMap.put("dc", "http://purl.org/dc/elements/1.1/"); nsMap.put("foxml", "info:fedora/fedora-system:def/foxml#"); NamespaceContext ctx = new SimpleNamespaceContext(nsMap); XMLUnit.setXpathNamespaceContext(ctx); // not really necessary, but will cope with any junk left from other tests purgeDemoObjects(s_client); }