use of com.cloud.legacymodel.communication.answer.Answer in project cosmic by MissionCriticalCloud.
the class NotAValidCommand method testCheckOnHostCommand.
@Test
public void testCheckOnHostCommand() {
final com.cloud.legacymodel.dc.Host host = Mockito.mock(com.cloud.legacymodel.dc.Host.class);
final CheckOnHostCommand onHostCommand = new CheckOnHostCommand(host);
final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
assertNotNull(wrapper);
final Answer answer = wrapper.execute(onHostCommand, this.citrixResourceBase);
assertFalse(answer.getResult());
}
use of com.cloud.legacymodel.communication.answer.Answer in project cosmic by MissionCriticalCloud.
the class NotAValidCommand method testPvlanSetupCommandDhcpFailure.
@Test
public void testPvlanSetupCommandDhcpFailure() {
final String label = "net";
final Connection conn = Mockito.mock(Connection.class);
final XsLocalNetwork network = Mockito.mock(XsLocalNetwork.class);
final Network network2 = Mockito.mock(Network.class);
final PvlanSetupCommand lanSetup = PvlanSetupCommand.createDhcpSetup("add", URI.create("http://127.0.0.1"), "tag", "dhcp", "0:0:0:0:0:0", "127.0.0.1");
final String primaryPvlan = lanSetup.getPrimary();
final String isolatedPvlan = lanSetup.getIsolated();
final String op = lanSetup.getOp();
final String dhcpName = lanSetup.getDhcpName();
final String dhcpMac = lanSetup.getDhcpMac();
final String dhcpIp = lanSetup.getDhcpIp();
final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
assertNotNull(wrapper);
when(this.citrixResourceBase.getConnection()).thenReturn(conn);
try {
when(this.citrixResourceBase.getNativeNetworkForTraffic(conn, TrafficType.Guest, "tag")).thenReturn(network);
when(network.getNetwork()).thenReturn(network2);
when(network2.getNameLabel(conn)).thenReturn(label);
} catch (final XenAPIException e) {
fail(e.getMessage());
} catch (final XmlRpcException e) {
fail(e.getMessage());
}
when(this.citrixResourceBase.callHostPlugin(conn, "ovs-pvlan", "setup-pvlan-dhcp", "op", op, "nw-label", label, "primary-pvlan", primaryPvlan, "isolated-pvlan", isolatedPvlan, "dhcp-name", dhcpName, "dhcp-ip", dhcpIp, "dhcp-mac", dhcpMac)).thenReturn("false");
final Answer answer = wrapper.execute(lanSetup, this.citrixResourceBase);
verify(this.citrixResourceBase, times(1)).getConnection();
assertFalse(answer.getResult());
}
use of com.cloud.legacymodel.communication.answer.Answer in project cosmic by MissionCriticalCloud.
the class NotAValidCommand method testPrimaryStorageDownloadCommand.
@Test
public void testPrimaryStorageDownloadCommand() {
final XsHost xsHost = Mockito.mock(XsHost.class);
final StoragePoolVO poolVO = Mockito.mock(StoragePoolVO.class);
final PrimaryStorageDownloadCommand storageDownloadCommand = new PrimaryStorageDownloadCommand("Test", "http://127.0.0.1", ImageFormat.VHD, 1l, poolVO, 200);
final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
assertNotNull(wrapper);
when(this.citrixResourceBase.getHost()).thenReturn(xsHost);
final Answer answer = wrapper.execute(storageDownloadCommand, this.citrixResourceBase);
verify(this.citrixResourceBase, times(1)).getConnection();
assertFalse(answer.getResult());
}
use of com.cloud.legacymodel.communication.answer.Answer in project cosmic by MissionCriticalCloud.
the class NotAValidCommand method testMigrateCommand.
@Test
public void testMigrateCommand() {
final VirtualMachineTO machineTO = Mockito.mock(VirtualMachineTO.class);
final MigrateCommand migrateCommand = new MigrateCommand("Test", "127.0.0.1", false, machineTO, false);
final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
assertNotNull(wrapper);
final Answer answer = wrapper.execute(migrateCommand, this.citrixResourceBase);
verify(this.citrixResourceBase, times(1)).getConnection();
assertFalse(answer.getResult());
}
use of com.cloud.legacymodel.communication.answer.Answer in project cosmic by MissionCriticalCloud.
the class NotAValidCommand method testPingTestCommandRouterPvtIps.
@Test
public void testPingTestCommandRouterPvtIps() {
final PingTestCommand pingTestCommand = new PingTestCommand("127.0.0.1", "127.0.0.1");
final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
assertNotNull(wrapper);
final Answer answer = wrapper.execute(pingTestCommand, this.citrixResourceBase);
verify(this.citrixResourceBase, times(1)).getConnection();
assertFalse(answer.getResult());
}
Aggregations