Search in sources :

Example 36 with VDS

use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.

the class DefaultConsoleAddress method addVds.

public void addVds(String returnValue) {
    if (content == null) {
        content = new ArrayList<>();
    }
    VDS vds = mock(VDS.class);
    when(vds.getConsoleAddress()).thenReturn(returnValue);
    content.add(vds);
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS)

Example 37 with VDS

use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.

the class GetVdsByVdsIdQueryTest method testExecuteQueryCommnad.

@Test
public void testExecuteQueryCommnad() {
    // Set up the expected data
    Guid vdsID = Guid.newGuid();
    VDS expected = new VDS();
    expected.setId(vdsID);
    // Mock the query's parameters
    when(getQueryParameters().getId()).thenReturn(vdsID);
    // Mock the Daos
    when(vdsDaoMock.get(vdsID)).thenReturn(expected);
    GetVdsByVdsIdQuery<IdQueryParameters> query = getQuery();
    query.executeQueryCommand();
    VDS actual = query.getQueryReturnValue().getReturnValue();
    assertEquals("wrong VDS", expected, actual);
}
Also used : IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) VDS(org.ovirt.engine.core.common.businessentities.VDS) Guid(org.ovirt.engine.core.compat.Guid) Test(org.junit.Test)

Example 38 with VDS

use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.

the class GetHostsForStorageOperationQueryTest method testExecuteQueryCommand.

@Test
public void testExecuteQueryCommand() {
    // Prepare the parameters
    Guid spId = Guid.newGuid();
    when(getQueryParameters().getId()).thenReturn(spId);
    when(getQueryParameters().isLocalFsOnly()).thenReturn(false);
    // Prepare the result
    VDS vds = new VDS();
    vds.setStoragePoolId(spId);
    List<VDS> result = Collections.singletonList(vds);
    // Mock the Dao
    when(vdsDaoMock.getHostsForStorageOperation(spId, getQueryParameters().isLocalFsOnly())).thenReturn(result);
    // Execute the query
    getQuery().executeQueryCommand();
    // Check the result
    assertEquals("Wrong Vds returned", result, getQuery().getQueryReturnValue().getReturnValue());
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) Guid(org.ovirt.engine.core.compat.Guid) Test(org.junit.Test)

Example 39 with VDS

use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.

the class NetworkValidatorTest method networkInUseByManyHosts.

@Test
public void networkInUseByManyHosts() throws Exception {
    VDS host1 = mock(VDS.class);
    when(host1.getName()).thenReturn(NAMEABLE_NAME + 1);
    VDS host2 = mock(VDS.class);
    when(host2.getName()).thenReturn(NAMEABLE_NAME + 2);
    networkNotUsedByHostsTest(failsWithManyNetworkInUse(), Arrays.asList(host1, host2));
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) Test(org.junit.Test)

Example 40 with VDS

use of org.ovirt.engine.core.common.businessentities.VDS in project ovirt-engine by oVirt.

the class FenceValidatorTest method failWhenPowerManagementDisabled.

@Test
public void failWhenPowerManagementDisabled() {
    VDS vds = new VDS();
    List<String> messages = new LinkedList<>();
    boolean result = validator.isPowerManagementEnabledAndLegal(vds, null, messages);
    assertFalse(result);
    assertEquals(1, messages.size());
    assertEquals("VDS_FENCE_DISABLED", messages.get(0));
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) LinkedList(java.util.LinkedList) Test(org.junit.Test)

Aggregations

VDS (org.ovirt.engine.core.common.businessentities.VDS)578 ArrayList (java.util.ArrayList)160 Test (org.junit.Test)138 Guid (org.ovirt.engine.core.compat.Guid)132 List (java.util.List)78 VM (org.ovirt.engine.core.common.businessentities.VM)65 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)55 HashMap (java.util.HashMap)53 HashSet (java.util.HashSet)48 Map (java.util.Map)45 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)42 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)42 Set (java.util.Set)40 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)39 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)39 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)39 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)38 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)38 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)37 Frontend (org.ovirt.engine.ui.frontend.Frontend)35