Search in sources :

Example 6 with NameServer

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

the class NetworkDaoTest method testUpdate.

/**
 * Ensures updating a network works as expected.
 */
@Test
public void testUpdate() {
    Network before = dao.getByNameAndCluster(EXISTING_NETWORK_NAME1, FixturesTool.CLUSTER);
    before.setDescription("This is a completely changed description");
    before.getDnsResolverConfiguration().getNameServers().add(new NameServer("1.1.1.1"));
    dao.update(before);
    Network after = dao.getByNameAndCluster(EXISTING_NETWORK_NAME1, FixturesTool.CLUSTER);
    assertNotNull(after);
    assertEquals(before, after);
}
Also used : NameServer(org.ovirt.engine.core.common.businessentities.network.NameServer) Network(org.ovirt.engine.core.common.businessentities.network.Network) Test(org.junit.Test)

Example 7 with NameServer

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

the class DnsResolverConfigurationDaoTest method generateNewEntity.

@Override
protected DnsResolverConfiguration generateNewEntity() {
    DnsResolverConfiguration dnsResolverConfiguration = new DnsResolverConfiguration();
    dnsResolverConfiguration.setNameServers(new ArrayList<>(Arrays.asList(new NameServer("1.1.1.1"))));
    return dnsResolverConfiguration;
}
Also used : NameServer(org.ovirt.engine.core.common.businessentities.network.NameServer) DnsResolverConfiguration(org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration)

Example 8 with NameServer

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

the class DnsResolverConfigurationDaoTest method dnsResolverConfigurationFromFixtures.

public DnsResolverConfiguration dnsResolverConfigurationFromFixtures() {
    DnsResolverConfiguration expected = new DnsResolverConfiguration();
    expected.setId(FixturesTool.EXISTING_DNS_RESOLVER_CONFIGURATION);
    expected.setNameServers(Arrays.asList(new NameServer("192.168.1.2"), new NameServer("2002:0db8:85a3:0000:0000:8a2e:0370:7334")));
    return expected;
}
Also used : NameServer(org.ovirt.engine.core.common.businessentities.network.NameServer) DnsResolverConfiguration(org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration)

Example 9 with NameServer

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

the class VdsDynamicDaoTest method testUpdateDnsResolverConfiguration.

@Test
public void testUpdateDnsResolverConfiguration() {
    VdsDynamic before = dao.get(getExistingEntityId());
    before.getReportedDnsResolverConfiguration().setNameServers(Collections.singletonList(new NameServer("1.1.1.1")));
    dao.updateDnsResolverConfiguration(before.getId(), before.getReportedDnsResolverConfiguration());
    VdsDynamic after = dao.get(getExistingEntityId());
    assertEquals(before.getReportedDnsResolverConfiguration(), after.getReportedDnsResolverConfiguration());
}
Also used : NameServer(org.ovirt.engine.core.common.businessentities.network.NameServer) VdsDynamic(org.ovirt.engine.core.common.businessentities.VdsDynamic) Test(org.junit.Test)

Example 10 with NameServer

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

the class NetworkAttachmentDaoImplTest method testUpdate.

/**
 * Ensures that the update is working correctly
 */
@Test
public void testUpdate() {
    networkAttachment.setNicId(FixturesTool.NETWORK_ATTACHMENT_NIC);
    dao.save(networkAttachment);
    IpConfiguration ipConfiguration = populateIpConfiguration(networkAttachment.getIpConfiguration(), Ipv4BootProtocol.STATIC_IP, Ipv6BootProtocol.NONE);
    networkAttachment.setIpConfiguration(ipConfiguration);
    Map<String, String> properties = new HashMap<>();
    properties.put("key", "value");
    networkAttachment.setProperties(properties);
    networkAttachment.setNicId(FixturesTool.NETWORK_ATTACHMENT_NIC2);
    networkAttachment.getDnsResolverConfiguration().getNameServers().add(new NameServer("2.2.2.2"));
    dao.update(networkAttachment);
    NetworkAttachment result = dao.get(networkAttachment.getId());
    assertNotNull(result);
    assertNetworkAttachmentEquals(networkAttachment, result);
}
Also used : IpConfiguration(org.ovirt.engine.core.common.businessentities.network.IpConfiguration) HashMap(java.util.HashMap) NameServer(org.ovirt.engine.core.common.businessentities.network.NameServer) NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment) Test(org.junit.Test)

Aggregations

NameServer (org.ovirt.engine.core.common.businessentities.network.NameServer)14 DnsResolverConfiguration (org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration)9 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)4 Test (org.junit.Test)3 IpConfiguration (org.ovirt.engine.core.common.businessentities.network.IpConfiguration)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Network (org.ovirt.engine.core.common.businessentities.network.Network)2 Before (org.junit.Before)1 DnsResolverConfiguration (org.ovirt.engine.api.model.DnsResolverConfiguration)1 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)1 VdsDynamic (org.ovirt.engine.core.common.businessentities.VdsDynamic)1 HostNetworkQos (org.ovirt.engine.core.common.businessentities.network.HostNetworkQos)1 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)1