use of com.cloud.agent.api.CheckNetworkCommand in project CloudStack-archive by CloudStack-extras.
the class DummyResource method executeRequest.
@Override
public Answer executeRequest(Command cmd) {
if (cmd instanceof CheckNetworkCommand) {
return new CheckNetworkAnswer((CheckNetworkCommand) cmd, true, null);
}
System.out.println("Received Command: " + cmd.toString());
Answer answer = new Answer(cmd, !_negative, "response");
System.out.println("Replying with: " + answer.toString());
return answer;
}
use of com.cloud.agent.api.CheckNetworkCommand in project cosmic by MissionCriticalCloud.
the class LibvirtComputingResourceTest method testCheckNetworkCommandFail2.
@Test
public void testCheckNetworkCommandFail2() {
final List<PhysicalNetworkSetupInfo> networkInfoList = new ArrayList<>();
final PhysicalNetworkSetupInfo networkSetupInfo = Mockito.mock(PhysicalNetworkSetupInfo.class);
networkInfoList.add(networkSetupInfo);
final CheckNetworkCommand command = new CheckNetworkCommand(networkInfoList);
when(libvirtComputingResource.checkNetwork(networkSetupInfo.getGuestNetworkName())).thenReturn(true);
when(libvirtComputingResource.checkNetwork(networkSetupInfo.getPrivateNetworkName())).thenReturn(false);
final LibvirtRequestWrapper wrapper = LibvirtRequestWrapper.getInstance();
assertNotNull(wrapper);
final Answer answer = wrapper.execute(command, libvirtComputingResource);
assertFalse(answer.getResult());
verify(libvirtComputingResource, times(1)).checkNetwork(networkSetupInfo.getGuestNetworkName());
verify(libvirtComputingResource, times(1)).checkNetwork(networkSetupInfo.getPrivateNetworkName());
}
use of com.cloud.agent.api.CheckNetworkCommand in project cosmic by MissionCriticalCloud.
the class LibvirtComputingResourceTest method testCheckNetworkCommandFail1.
@Test
public void testCheckNetworkCommandFail1() {
final List<PhysicalNetworkSetupInfo> networkInfoList = new ArrayList<>();
final PhysicalNetworkSetupInfo networkSetupInfo = Mockito.mock(PhysicalNetworkSetupInfo.class);
networkInfoList.add(networkSetupInfo);
final CheckNetworkCommand command = new CheckNetworkCommand(networkInfoList);
when(libvirtComputingResource.checkNetwork(networkSetupInfo.getGuestNetworkName())).thenReturn(false);
final LibvirtRequestWrapper wrapper = LibvirtRequestWrapper.getInstance();
assertNotNull(wrapper);
final Answer answer = wrapper.execute(command, libvirtComputingResource);
assertFalse(answer.getResult());
verify(libvirtComputingResource, times(1)).checkNetwork(networkSetupInfo.getGuestNetworkName());
}
use of com.cloud.agent.api.CheckNetworkCommand in project cosmic by MissionCriticalCloud.
the class CheckNetworkCommandTest method setUp.
@Before
public void setUp() {
final List<PhysicalNetworkSetupInfo> net = Mockito.mock(List.class);
cnc = new CheckNetworkCommand(net);
}
use of com.cloud.agent.api.CheckNetworkCommand in project cosmic by MissionCriticalCloud.
the class NotAValidCommand method testCheckNetworkCommandFailure.
@Test
public void testCheckNetworkCommandFailure() {
final PhysicalNetworkSetupInfo info = new PhysicalNetworkSetupInfo();
final List<PhysicalNetworkSetupInfo> setupInfos = new ArrayList<>();
setupInfos.add(info);
final CheckNetworkCommand checkNet = new CheckNetworkCommand(setupInfos);
final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
assertNotNull(wrapper);
final Answer answer = wrapper.execute(checkNet, citrixResourceBase);
assertFalse(answer.getResult());
}
Aggregations