org.openbandy.example.test
Class EventServiceTest

java.lang.Object
  extended by org.openbandy.test.Test
      extended by org.openbandy.example.test.EventServiceTest
All Implemented Interfaces:
java.lang.Runnable, EventSink, EventSourceOwner

public class EventServiceTest
extends Test
implements EventSink, EventSourceOwner

A very simple test of the event router. This test assures that only events of the type for which a sink has registered at the event router are delegated. Moreover, in order to pass, this test must check that the number of sent events corresponds with the number of received events.

(c) Copyright Philipp Bolliger 2007, ALL RIGHTS RESERVED.

Version:
1.0
Author:
Philipp Bolliger (philipp@bolliger.name)

Constructor Summary
EventServiceTest()
           
 
Method Summary
 void absorb(Event event)
          This method is called by the EventService whenever it has an event this sink subscribed for.
 java.util.Vector getAbsorbedEventTypes()
          While subscribing at the EventService, the latter will request the EventSink to state the types of Events it will absorb.
 void lostEventSource(java.lang.String eventShortClassName)
          Using this callback, the EventService will inform subscribed sinks about the loss of the EventSource that formerly generated Events of type eventShortClassName.
 void run()
           
 void setNewInstance(EventSource newEventSourceInstance)
          Call-back to update a reference to an EventSource
 
Methods inherited from class org.openbandy.test.Test
getName, setTestsScreen, start
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventServiceTest

public EventServiceTest()
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable

getAbsorbedEventTypes

public java.util.Vector getAbsorbedEventTypes()
Description copied from interface: EventSink
While subscribing at the EventService, the latter will request the EventSink to state the types of Events it will absorb.

Specified by:
getAbsorbedEventTypes in interface EventSink
Returns:
A Vector of Strings containing the short class names of the Events.

absorb

public void absorb(Event event)
Description copied from interface: EventSink
This method is called by the EventService whenever it has an event this sink subscribed for.

Specified by:
absorb in interface EventSink
Parameters:
event - The Event that was forwarded to the sink.

lostEventSource

public void lostEventSource(java.lang.String eventShortClassName)
Description copied from interface: EventSink
Using this callback, the EventService will inform subscribed sinks about the loss of the EventSource that formerly generated Events of type eventShortClassName.

Specified by:
lostEventSource in interface EventSink
Parameters:
eventShortClassName - The short class name of the Event that will not be generated no more.

setNewInstance

public void setNewInstance(EventSource newEventSourceInstance)
Description copied from interface: EventSourceOwner
Call-back to update a reference to an EventSource

Specified by:
setNewInstance in interface EventSourceOwner
Parameters:
newEventSourceInstance - Reference to the new Instance