public void testSelectors() throws Exception { System.out.println("Running TestManagementNotifications.testSelectors..."); messageConsumer.close(); String messageSelector = "methodName LIKE 'ingest%'"; messageConsumer = jmsSession.createConsumer(destination, messageSelector); messageConsumer.setMessageListener(this); // Ingest - message should be delivered String pid = apim.ingest(demo998FOXMLObjectXML, FOXML1_1.uri, "ingesting new foxml object"); assertNotNull(pid); checkNotification(pid, "ingest"); // Purge - message selector should prevent message from being delivered String purgeResult = apim.purgeObject(pid, "Purging object " + pid, false); assertNotNull(purgeResult); checkNoNotifications(); }
public static void purge(FedoraAPIM skeleton, String pid, String logMessage, boolean force) throws RemoteException, IOException { skeleton.purgeObject(pid, logMessage, force); }
/** * Tests notifications on 1) ingest 2) modifyObject 3) addRelationship 4) purgeRelationship 5) * purgeObject * * @throws Exception */ public void testObjectMethodNotifications() throws Exception { // (1) test ingest System.out.println("Running TestManagementNotifications.testIngest..."); String pid = apim.ingest(demo998FOXMLObjectXML, FOXML1_1.uri, "ingesting new foxml object"); assertNotNull(pid); // Check on the notification produced by ingest checkNotification(pid, "ingest"); // (2) test modifyObject System.out.println("Running TestManagementNotifications.testModifyObject..."); String modifyResult = apim.modifyObject( pid, "I", "Updated Object Label", null, "Changed state to inactive and updated label"); assertNotNull(modifyResult); // Check on the notification produced by modifyObject checkNotification(pid, "modifyObject"); // (3a) test addRelationship - pid System.out.println("Running TestManagementNotifications.testAddRelationship..."); boolean addRelResult = apim.addRelationship(pid, "rel:isRelatedTo", "demo:5", false, null); assertTrue(addRelResult); // Check on the notification produced by addRelationship checkNotification(pid, "addRelationship"); // (3b) test addRelationship - object uri System.out.println("Running TestManagementNotifications.testAddRelationship..."); addRelResult = apim.addRelationship(PID.toURI(pid), "rel:isRelatedTo", "demo:6", false, null); assertTrue(addRelResult); // Check on the notification produced by addRelationship checkNotification(pid, "addRelationship"); // (3c) test addRelationship - datastream uri System.out.println("Running TestManagementNotifications.testAddRelationship..."); addRelResult = apim.addRelationship(PID.toURI(pid) + "/DS1", "rel:isRelatedTo", "demo:7", false, null); assertTrue(addRelResult); // Check on the notification produced by addRelationship checkNotification(pid, "addRelationship"); // (4a) test purgeRelationship - pid System.out.println("Running TestManagementNotifications.testPurgeRelationship..."); boolean purgeRelResult = apim.purgeRelationship(pid, "rel:isRelatedTo", "demo:5", false, null); assertTrue(purgeRelResult); // Check on the notification produced by purgeRelationship checkNotification(pid, "purgeRelationship"); // (4b) test purgeRelationship - object uri System.out.println("Running TestManagementNotifications.testPurgeRelationship..."); purgeRelResult = apim.purgeRelationship(PID.toURI(pid), "rel:isRelatedTo", "demo:6", false, null); assertTrue(purgeRelResult); // Check on the notification produced by purgeRelationship checkNotification(pid, "purgeRelationship"); // (4c) test purgeRelationship - datastream uri System.out.println("Running TestManagementNotifications.testPurgeRelationship..."); purgeRelResult = apim.purgeRelationship(PID.toURI(pid) + "/DS1", "rel:isRelatedTo", "demo:7", false, null); assertTrue(purgeRelResult); // Check on the notification produced by purgeRelationship checkNotification(pid, "purgeRelationship"); // (5) test purgeObject System.out.println("Running TestManagementNotifications.testPurgeObject..."); String purgeResult = apim.purgeObject(pid, "Purging object " + pid, false); assertNotNull(purgeResult); // Check on the notification produced by purgeObject checkNotification(pid, "purgeObject"); }