Search in sources :

Example 41 with Event

use of org.osgi.service.event.Event in project ddf by codice.

the class ActivityControllerTest method testHandleEventThrowsIllegalArgumentExceptionOnNullTimestamp.

/**
     * Test method for {@link ActivityController#handleEvent(org.osgi.service.event.Event)}
     *
     * Verifies that {@code IllegalArgumentException} is thrown when
     * {@code Event}'s {@link ActivityEvent#TIMESTAMP_KEY} property
     * is null.
     */
@Test(expected = IllegalArgumentException.class)
public void testHandleEventThrowsIllegalArgumentExceptionOnNullTimestamp() {
    testEventProperties.put(ActivityEvent.TIMESTAMP_KEY, null);
    activityController.handleEvent(new Event(ActivityEvent.EVENT_TOPIC, testEventProperties));
}
Also used : ActivityEvent(org.codice.ddf.activities.ActivityEvent) Event(org.osgi.service.event.Event) Test(org.junit.Test)

Example 42 with Event

use of org.osgi.service.event.Event in project ddf by codice.

the class ActivityControllerTest method testHandleEventThrowsIllegalArgumentExceptionOnEmptyApplication.

/**
     * Test method for {@link ActivityController#handleEvent(org.osgi.service.event.Event)}
     *
     * Verifies that {@code IllegalArgumentException} is thrown when
     * {@code Event}'s {@link ActivityEvent#ID_KEY}
     * property is empty.
     */
@Test(expected = IllegalArgumentException.class)
public void testHandleEventThrowsIllegalArgumentExceptionOnEmptyApplication() {
    testEventProperties.put(ActivityEvent.ID_KEY, "");
    activityController.handleEvent(new Event(ActivityEvent.EVENT_TOPIC, testEventProperties));
}
Also used : ActivityEvent(org.codice.ddf.activities.ActivityEvent) Event(org.osgi.service.event.Event) Test(org.junit.Test)

Example 43 with Event

use of org.osgi.service.event.Event in project ddf by codice.

the class ActivityControllerTest method testHandleEventThrowsIllegalArgumentExceptionOnNullApplication.

/**
     * Test method for {@link ActivityController#handleEvent(org.osgi.service.event.Event)}
     *
     * Verifies that {@code IllegalArgumentException} is thrown when
     * {@code Event}'s {@link ActivityEvent#ID_KEY}
     * property is null.
     */
@Test(expected = IllegalArgumentException.class)
public void testHandleEventThrowsIllegalArgumentExceptionOnNullApplication() {
    testEventProperties.put(ActivityEvent.ID_KEY, null);
    activityController.handleEvent(new Event(ActivityEvent.EVENT_TOPIC, testEventProperties));
}
Also used : ActivityEvent(org.codice.ddf.activities.ActivityEvent) Event(org.osgi.service.event.Event) Test(org.junit.Test)

Example 44 with Event

use of org.osgi.service.event.Event in project ddf by codice.

the class ActivityControllerTest method testHandleEventThrowsIllegalArgumentExceptionOnNullUserAndSessionId.

/**
     * Test method for {@link ActivityController#handleEvent(org.osgi.service.event.Event)}
     *
     * Verifies that {@code IllegalArgumentException} is thrown when
     * {@code Event}'s {@link ActivityEvent#USER_ID_KEY} and
     * {@link ActivityEvent#SESSION_ID_KEY} properties are null.
     */
@Test(expected = IllegalArgumentException.class)
public void testHandleEventThrowsIllegalArgumentExceptionOnNullUserAndSessionId() {
    testEventProperties.put(ActivityEvent.USER_ID_KEY, null);
    testEventProperties.put(ActivityEvent.SESSION_ID_KEY, null);
    activityController.handleEvent(new Event(ActivityEvent.EVENT_TOPIC, testEventProperties));
}
Also used : ActivityEvent(org.codice.ddf.activities.ActivityEvent) Event(org.osgi.service.event.Event) Test(org.junit.Test)

Example 45 with Event

use of org.osgi.service.event.Event in project ddf by codice.

the class NotificationControllerTest method testHandleEventThrowsIllegalArgumentExceptionOnEmptyApplication.

/**
     * Test method for {@link NotificationController#handleEvent(org.osgi.service.event.Event)}
     * <p>
     * Verifies that {@code IllegalArgumentException} is thrown when {@code Event}'s
     * {@link Notification#NOTIFICATION_KEY_APPLICATION} property is empty.
     */
@Test(expected = IllegalArgumentException.class)
public void testHandleEventThrowsIllegalArgumentExceptionOnEmptyApplication() {
    testEventProperties.put(Notification.NOTIFICATION_KEY_APPLICATION, "");
    notificationController.handleEvent(new Event(Notification.NOTIFICATION_TOPIC_BROADCAST, testEventProperties));
}
Also used : Event(org.osgi.service.event.Event) Test(org.junit.Test)

Aggregations

Event (org.osgi.service.event.Event)142 Test (org.junit.Test)79 HashMap (java.util.HashMap)48 Hashtable (java.util.Hashtable)44 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)23 ContentTypePredicate (ddf.catalog.pubsub.predicate.ContentTypePredicate)20 EventAdmin (org.osgi.service.event.EventAdmin)19 GeospatialPredicate (ddf.catalog.pubsub.predicate.GeospatialPredicate)18 Predicate (ddf.catalog.pubsub.predicate.Predicate)16 ArrayList (java.util.ArrayList)16 ActivityEvent (org.codice.ddf.activities.ActivityEvent)13 EventHandler (org.osgi.service.event.EventHandler)13 SubscriptionFilterVisitor (ddf.catalog.pubsub.internal.SubscriptionFilterVisitor)11 Date (java.util.Date)11 Job (org.apache.sling.event.jobs.Job)9 Map (java.util.Map)8 List (java.util.List)7 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)7 JobManager (org.apache.sling.event.jobs.JobManager)7 JobConsumer (org.apache.sling.event.jobs.consumer.JobConsumer)7