Search in sources :

Example 46 with NetworkCluster

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

the class NetworkClusterDaoTest method testSetGluster.

@Test
public void testSetGluster() {
    dao.setNetworkExclusivelyAsGluster(existingNetworkCluster.getClusterId(), existingNetworkCluster.getNetworkId());
    List<NetworkCluster> allForCluster = dao.getAllForCluster(existingNetworkCluster.getClusterId());
    for (NetworkCluster net : allForCluster) {
        if (net.getId().equals(existingNetworkCluster.getId())) {
            assertTrue(net.isGluster());
        } else {
            assertFalse(net.isGluster());
        }
    }
}
Also used : NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) Test(org.junit.Test)

Example 47 with NetworkCluster

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

the class NetworkClusterDaoTest method testSetMigration.

@Test
public void testSetMigration() {
    dao.setNetworkExclusivelyAsMigration(existingNetworkCluster.getClusterId(), existingNetworkCluster.getNetworkId());
    List<NetworkCluster> allForCluster = dao.getAllForCluster(existingNetworkCluster.getClusterId());
    for (NetworkCluster net : allForCluster) {
        if (net.getId().equals(existingNetworkCluster.getId())) {
            assertTrue(net.isMigration());
        } else {
            assertFalse(net.isMigration());
        }
    }
}
Also used : NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) Test(org.junit.Test)

Example 48 with NetworkCluster

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

the class NetworkClusterDaoTest method testSetGlusterAsNull.

@Test
public void testSetGlusterAsNull() {
    dao.setNetworkExclusivelyAsGluster(existingNetworkCluster.getClusterId(), null);
    List<NetworkCluster> allForCluster = dao.getAllForCluster(existingNetworkCluster.getClusterId());
    for (NetworkCluster net : allForCluster) {
        assertFalse(net.isGluster());
    }
}
Also used : NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) Test(org.junit.Test)

Example 49 with NetworkCluster

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

the class NetworkClusterDaoTest method testGetAllForCluster.

/**
 * Ensures that retrieving all for a specific cluster works as expected.
 */
@Test
public void testGetAllForCluster() {
    List<NetworkCluster> result = dao.getAllForCluster(cluster.getId());
    assertNotNull(result);
    assertFalse(result.isEmpty());
    for (NetworkCluster thiscluster : result) {
        assertEquals(cluster.getId(), thiscluster.getClusterId());
    }
}
Also used : NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) Test(org.junit.Test)

Example 50 with NetworkCluster

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

the class NetworkDaoTest method testSave.

/**
 * Ensures that saving a network works as expected.
 */
@Test
public void testSave() {
    List<NetworkCluster> clustersFromDB = dbFacade.getNetworkClusterDao().getAllForCluster(FixturesTool.CLUSTER);
    DnsResolverConfiguration dnsResolverConfiguration = dbFacade.getDnsResolverConfigurationDao().get(FixturesTool.EXISTING_DNS_RESOLVER_CONFIGURATION);
    NetworkCluster clusterFromDB = clustersFromDB.get(0);
    assertNotNull(clusterFromDB);
    newNet.setCluster(clusterFromDB);
    newNet.setId(Guid.newGuid());
    newNet.setDnsResolverConfiguration(dnsResolverConfiguration);
    dao.save(newNet);
    Network result = dao.getByNameAndDataCenter(newNet.getName(), FixturesTool.DATA_CENTER);
    assertNotNull(result);
    assertEquals(newNet, result);
}
Also used : Network(org.ovirt.engine.core.common.businessentities.network.Network) NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) DnsResolverConfiguration(org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration) Test(org.junit.Test)

Aggregations

NetworkCluster (org.ovirt.engine.core.common.businessentities.network.NetworkCluster)62 Test (org.junit.Test)19 Network (org.ovirt.engine.core.common.businessentities.network.Network)17 ArrayList (java.util.ArrayList)15 NetworkClusterId (org.ovirt.engine.core.common.businessentities.network.NetworkClusterId)7 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)6 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)6 ManageNetworkClustersParameters (org.ovirt.engine.core.common.action.ManageNetworkClustersParameters)5 List (java.util.List)4 Map (java.util.Map)4 PairQueryable (org.ovirt.engine.core.common.utils.PairQueryable)4 Guid (org.ovirt.engine.core.compat.Guid)4 HashMap (java.util.HashMap)3 LinkedHashMap (java.util.LinkedHashMap)3 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)3 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)3 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)2 Collection (java.util.Collection)2 Collections (java.util.Collections)2 HashSet (java.util.HashSet)2