use of com.cloud.agent.api.NetworkUsageCommand in project cloudstack by apache.
the class LibvirtComputingResourceTest method testNetworkUsageCommandNonVpc.
@Test
public void testNetworkUsageCommandNonVpc() {
final String privateIP = "127.0.0.1";
final String domRName = "domR";
final boolean forVpc = false;
final String gatewayIP = "127.0.0.1";
final NetworkUsageCommand command = new NetworkUsageCommand(privateIP, domRName, forVpc, gatewayIP);
libvirtComputingResource.getNetworkStats(command.getPrivateIP());
when(libvirtComputingResource.getNetworkStats(command.getPrivateIP())).thenReturn(new long[] { 10l, 10l });
final LibvirtRequestWrapper wrapper = LibvirtRequestWrapper.getInstance();
assertNotNull(wrapper);
final Answer answer = wrapper.execute(command, libvirtComputingResource);
assertTrue(answer.getResult());
// Being called twice, although I did not find the second place yet.
verify(libvirtComputingResource, times(2)).getNetworkStats(command.getPrivateIP());
}
Aggregations