Search in sources :

Example 11 with WmiManager

use of org.opennms.protocols.wmi.WmiManager in project opennms by OpenNMS.

the class WmiManagerTest method testClose.

/**
 * Test that a normal, standard close functions properly.
 *
 * Test method for {@link org.opennms.protocols.wmi.WmiManager#close()}.
 *
 * @throws WmiException if there is unexpected behavior.
 */
public final void testClose() throws WmiException {
    // Set up WMI mock client.
    // 1) Expect a call to connect()
    // 2) Expect a call to disconnect()
    m_WmiMock.connect("127.0.0.1", "Administrator", "password", WmiParams.WMI_DEFAULT_NAMESPACE);
    m_WmiMock.disconnect();
    replay(m_WmiMock);
    // Create a manager.
    WmiManager wmiManager = new WmiManager("127.0.0.1", "Administrator", "password");
    // Initialize
    wmiManager.init(m_WmiMock);
    // Disconnect
    wmiManager.close();
    verify(m_WmiMock);
    reset(m_WmiMock);
}
Also used : WmiManager(org.opennms.protocols.wmi.WmiManager)

Aggregations

WmiManager (org.opennms.protocols.wmi.WmiManager)11 WmiException (org.opennms.protocols.wmi.WmiException)9 WmiParams (org.opennms.protocols.wmi.WmiParams)5 WmiResult (org.opennms.protocols.wmi.WmiResult)3 OnmsWbemObjectBiosStub (org.opennms.protocols.wmi.test.stubs.OnmsWbemObjectBiosStub)2 OnmsWbemObjectSetBiosStub (org.opennms.protocols.wmi.test.stubs.OnmsWbemObjectSetBiosStub)2 OnmsWbemPropBiosStub (org.opennms.protocols.wmi.test.stubs.OnmsWbemPropBiosStub)2 OnmsWbemPropSetBiosStub (org.opennms.protocols.wmi.test.stubs.OnmsWbemPropSetBiosStub)2 OnmsWbemObjectSet (org.opennms.protocols.wmi.wbem.OnmsWbemObjectSet)2 InetAddress (java.net.InetAddress)1 TimeoutTracker (org.opennms.core.utils.TimeoutTracker)1 WmiAgentConfig (org.opennms.netmgt.config.wmi.WmiAgentConfig)1