コード例 #1
0
  @Before
  public void setUp() {
    m_node1 = new OnmsNode();
    m_node1.setId(1);

    m_node2 = new OnmsNode();
    m_node2.setId(2);

    m_nodeChennai = new OnmsNode();
    m_nodeChennai.setId(14);

    m_nodeDehli = new OnmsNode();
    m_nodeDehli.setId(10);

    m_alarmDao = EasyMock.createMock(AlarmDao.class);
    m_ospfLinkDao = EasyMock.createMock(OspfLinkDao.class);

    m_statusProvider = new OspfLinkStatusProvider();
    m_statusProvider.setAlarmDao(m_alarmDao);
    m_statusProvider.setOspfLinkDao(m_ospfLinkDao);

    m_edgeProvider = EasyMock.createMock(EdgeProvider.class);
  }
コード例 #2
0
  @Test
  public void testGetOspfLinkStatusDown() {
    EasyMock.expect(
            m_alarmDao.findMatching(EasyMock.anyObject(org.opennms.core.criteria.Criteria.class)))
        .andReturn(createDownAlarm());
    EasyMock.expect(
            m_ospfLinkDao.findMatching(EasyMock.<org.opennms.core.criteria.Criteria>anyObject()))
        .andReturn(createOspfLinks());

    EasyMock.replay(m_alarmDao, m_ospfLinkDao);

    List<EdgeRef> edges = createEdges();
    Map<EdgeRef, Status> statusMap =
        m_statusProvider.getStatusForEdges(m_edgeProvider, edges, new Criteria[0]);

    assertEquals(1, statusMap.size());
    assertEquals(edges.get(0), new ArrayList<EdgeRef>(statusMap.keySet()).get(0));
    Status status = statusMap.get(edges.get(0));
    assertEquals("down", status.computeStatus());
  }