Search in sources :

Example 6 with NetworkRulesSystemVmCommand

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

the class NotAValidCommand method testNetworkRulesSystemVmCommandNonUserFalse.

@Test
public void testNetworkRulesSystemVmCommandNonUserFalse() {
    final Connection conn = Mockito.mock(Connection.class);
    final NetworkRulesSystemVmCommand netRules = new NetworkRulesSystemVmCommand("Test", VirtualMachine.Type.DomainRouter);
    final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
    assertNotNull(wrapper);
    when(citrixResourceBase.getConnection()).thenReturn(conn);
    when(citrixResourceBase.callHostPlugin(conn, "vmops", "default_network_rules_systemvm", "vmName", netRules.getVmName())).thenReturn("false");
    final Answer answer = wrapper.execute(netRules, citrixResourceBase);
    verify(citrixResourceBase, times(1)).getConnection();
    assertFalse(answer.getResult());
}
Also used : RebootAnswer(com.cloud.agent.api.RebootAnswer) CreateAnswer(com.cloud.agent.api.storage.CreateAnswer) AttachAnswer(org.apache.cloudstack.storage.command.AttachAnswer) Answer(com.cloud.agent.api.Answer) Connection(com.xensource.xenapi.Connection) NetworkRulesSystemVmCommand(com.cloud.agent.api.NetworkRulesSystemVmCommand) Test(org.junit.Test)

Aggregations

NetworkRulesSystemVmCommand (com.cloud.agent.api.NetworkRulesSystemVmCommand)6 Answer (com.cloud.agent.api.Answer)5 AttachAnswer (org.apache.cloudstack.storage.command.AttachAnswer)5 Test (org.junit.Test)5 RebootAnswer (com.cloud.agent.api.RebootAnswer)3 CreateAnswer (com.cloud.agent.api.storage.CreateAnswer)3 Connection (com.xensource.xenapi.Connection)3 CheckRouterAnswer (com.cloud.agent.api.CheckRouterAnswer)2 LibvirtRequestWrapper (com.cloud.hypervisor.kvm.resource.wrapper.LibvirtRequestWrapper)2 LibvirtUtilitiesHelper (com.cloud.hypervisor.kvm.resource.wrapper.LibvirtUtilitiesHelper)2 TrafficType (com.cloud.network.Networks.TrafficType)2 StoragePoolType (com.cloud.storage.Storage.StoragePoolType)2 BootloaderType (com.cloud.template.VirtualMachineTemplate.BootloaderType)2 Type (com.cloud.vm.VirtualMachine.Type)2 LibvirtException (org.libvirt.LibvirtException)2 Commands (com.cloud.agent.manager.Commands)1 AgentUnavailableException (com.cloud.exception.AgentUnavailableException)1 OperationTimedoutException (com.cloud.exception.OperationTimedoutException)1 ArrayList (java.util.ArrayList)1 Connect (org.libvirt.Connect)1