use of org.nhindirect.config.ui.form.DNSEntryForm 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();
}
}
Aggregations