Search in sources :

Example 6 with ExternalVnicProfileMapping

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

the class MatchUserMappingToOvfVnicTest method test.

private void test(Object[] dataPoint, int count) {
    // Translate input to human readable
    VmNetworkInterface ovfVnicUnderTest = (VmNetworkInterface) dataPoint[0];
    ExternalVnicProfileMapping userMappingUnderTest = (ExternalVnicProfileMapping) dataPoint[1];
    Boolean expectedIsMatch = (Boolean) dataPoint[2];
    // Arrange
    MapVnicsContext ctx = new MapVnicsContext("test");
    ctx.setOvfVnics(singletonList(ovfVnicUnderTest));
    ctx.setUserMappings(singletonList(userMappingUnderTest));
    // Act
    matcher.handle(ctx);
    // Assert
    print(ovfVnicUnderTest, ctx, count);
    ExternalVnicProfileMapping expectedMatchingMapping = expectedIsMatch ? userMappingUnderTest : null;
    assertEquals(expectedMatchingMapping, ctx.getMatched().get(ovfVnicUnderTest));
    assertTrue(ctx.getMatched().size() > 0);
    assertTrue(ctx.getException() == null);
}
Also used : VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) ExternalVnicProfileMapping(org.ovirt.engine.core.common.businessentities.network.ExternalVnicProfileMapping)

Example 7 with ExternalVnicProfileMapping

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

the class MatchUserMappingToOvfVnicTest method setUp.

@Before
public void setUp() {
    underTest = new MatchUserMappingToOvfVnic();
    externalVnicProfileMapping1 = new ExternalVnicProfileMapping(NETWORK_NAME, VNIC_PROFILE1_NAME, TARGET_VNIC_PROFILE_ID);
    externalVnicProfileMapping2 = new ExternalVnicProfileMapping(NETWORK_NAME, VNIC_PROFILE2_NAME, null);
    externalVnicProfileMappings = asList(externalVnicProfileMapping1, externalVnicProfileMapping2);
    emptySourceMapping = new ExternalVnicProfileMapping(null, null, TARGET_VNIC_PROFILE_ID);
}
Also used : MatchUserMappingToOvfVnic(org.ovirt.engine.core.bll.exportimport.vnics.MapVnicsHandlers.MatchUserMappingToOvfVnic) ExternalVnicProfileMapping(org.ovirt.engine.core.common.businessentities.network.ExternalVnicProfileMapping) Before(org.junit.Before)

Aggregations

ExternalVnicProfileMapping (org.ovirt.engine.core.common.businessentities.network.ExternalVnicProfileMapping)7 Before (org.junit.Before)1 GuidUtils.asGuid (org.ovirt.engine.api.restapi.utils.GuidUtils.asGuid)1 MatchUserMappingToOvfVnic (org.ovirt.engine.core.bll.exportimport.vnics.MapVnicsHandlers.MatchUserMappingToOvfVnic)1 ImportVmFromConfParameters (org.ovirt.engine.core.common.action.ImportVmFromConfParameters)1 ImportVmTemplateFromConfParameters (org.ovirt.engine.core.common.action.ImportVmTemplateFromConfParameters)1 VmNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)1 Guid (org.ovirt.engine.core.compat.Guid)1