Search in sources :

Example 16 with MockNode

use of org.opennms.netmgt.mock.MockNode in project opennms by OpenNMS.

the class PollerIT method testNodeOutageProcessingEnabled.

// test whole node down
@Test
public void testNodeOutageProcessingEnabled() throws Exception {
    m_pollerConfig.setNodeOutageProcessingEnabled(true);
    MockNode node = m_network.getNode(1);
    // start the poller
    startDaemons();
    resetAnticipated();
    anticipateDown(node);
    // brind down the node (duh)
    node.bringDown();
    // make sure the correct events are recieved
    verifyAnticipated(10000);
    resetAnticipated();
    anticipateUp(node);
    // bring the node back up
    node.bringUp();
    // make sure the up events are received
    verifyAnticipated(10000);
}
Also used : MockNode(org.opennms.netmgt.mock.MockNode) Test(org.junit.Test)

Example 17 with MockNode

use of org.opennms.netmgt.mock.MockNode in project opennms by OpenNMS.

the class PollerQueryManagerDaoIT method testNodeOutageProcessingEnabled.

// test whole node down
@Test
public void testNodeOutageProcessingEnabled() throws Exception {
    m_pollerConfig.setNodeOutageProcessingEnabled(true);
    MockNode node = m_network.getNode(1);
    // start the poller
    startDaemons();
    resetAnticipated();
    anticipateDown(node);
    // brind down the node (duh)
    node.bringDown();
    // make sure the correct events are recieved
    verifyAnticipated(10000);
    resetAnticipated();
    anticipateUp(node);
    // bring the node back up
    node.bringUp();
    // make sure the up events are received
    verifyAnticipated(10000);
}
Also used : MockNode(org.opennms.netmgt.mock.MockNode) Test(org.junit.Test)

Example 18 with MockNode

use of org.opennms.netmgt.mock.MockNode in project opennms by OpenNMS.

the class PollerQueryManagerDaoIT method testReparentCausesStatusChange.

// test open outages for unmanaged services
@Test
public void testReparentCausesStatusChange() {
    m_pollerConfig.setNodeOutageProcessingEnabled(true);
    MockNode node1 = m_network.getNode(1);
    MockNode node2 = m_network.getNode(2);
    MockInterface dotOne = m_network.getInterface(1, "192.168.1.1");
    MockInterface dotTwo = m_network.getInterface(1, "192.168.1.2");
    MockInterface dotThree = m_network.getInterface(2, "192.168.1.3");
    //
    // Plan to bring down both nodes except the reparented interface
    // the node owning the interface should be up while the other is down
    // after reparenting we should got the old owner go down while the other
    // comes up.
    //
    anticipateDown(node2);
    anticipateDown(dotOne);
    // bring down both nodes but bring iface back up
    node1.bringDown();
    node2.bringDown();
    dotTwo.bringUp();
    Event reparentEvent = MockEventUtil.createReparentEvent("Test", "192.168.1.2", 1, 2);
    startDaemons();
    verifyAnticipated(2000);
    m_db.reparentInterface(dotTwo.getIpAddr(), dotTwo.getNodeId(), node2.getNodeId());
    dotTwo.moveTo(node2);
    resetAnticipated();
    anticipateDown(node1, true);
    anticipateUp(node2, true);
    anticipateDown(dotThree, true);
    m_eventMgr.sendEventToListeners(reparentEvent);
    verifyAnticipated(20000);
}
Also used : MockInterface(org.opennms.netmgt.mock.MockInterface) Event(org.opennms.netmgt.xml.event.Event) MockNode(org.opennms.netmgt.mock.MockNode) Test(org.junit.Test)

Example 19 with MockNode

use of org.opennms.netmgt.mock.MockNode in project opennms by OpenNMS.

the class PollerIT method testNodeOutagesClosedOnDelete.

@Test
public void testNodeOutagesClosedOnDelete() {
    MockNode element = m_network.getNode(1);
    testOutagesClosedOnDelete(element);
}
Also used : MockNode(org.opennms.netmgt.mock.MockNode) Test(org.junit.Test)

Example 20 with MockNode

use of org.opennms.netmgt.mock.MockNode in project opennms by OpenNMS.

the class PollerIT method testNodeDeleted.

// nodeDeleted: EventConstants.NODE_DELETED_EVENT_UEI
@Test
public void testNodeDeleted() {
    MockNode node = m_network.getNode(1);
    testElementDeleted(node);
}
Also used : MockNode(org.opennms.netmgt.mock.MockNode) Test(org.junit.Test)

Aggregations

MockNode (org.opennms.netmgt.mock.MockNode)52 Test (org.junit.Test)42 Event (org.opennms.netmgt.xml.event.Event)21 MockService (org.opennms.netmgt.mock.MockService)16 MockInterface (org.opennms.netmgt.mock.MockInterface)7 Date (java.util.Date)5 ResultSet (java.sql.ResultSet)4 PollAnticipator (org.opennms.netmgt.mock.PollAnticipator)4 EventBuilder (org.opennms.netmgt.model.events.EventBuilder)4 SQLException (java.sql.SQLException)3 ArrayList (java.util.ArrayList)3 MockNetwork (org.opennms.netmgt.mock.MockNetwork)3 MockVisitor (org.opennms.netmgt.mock.MockVisitor)3 MockVisitorAdapter (org.opennms.netmgt.mock.MockVisitorAdapter)3 Ignore (org.junit.Ignore)2 Querier (org.opennms.core.utils.Querier)2 RowCallbackHandler (org.springframework.jdbc.core.RowCallbackHandler)2 HashSet (java.util.HashSet)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 Before (org.junit.Before)1