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);
}
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);
}
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());
}
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));
}
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));
}
Aggregations