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
40
41
42
43
44
45 package org.melati.test.test;
46
47 import org.melati.JettyWebTestCase;
48
49 /**
50 * @author timp
51 * @since 28 Feb 2008
52 *
53 */
54 public class ConfigServletTestTest extends JettyWebTestCase {
55
56 /**
57 * Constructor.
58 * @param name
59 */
60 public ConfigServletTestTest(String name) {
61 super(name);
62 }
63
64 /**
65 * {@inheritDoc}
66 * @see org.melati.JettyWebTestCase#setUp()
67 */
68 protected void setUp() throws Exception {
69 super.setUp();
70 }
71
72 /**
73 * {@inheritDoc}
74 * @see org.melati.JettyWebTestCase#tearDown()
75 */
76 protected void tearDown() throws Exception {
77 super.tearDown();
78 }
79
80 /**
81 * Click Exception link.
82 */
83 public void testException() {
84 setScriptingEnabled(false);
85 beginAt("/org.melati.test.ConfigServletTest");
86 clickLinkWithText("Exception");
87 assertTextPresent("MelatiBugMelatiException");
88 }
89 /**
90 * Click Redirect link.
91 */
92 public void testRedirect() {
93 setScriptingEnabled(false);
94 beginAt("/org.melati.test.ConfigServletTest");
95 clickLinkWithText("Redirect");
96 assertTextPresent("Melati is a tool");
97 }
98 /**
99 * Fill and click upload.
100 */
101 public void testUpload() {
102 setScriptingEnabled(false);
103 beginAt("/org.melati.test.ConfigServletTest");
104 assertTextPresent("FormDataAdaptorFactory");
105 assertTextPresent("org.melati.servlet.MemoryDataAdaptorFactory");
106 setTextField("file","/dist/melati/melati/src/main/java/org/melati/admin/static/file.gif");
107 submit();
108 assertWindowPresent("Upload");
109 setTextField("file","/dist/melati/LICENSE-GPL.txt");
110 submit();
111 gotoWindow("Upload");
112 assertTextPresent("GNU GENERAL PUBLIC LICENSE");
113
114 }
115 /**
116 * Fill and click upload.
117 */
118 public void testUploadNothing() {
119 setScriptingEnabled(false);
120 beginAt("/org.melati.test.ConfigServletTest");
121 submit();
122 gotoWindow("Upload");
123 assertTextPresent("No file was uploaded");
124
125 }
126
127 }