@Test public void transformsTXTRecordSet() { Record input = new Record(); input.name = "denominator.io"; input.type = "TXT"; input.ttl = 3600; input.data = "Hello DNS"; assertThat(DesignateFunctions.toRDataMap(input)) .containsEntry("txtdata", "Hello DNS"); }
static Map<String, Object> toRDataMap(Record record) { if ("A".equals(record.type)) { return AData.create(record.data); } else if ("AAAA".equals(record.type)) { return AAAAData.create(record.data); } else if ("CNAME".equals(record.type)) { return CNAMEData.create(record.data); } else if ("MX".equals(record.type)) { return MXData.create(record.priority, record.data); } else if ("NS".equals(record.type)) { return NSData.create(record.data); } else if ("SRV".equals(record.type)) { List<String> rdata = split(' ', record.data); return SRVData.builder() .priority(record.priority) .weight(Integer.valueOf(rdata.get(0))) .port(Integer.valueOf(rdata.get(1))) .target(rdata.get(2)).build(); } else if ("TXT".equals(record.type)) { return TXTData.create(record.data); } else { throw new UnsupportedOperationException("record type not yet supported" + record); } }
DesignateFunctions { static Map<String, Object> toRDataMap(Record record) { if ("A".equals(record.type)) { return AData.create(record.data); } else if ("AAAA".equals(record.type)) { return AAAAData.create(record.data); } else if ("CNAME".equals(record.type)) { return CNAMEData.create(record.data); } else if ("MX".equals(record.type)) { return MXData.create(record.priority, record.data); } else if ("NS".equals(record.type)) { return NSData.create(record.data); } else if ("SRV".equals(record.type)) { List<String> rdata = split(' ', record.data); return SRVData.builder() .priority(record.priority) .weight(Integer.valueOf(rdata.get(0))) .port(Integer.valueOf(rdata.get(1))) .target(rdata.get(2)).build(); } else if ("TXT".equals(record.type)) { return TXTData.create(record.data); } else { throw new UnsupportedOperationException("record type not yet supported" + record); } } }
DesignateFunctions { static Map<String, Object> toRDataMap(Record record) { if ("A".equals(record.type)) { return AData.create(record.data); } else if ("AAAA".equals(record.type)) { return AAAAData.create(record.data); } else if ("CNAME".equals(record.type)) { return CNAMEData.create(record.data); } else if ("MX".equals(record.type)) { return MXData.create(record.priority, record.data); } else if ("NS".equals(record.type)) { return NSData.create(record.data); } else if ("SRV".equals(record.type)) { List<String> rdata = split(' ', record.data); return SRVData.builder() .priority(record.priority) .weight(Integer.valueOf(rdata.get(0))) .port(Integer.valueOf(rdata.get(1))) .target(rdata.get(2)).build(); } else if ("TXT".equals(record.type)) { return TXTData.create(record.data); } else { throw new UnsupportedOperationException("record type not yet supported" + record); } } private  DesignateFunctions(); }
DesignateFunctions { static Map<String, Object> toRDataMap(Record record) { if ("A".equals(record.type)) { return AData.create(record.data); } else if ("AAAA".equals(record.type)) { return AAAAData.create(record.data); } else if ("CNAME".equals(record.type)) { return CNAMEData.create(record.data); } else if ("MX".equals(record.type)) { return MXData.create(record.priority, record.data); } else if ("NS".equals(record.type)) { return NSData.create(record.data); } else if ("SRV".equals(record.type)) { List<String> rdata = split(' ', record.data); return SRVData.builder() .priority(record.priority) .weight(Integer.valueOf(rdata.get(0))) .port(Integer.valueOf(rdata.get(1))) .target(rdata.get(2)).build(); } else if ("TXT".equals(record.type)) { return TXTData.create(record.data); } else { throw new UnsupportedOperationException("record type not yet supported" + record); } } private  DesignateFunctions();  }
DesignateFunctions { static Map<String, Object> toRDataMap(Record record) { if ("A".equals(record.type)) { return AData.create(record.data); } else if ("AAAA".equals(record.type)) { return AAAAData.create(record.data); } else if ("CNAME".equals(record.type)) { return CNAMEData.create(record.data); } else if ("MX".equals(record.type)) { return MXData.create(record.priority, record.data); } else if ("NS".equals(record.type)) { return NSData.create(record.data); } else if ("SRV".equals(record.type)) { List<String> rdata = split(' ', record.data); return SRVData.builder() .priority(record.priority) .weight(Integer.valueOf(rdata.get(0))) .port(Integer.valueOf(rdata.get(1))) .target(rdata.get(2)).build(); } else if ("TXT".equals(record.type)) { return TXTData.create(record.data); } else { throw new UnsupportedOperationException("record type not yet supported" + record); } } private  DesignateFunctions();   }