Search in sources :

Example 6 with SOARecord

use of org.xbill.DNS.SOARecord in project nhin-d by DirectProject.

the class ServiceTest method testSOA.

//  @Test
public void testSOA() {
    DNSEntryForm SoadnsForm = new DNSEntryForm();
    SoadnsForm.setName("savvy");
    SoadnsForm.setTtl(84555L);
    SoadnsForm.setAdmin("ns.savvy.com");
    SoadnsForm.setDomain("ns2.savvy.com");
    SoadnsForm.setSerial(4L);
    SoadnsForm.setRefresh(6L);
    SoadnsForm.setRetry(8L);
    SoadnsForm.setExpire(66L);
    SoadnsForm.setMinimum(22L);
    Collection<DNSRecord> records = new ArrayList<DNSRecord>();
    records.add(DNSRecordUtils.createSOARecord(SoadnsForm.getName(), SoadnsForm.getTtl(), SoadnsForm.getDomain(), SoadnsForm.getAdmin(), (int) SoadnsForm.getSerial(), SoadnsForm.getRefresh(), SoadnsForm.getRetry(), SoadnsForm.getExpire(), SoadnsForm.getMinimum()));
    try {
        configSvc.addDNS(records);
        Collection<DNSRecord> arecords = configSvc.getDNSByType(DNSType.SOA.getValue());
        for (Iterator<DNSRecord> iter = arecords.iterator(); iter.hasNext(); ) {
            DNSRecord arec = iter.next();
            SOARecord newrec = (SOARecord) Record.newRecord(Name.fromString(arec.getName()), arec.getType(), arec.getDclass(), arec.getTtl(), arec.getData());
            System.out.println("A admin: " + newrec.getAdmin());
            System.out.println("A name: " + newrec.getName());
        }
    } catch (ConfigurationServiceException e) {
        e.printStackTrace();
    } catch (TextParseException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
Also used : DNSRecord(org.nhindirect.config.store.DNSRecord) ArrayList(java.util.ArrayList) ConfigurationServiceException(org.nhindirect.config.service.ConfigurationServiceException) DNSEntryForm(org.nhindirect.config.ui.form.DNSEntryForm) SOARecord(org.xbill.DNS.SOARecord) TextParseException(org.xbill.DNS.TextParseException)

Aggregations

SOARecord (org.xbill.DNS.SOARecord)6 ArrayList (java.util.ArrayList)5 ARecord (org.xbill.DNS.ARecord)5 MXRecord (org.xbill.DNS.MXRecord)4 DNSEntryForm (org.nhindirect.config.ui.form.DNSEntryForm)3 AAAARecord (org.xbill.DNS.AAAARecord)3 NSRecord (org.xbill.DNS.NSRecord)3 TextParseException (org.xbill.DNS.TextParseException)3 IOException (java.io.IOException)2 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2 X509Certificate (java.security.cert.X509Certificate)2 List (java.util.List)2 CertificateEncodingException (javax.security.cert.CertificateEncodingException)2 DnsRecord (org.nhind.config.DnsRecord)2 ServiceException (org.nhindirect.common.rest.exceptions.ServiceException)2 Certificate (org.nhindirect.config.model.Certificate)2 DNSRecord (org.nhindirect.config.model.DNSRecord)2 ConfigurationServiceException (org.nhindirect.config.service.ConfigurationServiceException)2 BaseTestPlan (org.nhindirect.dns.util.BaseTestPlan)2 CERTRecord (org.xbill.DNS.CERTRecord)2