OpenNMS API 1.2.3

org.opennms.netmgt.mock
Class OutageAnticipator

java.lang.Object
  extended byorg.opennms.netmgt.mock.OutageAnticipator
All Implemented Interfaces:
EventListener

public class OutageAnticipator
extends java.lang.Object
implements EventListener

Anticipates outages based on events

Author:
brozow

Field Summary
private  MockDatabase m_db
           
private  int m_expectedOpenCount
           
private  int m_expectedOutageCount
           
private  java.util.Set m_expectedOutages
           
private  java.util.Map m_pendingCloses
           
private  java.util.Map m_pendingOpens
           
 
Constructor Summary
OutageAnticipator(MockDatabase db)
           
 
Method Summary
protected  void addToOutageList(java.util.Map outageMap, Event outageEvent, Outage outage)
           
 void anticipateOutageClosed(MockElement element, Event regainService)
           
 void anticipateOutageOpened(MockElement element, Event lostService)
           
 void anticipateReparent(java.lang.String ipAddr, int nodeId, int nodeId2)
           
private  boolean anticipates(java.util.Map pending, MockService svc)
           
protected  boolean anticipatesClose(MockService svc)
           
protected  boolean anticipatesOpen(MockService svc)
           
 boolean checkAnticipated()
           
private  void clearOutageList(java.util.Map pending, Event e)
           
private  void closeExpectedOutages(Event e, Outage pendingOutage)
           
 void deanticipateOutageClosed(MockElement element, Event regainService)
           
 int getActualOpens()
           
 int getActualOutages()
           
 int getExpectedOpens()
           
 int getExpectedOutages()
           
 java.lang.String getName()
          Return the id of the listener
private  java.util.Collection getOutageList(java.util.Map pending, Event e)
           
 void onEvent(Event e)
          Process a sent event.
protected  void removeFromOutageList(java.util.Map outageMap, Event outageEvent, Outage outage)
           
 void reset()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_db

private MockDatabase m_db

m_expectedOpenCount

private int m_expectedOpenCount

m_expectedOutageCount

private int m_expectedOutageCount

m_pendingOpens

private java.util.Map m_pendingOpens

m_pendingCloses

private java.util.Map m_pendingCloses

m_expectedOutages

private java.util.Set m_expectedOutages
Constructor Detail

OutageAnticipator

public OutageAnticipator(MockDatabase db)
Method Detail

reset

public void reset()

anticipateOutageOpened

public void anticipateOutageOpened(MockElement element,
                                   Event lostService)
Parameters:
element -
lostService -

anticipatesClose

protected boolean anticipatesClose(MockService svc)
Parameters:
svc -
Returns:

anticipates

private boolean anticipates(java.util.Map pending,
                            MockService svc)

addToOutageList

protected void addToOutageList(java.util.Map outageMap,
                               Event outageEvent,
                               Outage outage)
Parameters:
outageMap -
outageEvent -

removeFromOutageList

protected void removeFromOutageList(java.util.Map outageMap,
                                    Event outageEvent,
                                    Outage outage)

deanticipateOutageClosed

public void deanticipateOutageClosed(MockElement element,
                                     Event regainService)

anticipateOutageClosed

public void anticipateOutageClosed(MockElement element,
                                   Event regainService)

anticipatesOpen

protected boolean anticipatesOpen(MockService svc)
Parameters:
svc -
Returns:

getExpectedOpens

public int getExpectedOpens()

getActualOpens

public int getActualOpens()

getExpectedOutages

public int getExpectedOutages()

getActualOutages

public int getActualOutages()

checkAnticipated

public boolean checkAnticipated()

getName

public java.lang.String getName()
Description copied from interface: EventListener
Return the id of the listener

Specified by:
getName in interface EventListener

onEvent

public void onEvent(Event e)
Description copied from interface: EventListener
Process a sent event.

Specified by:
onEvent in interface EventListener

closeExpectedOutages

private void closeExpectedOutages(Event e,
                                  Outage pendingOutage)

clearOutageList

private void clearOutageList(java.util.Map pending,
                             Event e)
Parameters:
pending -
e -

getOutageList

private java.util.Collection getOutageList(java.util.Map pending,
                                           Event e)
Parameters:
pending -
e -
Returns:

anticipateReparent

public void anticipateReparent(java.lang.String ipAddr,
                               int nodeId,
                               int nodeId2)
Parameters:
ipAddr -
nodeId -
nodeId2 -

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.