1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.springframework.extensions.surf.integration;
20
21 import java.util.Iterator;
22
23 import org.json.JSONObject;
24 import org.junit.Ignore;
25 import org.junit.Test;
26
27
28
29
30
31
32
33 @Ignore public class RemoteAPITest extends AbstractSeleniumTestCase
34 {
35
36
37
38 @Ignore @Test public void test1() throws Exception
39 {
40 selenium.open("/api/surf/objects/page");
41 JSONObject pages = new JSONObject(selenium.getBodyText());
42 assert("OK".equalsIgnoreCase(pages.getString("code")));
43
44 JSONObject results = pages.getJSONObject("results");
45 Iterator keys = results.keys();
46 while (keys.hasNext())
47 {
48 String pageId = (String) keys.next();
49
50 JSONObject page = (JSONObject) results.getJSONObject(pageId);
51 assert(page != null);
52
53 assertValidPage(page);
54 }
55 }
56
57 @Ignore @Test public void assertValidPage(JSONObject page) throws Exception
58 {
59 String id = page.getString("id");
60 assert(id != null);
61
62 String title = page.getString("title");
63 assert(title != null);
64
65 String templateInstance = page.getString("template-instance");
66 assert(templateInstance != null);
67
68 String description = page.getString("description");
69 assert(description != null);
70
71 String authentication = page.getString("authentication");
72 assert(authentication != null);
73
74 String pageTypeId = page.getString("page-type-id");
75 assert(pageTypeId != null);
76 }
77 }