Search in sources :

Example 1 with ActivityEvent

use of org.codice.ddf.activities.ActivityEvent in project ddf by codice.

the class ActivityControllerTest method testHandleEventThrowsIllegalArgumentExceptionOnEmptyUserAndSessionId.

/**
     * 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 empty.
     */
@Test(expected = IllegalArgumentException.class)
public void testHandleEventThrowsIllegalArgumentExceptionOnEmptyUserAndSessionId() {
    testEventProperties.put(ActivityEvent.USER_ID_KEY, "");
    testEventProperties.put(ActivityEvent.SESSION_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 2 with ActivityEvent

use of org.codice.ddf.activities.ActivityEvent in project ddf by codice.

the class ActivityControllerTest method testHandleEventThrowsIllegalArgumentExceptionOnEmptyMessage.

/**
     * Test method for {@link ActivityController#handleEvent(org.osgi.service.event.Event)}
     *
     * Verifies that {@code IllegalArgumentException} is thrown when
     * {@code Event}'s {@link ActivityEvent#MESSAGE_KEY} property is
     * empty.
     */
@Test(expected = IllegalArgumentException.class)
public void testHandleEventThrowsIllegalArgumentExceptionOnEmptyMessage() {
    testEventProperties.put(ActivityEvent.MESSAGE_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 3 with ActivityEvent

use of org.codice.ddf.activities.ActivityEvent 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 4 with ActivityEvent

use of org.codice.ddf.activities.ActivityEvent 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 5 with ActivityEvent

use of org.codice.ddf.activities.ActivityEvent 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)

Aggregations

ActivityEvent (org.codice.ddf.activities.ActivityEvent)9 Event (org.osgi.service.event.Event)9 Test (org.junit.Test)7 Date (java.util.Date)2 HashMap (java.util.HashMap)2 Action (ddf.action.Action)1 ActivityStatus (org.codice.ddf.activities.ActivityEvent.ActivityStatus)1 Notification (org.codice.ddf.notifications.Notification)1 ServiceReference (org.osgi.framework.ServiceReference)1 EventAdmin (org.osgi.service.event.EventAdmin)1