Search in sources :

Example 1 with ControlClusterStatus

use of com.cloud.network.bigswitch.ControlClusterStatus in project cloudstack by apache.

the class BigSwitchBcfResourceTest method testPingCommandStatusApiException.

@Test
public void testPingCommandStatusApiException() throws ConfigurationException, BigSwitchBcfApiException {
    _resource.configure("BigSwitchBcfResource", _parameters);
    ControlClusterStatus ccs = mock(ControlClusterStatus.class);
    when(ccs.getStatus()).thenReturn(false);
    when(_bigswitchBcfApi.getControlClusterStatus()).thenThrow(new BigSwitchBcfApiException());
    PingCommand ping = _resource.getCurrentStatus(42);
    assertTrue(ping == null);
}
Also used : ControlClusterStatus(com.cloud.network.bigswitch.ControlClusterStatus) BigSwitchBcfApiException(com.cloud.network.bigswitch.BigSwitchBcfApiException) PingCommand(com.cloud.agent.api.PingCommand) Test(org.junit.Test)

Example 2 with ControlClusterStatus

use of com.cloud.network.bigswitch.ControlClusterStatus in project cloudstack by apache.

the class BigSwitchBcfResourceTest method testPingCommandStatusOk.

@Test
public void testPingCommandStatusOk() throws ConfigurationException, BigSwitchBcfApiException {
    _resource.configure("BigSwitchBcfResource", _parameters);
    ControlClusterStatus ccs = mock(ControlClusterStatus.class);
    when(ccs.getStatus()).thenReturn(true);
    when(_bigswitchBcfApi.getControlClusterStatus()).thenReturn(ccs);
    Capabilities cap = mock(Capabilities.class);
    when(_bigswitchBcfApi.getCapabilities()).thenReturn(cap);
    PingCommand ping = _resource.getCurrentStatus(42);
    assertTrue(ping != null);
    assertTrue(ping.getHostId() == 42);
    assertTrue(ping.getHostType() == Host.Type.L2Networking);
}
Also used : ControlClusterStatus(com.cloud.network.bigswitch.ControlClusterStatus) Capabilities(com.cloud.network.bigswitch.Capabilities) PingCommand(com.cloud.agent.api.PingCommand) Test(org.junit.Test)

Example 3 with ControlClusterStatus

use of com.cloud.network.bigswitch.ControlClusterStatus in project cloudstack by apache.

the class BigSwitchBcfResourceTest method testPingCommandStatusFail.

@Test
public void testPingCommandStatusFail() throws ConfigurationException, BigSwitchBcfApiException {
    _resource.configure("BigSwitchBcfResource", _parameters);
    ControlClusterStatus ccs = mock(ControlClusterStatus.class);
    when(ccs.getStatus()).thenReturn(false);
    when(_bigswitchBcfApi.getControlClusterStatus()).thenReturn(ccs);
    PingCommand ping = _resource.getCurrentStatus(42);
    assertTrue(ping == null);
}
Also used : ControlClusterStatus(com.cloud.network.bigswitch.ControlClusterStatus) PingCommand(com.cloud.agent.api.PingCommand) Test(org.junit.Test)

Aggregations

PingCommand (com.cloud.agent.api.PingCommand)3 ControlClusterStatus (com.cloud.network.bigswitch.ControlClusterStatus)3 Test (org.junit.Test)3 BigSwitchBcfApiException (com.cloud.network.bigswitch.BigSwitchBcfApiException)1 Capabilities (com.cloud.network.bigswitch.Capabilities)1