-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnswerTest.java
More file actions
39 lines (34 loc) · 1.12 KB
/
AnswerTest.java
File metadata and controls
39 lines (34 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import javax.swing.JFrame;
import javax.swing.JTree;
/**
* Tests DNSAnswer and DNSAnswerGuiDecorator.
*
* @author Chris Blades
* @version 20/3/2010
*/
public class AnswerTest {
/**
* Create a new DNSAnswer and give it fudged values, wrap in a
* DNSAnswerGuiDecorator and then display it.
*
* @param args no purpose here
*/
public static void main(String[] args) {
DNSAnswer answer = new DNSAnswerImpl();
DNSUrl url = new DNSUrlImpl("www.google.com");
// fudge values
answer.setName(url);
answer.setType(DNSRecordTypeEnum.CNAME);
answer.setClass(DNSRecordClassEnum.IN);
answer.setTTL(299);
answer.setData(new DNSUrlImpl("www.yahoo.com"));
// wrap in decorator
DNSAnswerGuiDecorator dec = new DNSAnswerGuiDecorator(answer);
// display decorator
JFrame frame = new JFrame("DNS Resolver");
frame.setSize(300, 500);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(new JTree(dec));
frame.setVisible(true);
}
}