Search in sources :

Example 1 with EventDisplayCommand

use of org.apache.karaf.event.command.EventDisplayCommand in project karaf by apache.

the class EventDisplayCommandTest method testExecute.

@Test
public void testExecute() throws Exception {
    IMocksControl c = createControl();
    EventDisplayCommand display = new EventDisplayCommand();
    display.session = c.createMock(Session.class);
    expect(display.session.getConsole()).andReturn(System.out);
    display.collector = new EventCollector();
    display.collector.handleEvent(new Event("myTopic", new HashMap<>()));
    c.replay();
    display.execute();
    c.verify();
}
Also used : IMocksControl(org.easymock.IMocksControl) EventDisplayCommand(org.apache.karaf.event.command.EventDisplayCommand) HashMap(java.util.HashMap) EventCollector(org.apache.karaf.event.service.EventCollector) Event(org.osgi.service.event.Event) Session(org.apache.karaf.shell.api.console.Session) Test(org.junit.Test)

Aggregations

HashMap (java.util.HashMap)1 EventDisplayCommand (org.apache.karaf.event.command.EventDisplayCommand)1 EventCollector (org.apache.karaf.event.service.EventCollector)1 Session (org.apache.karaf.shell.api.console.Session)1 IMocksControl (org.easymock.IMocksControl)1 Test (org.junit.Test)1 Event (org.osgi.service.event.Event)1