@Override public Object getQueryableId() { return getId(); }
static org.ovirt.engine.core.common.businessentities.network.VnicProfile setUpEntityExpectations(org.ovirt.engine.core.common.businessentities.network.VnicProfile entity, int index) { when(entity.getId()).thenReturn(GUIDS[index]); when(entity.getName()).thenReturn(NAMES[index]); when(entity.getDescription()).thenReturn(DESCRIPTIONS[index]); when(entity.getNetworkId()).thenReturn(GUIDS[index]); return entity; } }
static org.ovirt.engine.core.common.businessentities.network.VnicProfile setUpEntityExpectations(org.ovirt.engine.core.common.businessentities.network.VnicProfile entity, int index) { when(entity.getId()).thenReturn(GUIDS[index]); when(entity.getName()).thenReturn(NAMES[index]); when(entity.getDescription()).thenReturn(DESCRIPTIONS[index]); when(entity.getNetworkId()).thenReturn(GUIDS[index]); return entity; } }
static org.ovirt.engine.core.common.businessentities.network.VnicProfile setUpEntityExpectations(org.ovirt.engine.core.common.businessentities.network.VnicProfile entity, int index) { when(entity.getId()).thenReturn(GUIDS[index]); when(entity.getName()).thenReturn(NAMES[index]); when(entity.getDescription()).thenReturn(DESCRIPTIONS[index]); when(entity.getNetworkId()).thenReturn(GUIDS[index]); return entity; } }
/** * Ensures that the network interface profile is returned. */ @Test public void testGetWithPm() { VnicProfile result = dao.get(FixturesTool.VM_NETWORK_INTERFACE_PM_PROFILE); assertNotNull(result); assertEquals(FixturesTool.VM_NETWORK_INTERFACE_PM_PROFILE, result.getId()); assertTrue(result.isPortMirroring()); }
private void updateChangabilityIfVmsUsingTheProfile() { IdQueryParameters params = new IdQueryParameters(getProfile().getId()); startProgress(); Frontend.getInstance().runQuery(QueryType.GetVmsByVnicProfileId, params, new AsyncQuery<QueryReturnValue>(returnValue -> { Collection<VM> vms = returnValue.getReturnValue(); if (vms != null && !vms.isEmpty()) { getPortMirroring().setIsChangeable(false); getPortMirroring().setChangeProhibitionReason(constants.portMirroringNotChangedIfUsedByVms()); getPassthrough().setIsChangeable(false); getPassthrough().setChangeProhibitionReason(constants.passthroughNotChangedIfUsedByVms()); } stopProgress(); })); }
/** * Ensures that the network interface profile is returned. */ @Test public void testGetWithPassthrough() { VnicProfile result = dao .get(FixturesTool.VM_NETWORK_INTERFACE_PASSTHROUGH_PROFILE); assertNotNull(result); assertEquals(FixturesTool.VM_NETWORK_INTERFACE_PASSTHROUGH_PROFILE, result.getId()); assertTrue(result.isPassthrough()); assertFalse(result.isMigratable()); }
@Override public String toString() { return ToStringBuilder.forInstance(this) .append("id", getId()) .append("networkId", getNetworkId()) .append("networkQosId", getNetworkQosId()) .append("portMirroring", isPortMirroring()) .append("passthrough", isPassthrough()) .append("migratable", isMigratable()) .append("customProperties", getCustomProperties()) .append("description", getDescription()) .append("networkFilterId", getNetworkFilterId()) .build(); } }
@Override protected MapSqlParameterSource createFullParametersMapper(VnicProfile profile) { return createIdParameterMapper(profile.getId()) .addValue("name", profile.getName()) .addValue("network_id", profile.getNetworkId()) .addValue("network_qos_id", profile.getNetworkQosId()) .addValue("port_mirroring", profile.isPortMirroring()) .addValue("passthrough", profile.isPassthrough()) .addValue("migratable", profile.isMigratable()) .addValue("description", profile.getDescription()) .addValue("custom_properties", SerializationFactory.getSerializer().serialize(profile.getCustomProperties())) .addValue("network_filter_id", profile.getNetworkFilterId()); }