Search in sources :

Example 11 with HostNicVfsConfig

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

the class HostNicVfsConfigDaoTest method testGetByNicWithInvalidNicId.

/**
 * Ensures that a null hostNicVfsConfig is returned.
 */
@Test
public void testGetByNicWithInvalidNicId() {
    HostNicVfsConfig result = dao.getByNicId(Guid.Empty);
    assertNull(result);
}
Also used : HostNicVfsConfig(org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig) Test(org.junit.Test)

Example 12 with HostNicVfsConfig

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

the class HostNicVfsConfigDaoTest method commonSave.

private void commonSave(boolean allNetworksAllowed) {
    HostNicVfsConfig newConfig = new HostNicVfsConfig();
    newConfig.setId(Guid.newGuid());
    newConfig.setNicId(FixturesTool.VDS_NETWORK_INTERFACE_WITHOUT_QOS);
    newConfig.setAllNetworksAllowed(allNetworksAllowed);
    if (!allNetworksAllowed) {
        addNetworks(newConfig);
        addLabels(newConfig);
    }
    dao.save(newConfig);
    HostNicVfsConfig result = dao.get(newConfig.getId());
    assertNotNull(result);
    assertHostNicVfsConfigEquals(newConfig, result);
}
Also used : HostNicVfsConfig(org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig)

Example 13 with HostNicVfsConfig

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

the class HostNicVfsConfigDaoTest method testGetByIdNotAllNetworksAllowed.

/**
 * Ensures that retrieving a hostNicVfsConfig with {@code allNetworkAllowed=false} by id works as expected.
 */
@Test
public void testGetByIdNotAllNetworksAllowed() {
    HostNicVfsConfig result = dao.get(FixturesTool.HOST_NIC_VFS_CONFIG_NOT_ALL_NETWORKS_ALLOWED_1);
    assertNotNull(result);
    assertEquals(FixturesTool.HOST_NIC_VFS_CONFIG_NOT_ALL_NETWORKS_ALLOWED_1, result.getId());
    checkNetworksAndLabels(result, 2, 2);
}
Also used : HostNicVfsConfig(org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig) Test(org.junit.Test)

Example 14 with HostNicVfsConfig

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

the class HostNicVfsConfigDaoTest method testRemoveLabel.

@Test
public void testRemoveLabel() {
    HostNicVfsConfig vfsConfig = dao.get(FixturesTool.HOST_NIC_VFS_CONFIG_NOT_ALL_NETWORKS_ALLOWED_2);
    checkLabels(vfsConfig, 3);
    dao.removeLabel(FixturesTool.HOST_NIC_VFS_CONFIG_NOT_ALL_NETWORKS_ALLOWED_2, vfsConfig.getNetworkLabels().iterator().next());
    vfsConfig = dao.get(FixturesTool.HOST_NIC_VFS_CONFIG_NOT_ALL_NETWORKS_ALLOWED_2);
    checkLabels(vfsConfig, 2);
}
Also used : HostNicVfsConfig(org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig) Test(org.junit.Test)

Example 15 with HostNicVfsConfig

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

the class HostNicVfsConfigDaoTest method commonRemove.

private void commonRemove(Guid id) {
    HostNicVfsConfig result = dao.get(id);
    assertNotNull(result);
    dao.remove(result.getId());
    result = dao.get(id);
    assertNull(result);
}
Also used : HostNicVfsConfig(org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig)

Aggregations

HostNicVfsConfig (org.ovirt.engine.core.common.businessentities.network.HostNicVfsConfig)34 Test (org.junit.Test)13 Guid (org.ovirt.engine.core.compat.Guid)8 ArrayList (java.util.ArrayList)7 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)7 VmNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)6 HashMap (java.util.HashMap)5 Map (java.util.Map)5 HostDevice (org.ovirt.engine.core.common.businessentities.HostDevice)5 List (java.util.List)4 Network (org.ovirt.engine.core.common.businessentities.network.Network)4 Collections (java.util.Collections)3 HashSet (java.util.HashSet)3 Arrays (java.util.Arrays)2 Collectors (java.util.stream.Collectors)2 RandomStringUtils (org.apache.commons.lang.RandomStringUtils)2 Assert.assertEquals (org.junit.Assert.assertEquals)2 Assert.assertNotNull (org.junit.Assert.assertNotNull)2 Assert.assertNull (org.junit.Assert.assertNull)2 Before (org.junit.Before)2