use of org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface in project ovirt-engine by oVirt.
the class MatchUserMappingToOvfVnicTest method testFindMappingEntryEmptySourceVnicProfile.
@Test
public void testFindMappingEntryEmptySourceVnicProfile() {
VmNetworkInterface vnic = new VmNetworkInterface();
vnic.setNetworkName(null);
vnic.setVnicProfileName(null);
MapVnicsContext ctx = new MapVnicsContext();
ctx.setUserMappings(singletonList(emptySourceMapping));
ctx.setOvfVnics(singletonList(vnic));
underTest.handle(ctx);
assertThat(ctx.getMatched().get(vnic), sameInstance(emptySourceMapping));
}
use of org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface in project ovirt-engine by oVirt.
the class MatchUserMappingToOvfVnicTest method testFindMappingEntryNotFound.
@Test
public void testFindMappingEntryNotFound() {
VmNetworkInterface vnic = new VmNetworkInterface();
vnic.setNetworkName("not" + NETWORK_NAME);
vnic.setVnicProfileName(VNIC_PROFILE2_NAME);
MapVnicsContext ctx = new MapVnicsContext();
ctx.setUserMappings(externalVnicProfileMappings);
ctx.setOvfVnics(singletonList(vnic));
underTest.handle(ctx);
assertEquals(null, ctx.getMatched().get(vnic));
}
use of org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface in project ovirt-engine by oVirt.
the class VmNetworkInterfaceDaoImpl method getAllForVm.
@Override
public List<VmNetworkInterface> getAllForVm(Guid id, Guid userId, boolean filtered) {
MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("vm_id", id).addValue("user_id", userId).addValue("is_filtered", filtered);
List<VmNetworkInterface> results = getCallsHandler().executeReadList("GetVmNetworkInterfaceViewByVmId", VmNetworkInterfaceRowMapper.INSTANCE, parameterSource);
Collections.sort(results, Comparator.comparing(VmNetworkInterface::getMacAddress));
return results;
}
use of org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface in project ovirt-engine by oVirt.
the class VmNetworkInterfaceDaoTest method testGetWithNonExistingId.
/**
* Ensures null is returned.
*/
@Test
public void testGetWithNonExistingId() {
VmNetworkInterface result = dao.get(Guid.newGuid());
assertNull(result);
}
use of org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface in project ovirt-engine by oVirt.
the class VmNetworkInterfaceDaoTest method testGetAllInterfacesForVm.
/**
* Ensures that a collection of interfaces related the specified VM are returned.
*/
@Test
public void testGetAllInterfacesForVm() {
List<VmNetworkInterface> result = dao.getAllForVm(VM_ID);
assertNotNull(result);
assertFalse(result.isEmpty());
for (VmNetworkInterface iface : result) {
assertEquals(VM_ID, iface.getVmId());
}
}
Aggregations