Search in sources :

Example 6 with CheckHealthCommand

use of com.cloud.agent.api.CheckHealthCommand in project cosmic by MissionCriticalCloud.

the class NiciraCheckHealthCommandWrapperTest method tetsExecuteWhenClusterIsNotStable.

@Test
public void tetsExecuteWhenClusterIsNotStable() throws Exception {
    when(niciraApi.getControlClusterStatus()).thenReturn(new ControlClusterStatus());
    final NiciraCheckHealthCommandWrapper commandWrapper = new NiciraCheckHealthCommandWrapper();
    final Answer answer = commandWrapper.execute(new CheckHealthCommand(), niciraResource);
    assertThat(answer.getResult(), equalTo(false));
}
Also used : ControlClusterStatus(com.cloud.network.nicira.ControlClusterStatus) Answer(com.cloud.agent.api.Answer) CheckHealthCommand(com.cloud.agent.api.CheckHealthCommand) Test(org.junit.Test)

Example 7 with CheckHealthCommand

use of com.cloud.agent.api.CheckHealthCommand in project cosmic by MissionCriticalCloud.

the class NiciraCheckHealthCommandWrapperTest method tetsExecuteWhenClusterIsStable.

@Test
public void tetsExecuteWhenClusterIsStable() throws Exception {
    final ControlClusterStatus statusValue = mock(ControlClusterStatus.class);
    when(statusValue.getClusterStatus()).thenReturn("stable");
    when(niciraApi.getControlClusterStatus()).thenReturn(statusValue);
    final NiciraCheckHealthCommandWrapper commandWrapper = new NiciraCheckHealthCommandWrapper();
    final Answer answer = commandWrapper.execute(new CheckHealthCommand(), niciraResource);
    assertThat(answer.getResult(), equalTo(true));
}
Also used : ControlClusterStatus(com.cloud.network.nicira.ControlClusterStatus) Answer(com.cloud.agent.api.Answer) CheckHealthCommand(com.cloud.agent.api.CheckHealthCommand) Test(org.junit.Test)

Example 8 with CheckHealthCommand

use of com.cloud.agent.api.CheckHealthCommand in project cosmic by MissionCriticalCloud.

the class NiciraCheckHealthCommandWrapperTest method tetsExecuteWhenApiThrowsException.

@Test
public void tetsExecuteWhenApiThrowsException() throws Exception {
    when(niciraApi.getControlClusterStatus()).thenThrow(NiciraNvpApiException.class);
    final NiciraCheckHealthCommandWrapper commandWrapper = new NiciraCheckHealthCommandWrapper();
    final Answer answer = commandWrapper.execute(new CheckHealthCommand(), niciraResource);
    assertThat(answer.getResult(), equalTo(false));
}
Also used : Answer(com.cloud.agent.api.Answer) CheckHealthCommand(com.cloud.agent.api.CheckHealthCommand) Test(org.junit.Test)

Example 9 with CheckHealthCommand

use of com.cloud.agent.api.CheckHealthCommand in project cosmic by MissionCriticalCloud.

the class NotAValidCommand method testCheckHealthCommand.

@Test
public void testCheckHealthCommand() {
    final CheckHealthCommand checkHealthCommand = new CheckHealthCommand();
    final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
    assertNotNull(wrapper);
    final Answer answer = wrapper.execute(checkHealthCommand, citrixResourceBase);
    assertFalse(answer.getResult());
}
Also used : RebootAnswer(com.cloud.agent.api.RebootAnswer) CreateAnswer(com.cloud.agent.api.storage.CreateAnswer) Answer(com.cloud.agent.api.Answer) AttachAnswer(com.cloud.storage.command.AttachAnswer) CheckHealthCommand(com.cloud.agent.api.CheckHealthCommand) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 10 with CheckHealthCommand

use of com.cloud.agent.api.CheckHealthCommand in project cloudstack by apache.

the class Ovm3HypervisorSupportTest method checkHealthTest.

@Test
public void checkHealthTest() throws ConfigurationException {
    con = prepare();
    CheckHealthCommand cmd = new CheckHealthCommand();
    Answer ra = hypervisor.executeRequest(cmd);
    results.basicBooleanTest(ra.getResult());
}
Also used : Answer(com.cloud.agent.api.Answer) CheckHealthCommand(com.cloud.agent.api.CheckHealthCommand) Test(org.junit.Test) ConnectionTest(com.cloud.hypervisor.ovm3.objects.ConnectionTest) LinuxTest(com.cloud.hypervisor.ovm3.objects.LinuxTest) NetworkTest(com.cloud.hypervisor.ovm3.objects.NetworkTest) XenTest(com.cloud.hypervisor.ovm3.objects.XenTest) Ovm3SupportTest(com.cloud.hypervisor.ovm3.support.Ovm3SupportTest) XmlTestResultTest(com.cloud.hypervisor.ovm3.objects.XmlTestResultTest)

Aggregations

Answer (com.cloud.agent.api.Answer)16 CheckHealthCommand (com.cloud.agent.api.CheckHealthCommand)16 Test (org.junit.Test)11 AttachIsoCommand (com.cloud.agent.api.AttachIsoCommand)3 BackupSnapshotCommand (com.cloud.agent.api.BackupSnapshotCommand)3 CheckNetworkCommand (com.cloud.agent.api.CheckNetworkCommand)3 CreatePrivateTemplateFromSnapshotCommand (com.cloud.agent.api.CreatePrivateTemplateFromSnapshotCommand)3 CreatePrivateTemplateFromVolumeCommand (com.cloud.agent.api.CreatePrivateTemplateFromVolumeCommand)3 CreateVolumeFromSnapshotCommand (com.cloud.agent.api.CreateVolumeFromSnapshotCommand)3 DeleteStoragePoolCommand (com.cloud.agent.api.DeleteStoragePoolCommand)3 GetHostStatsCommand (com.cloud.agent.api.GetHostStatsCommand)3 GetStorageStatsCommand (com.cloud.agent.api.GetStorageStatsCommand)3 GetVmStatsCommand (com.cloud.agent.api.GetVmStatsCommand)3 GetVncPortCommand (com.cloud.agent.api.GetVncPortCommand)3 MaintainCommand (com.cloud.agent.api.MaintainCommand)3 ManageSnapshotCommand (com.cloud.agent.api.ManageSnapshotCommand)3 MigrateCommand (com.cloud.agent.api.MigrateCommand)3 ModifyStoragePoolCommand (com.cloud.agent.api.ModifyStoragePoolCommand)3 NetworkUsageCommand (com.cloud.agent.api.NetworkUsageCommand)3 PingTestCommand (com.cloud.agent.api.PingTestCommand)3