Search in sources :

Example 21 with NetworkCluster

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

the class AutodefineExternalNetworkCommandTest method createNetworkClusters.

private List<NetworkCluster> createNetworkClusters() {
    NetworkCluster networkCluster = new NetworkCluster();
    networkCluster.setNetworkId(PHYSICAL_NETWORK_ID);
    networkCluster.setClusterId(CLUSTER_ID);
    List<NetworkCluster> networkClusters = new ArrayList<>();
    networkClusters.add(networkCluster);
    return networkClusters;
}
Also used : ArrayList(java.util.ArrayList) NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster)

Example 22 with NetworkCluster

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

the class NetworkClusterDaoTest method testUpdate.

/**
 * Ensures that updating a cluster works as expected.
 */
@Test
public void testUpdate() {
    existingNetworkCluster.setRequired(!existingNetworkCluster.isRequired());
    existingNetworkCluster.setDisplay(!existingNetworkCluster.isDisplay());
    existingNetworkCluster.setMigration(!existingNetworkCluster.isMigration());
    existingNetworkCluster.setManagement(!existingNetworkCluster.isManagement());
    existingNetworkCluster.setStatus(invert(existingNetworkCluster.getStatus()));
    dao.update(existingNetworkCluster);
    NetworkCluster result = dao.get(existingNetworkCluster.getId());
    assertNetworkClustersEqual(existingNetworkCluster, result);
}
Also used : NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) Test(org.junit.Test)

Example 23 with NetworkCluster

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

the class NetworkClusterDaoTest method testSetDisplay.

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

Example 24 with NetworkCluster

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

the class NetworkClusterDaoTest method testSetManagement.

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

Example 25 with NetworkCluster

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

the class NetworkClusterDaoTest method createNewNetworkCluster.

private void createNewNetworkCluster() {
    newNetworkCluster = new NetworkCluster();
    newNetworkCluster.setNetworkId(networkNoCluster.getId());
    newNetworkCluster.setClusterId(freeCluster.getId());
    newNetworkCluster.setStatus(NetworkStatus.OPERATIONAL);
    newNetworkCluster.setManagement(true);
    newNetworkCluster.setRequired(true);
    newNetworkCluster.setDisplay(true);
    newNetworkCluster.setMigration(true);
}
Also used : NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster)

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