本文整理匯總了Java中org.xbill.DNS.Name.root方法的典型用法代碼示例。如果您正苦於以下問題:Java Name.root方法的具體用法?Java Name.root怎麽用?Java Name.root使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.xbill.DNS.Name
的用法示例。
在下文中一共展示了Name.root方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testGetSectionByType
import org.xbill.DNS.Name; //導入方法依賴的package包/類
@Test()
public void testGetSectionByType() throws UnknownHostException {
Message m = new Message();
Record r1 = new ARecord(Name.root, DClass.IN, 0, InetAddress.getByAddress(new byte[]{0,0,0,0}));
m.addRecord(r1, Section.ANSWER);
Record r2 = new AAAARecord(Name.root, DClass.IN, 0, InetAddress.getByAddress(new byte[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}));
m.addRecord(r2, Section.ANSWER);
SMessage sm = new SMessage(m);
SRRset[] result = sm.getSectionRRsets(Section.ANSWER, Type.A);
assertEquals(1, result.length);
assertEquals(Type.A, result[0].getType());
}
示例2: testAnswerSectionSearchFound
import org.xbill.DNS.Name; //導入方法依賴的package包/類
@Test()
public void testAnswerSectionSearchFound() throws UnknownHostException {
Message m = new Message();
Record r = new ARecord(Name.root, DClass.IN, 0, InetAddress.getByAddress(new byte[]{0,0,0,0}));
m.addRecord(r, Section.ANSWER);
SMessage sm = new SMessage(m);
SRRset result = sm.findAnswerRRset(Name.root, Type.A, DClass.IN);
assertEquals(r, result.first());
}
示例3: testAnswerSectionSearchNotFoundDifferentClass
import org.xbill.DNS.Name; //導入方法依賴的package包/類
@Test()
public void testAnswerSectionSearchNotFoundDifferentClass() throws UnknownHostException {
Message m = new Message();
Record r = new ARecord(Name.root, DClass.IN, 0, InetAddress.getByAddress(new byte[]{0,0,0,0}));
m.addRecord(r, Section.ANSWER);
SMessage sm = new SMessage(m);
SRRset result = sm.findAnswerRRset(Name.root, Type.A, DClass.CH);
assertNull(result);
}
示例4: testAnswerSectionSearchNotFoundDifferentType
import org.xbill.DNS.Name; //導入方法依賴的package包/類
@Test()
public void testAnswerSectionSearchNotFoundDifferentType() throws UnknownHostException {
Message m = new Message();
Record r = new ARecord(Name.root, DClass.IN, 0, InetAddress.getByAddress(new byte[]{0,0,0,0}));
m.addRecord(r, Section.ANSWER);
SMessage sm = new SMessage(m);
SRRset result = sm.findAnswerRRset(Name.root, Type.MX, DClass.IN);
assertNull(result);
}
示例5: testVerifyWithoutSignaturesIsBogus
import org.xbill.DNS.Name; //導入方法依賴的package包/類
@Test
public void testVerifyWithoutSignaturesIsBogus() {
DnsSecVerifier verifier = new DnsSecVerifier();
ARecord record = new ARecord(Name.root, DClass.IN, 120, localhost);
RRset set = new RRset(record);
RRset keys = new RRset();
SecurityStatus result = verifier.verify(set, keys);
assertEquals(SecurityStatus.BOGUS, result);
}
示例6: toRecord
import org.xbill.DNS.Name; //導入方法依賴的package包/類
protected Record toRecord(String data){
try {
InputStream in = new ByteArrayInputStream(data.getBytes("UTF-8"));
Master m = new Master(in, Name.root);
return m._nextRecord();
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
示例7: loadTrustAnchors
import org.xbill.DNS.Name; //導入方法依賴的package包/類
/**
* Load the trust anchor file into the trust anchor store. The trust anchors
* are currently stored in a zone file format list of DNSKEY or DS records.
*
* @param data The trust anchor data.
* @throws IOException when the trust anchor data could not be read.
*/
@SuppressWarnings("unchecked")
public void loadTrustAnchors(InputStream data) throws IOException {
// First read in the whole trust anchor file.
Master master = new Master(data, Name.root, 0);
List<Record> records = new ArrayList<Record>();
Record mr;
while ((mr = master.nextRecord()) != null) {
records.add(mr);
}
// Record.compareTo() should sort them into DNSSEC canonical order.
// Don't care about canonical order per se, but do want them to be
// formable into RRsets.
Collections.sort(records);
SRRset currentRrset = new SRRset();
for (Record r : records) {
// Skip RR types that cannot be used as trust anchors.
if (r.getType() != Type.DNSKEY && r.getType() != Type.DS) {
continue;
}
// If our current set is empty, we can just add it.
if (currentRrset.size() == 0) {
currentRrset.addRR(r);
continue;
}
// If this record matches our current RRset, we can just add it.
if (currentRrset.getName().equals(r.getName()) && currentRrset.getType() == r.getType() && currentRrset.getDClass() == r.getDClass()) {
currentRrset.addRR(r);
continue;
}
// Otherwise, we add the rrset to our set of trust anchors and begin
// a new set
this.trustAnchors.store(currentRrset);
currentRrset = new SRRset();
currentRrset.addRR(r);
}
// add the last rrset (if it was not empty)
if (currentRrset.size() > 0) {
this.trustAnchors.store(currentRrset);
}
}
示例8: testAtLeastOneSupportedAlgorithmWithOnlyNonDSRecords
import org.xbill.DNS.Name; //導入方法依賴的package包/類
@Test
public void testAtLeastOneSupportedAlgorithmWithOnlyNonDSRecords() {
RRset set = new RRset(new NSECRecord(Name.root, DClass.IN, 0, Name.root, new int[] { Type.A }));
boolean result = ValUtils.atLeastOneSupportedAlgorithm(set);
assertFalse(result);
}
示例9: testAtLeastOneDigestSupportedWithOnlyNonDSRecords
import org.xbill.DNS.Name; //導入方法依賴的package包/類
@Test
public void testAtLeastOneDigestSupportedWithOnlyNonDSRecords() {
RRset set = new RRset(new NSECRecord(Name.root, DClass.IN, 0, Name.root, new int[] { Type.A }));
boolean result = ValUtils.atLeastOneDigestSupported(set);
assertFalse(result);
}