agave-files/files-core/src/test/java/org/iplantc/service/io/notifications/LogicalFileNotificationIT.java
/**
	 * Executes a nofication event processing.
	 * 
	 * @param logicalFile
	 * @param eventType
	 * @throws Exception
	 */
Executes a nofication event processing.

@param logicalFile
@param eventType
@throws Exception
Executes a nofication event processing . @param logicalFile @param eventType @throws Exception
private void processNotification(LogicalFile logicalFile, FileEventType eventType)
	throws Exception
    {
		notificationProcessed.set(false);
	    logicalFile.setStatus(eventType.name());
	    LogicalFileDao.persist(logicalFile);
		logicalFile.addContentEvent(new FileEvent(
				eventType, 
                "Logical file " + logicalFile.getPublicLink() + " recieved " + eventType.name() + " event.", 
                logicalFile.getOwner()));
		LogicalFileDao.persist(logicalFile);
		int i = 0;
		while(!notificationProcessed.get() && i < 5) {
		    Thread.sleep(1000);
		    i++;
		}
		List<Notification> notifications = notificationDao.getActiveForAssociatedUuidAndEvent(logicalFile.getUuid(), eventType.name());
		Assert.assertFalse(notifications.isEmpty(), "No notifications found for status " + eventType.name());
		Assert.assertEquals(notifications.size(), 1, "Wrong number of notifications returned for status " + eventType.name() + " ");
		Notification n = notifications.get(0);
		NotificationAttempt lastAttempt = FailedNotificationAttemptQueue.getInstance().next(logicalFile.getUuid());
		Assert.assertNull(lastAttempt, "Failed notification attempt should not be present for successfully processed notification.");
	}
private void processNotification ( LogicalFile logicalFile , FileEventType eventType ) throws Exception { notificationProcessed . set ( false ) ; logicalFile . setStatus ( eventType . name ( ) ) ; LogicalFileDao . persist ( logicalFile ) ; logicalFile . addContentEvent ( new FileEvent ( eventType , "Logical file " + logicalFile . getPublicLink ( ) + " recieved " + eventType . name ( ) + " event." , logicalFile . getOwner ( ) ) ) ; LogicalFileDao . persist ( logicalFile ) ; int i = 0 ; while ( ! notificationProcessed . get ( ) && i < 5 ) { Thread . sleep ( 1000 ) ; i ++ ; } List < Notification > notifications = notificationDao . getActiveForAssociatedUuidAndEvent ( logicalFile . getUuid ( ) , eventType . name ( ) ) ; Assert . assertFalse ( notifications . isEmpty ( ) , "No notifications found for status " + eventType . name ( ) ) ; Assert . assertEquals ( notifications . size ( ) , 1 , "Wrong number of notifications returned for status " + eventType . name ( ) + " " ) ; Notification n = notifications . get ( 0 ) ; NotificationAttempt lastAttempt = FailedNotificationAttemptQueue . getInstance ( ) . next ( logicalFile . getUuid ( ) ) ; Assert . assertNull ( lastAttempt , "Failed notification attempt should not be present for successfully processed notification." ) ; }
Executes a nofication event processing.
Executes a nofication event processing .
// update logicalFile status // force the queue listener to fire. This should pull the logicalFile message off the queue and notifiy us //queueListener.execute(null); //		Assert.assertEquals(n.getStatus(), NotificationStatusType.ACTIVE, //				"Message for status " + eventType.name() + " was successfully sent.");