01: package simpleorm.simplewebapp.eg.simple;
02:
03: import simpleorm.simplewebapp.eg.WAllTests;
04: import simpleorm.simplewebapp.core.WPageStructure;
05: import simpleorm.simplewebapp.core.WButton;
06: import simpleorm.simplewebapp.context.WPageContextTest;
07:
08: import java.util.Map;
09: import java.util.LinkedHashMap;
10:
11: public class WListBeanTest {
12: public static void main(String[] args) throws Exception {
13: WListBeanTest.unfiltered();
14: WListBeanTest.filtered();
15: }
16:
17: static void unfiltered() throws Exception {
18: Map<String, String> fields = new LinkedHashMap();
19: fields.put(WButton.BUTTONS_NAME, "Search");
20:
21: WManualListPage page = WAllTests.MENUS.simple.manualList
22: .newPage();
23:
24: page.setPageContext(new WPageContextTest(page, fields));
25: WPageStructure struct = page.getPageStructure();
26:
27: WAllTests.assertEquals("!Name", page.translate("name"));
28: WAllTests.assertEquals("?xyzzx", page.translate("xyzzx")); // not in prompt.properties
29:
30: struct.doMain();
31: struct.doListRow();
32: struct.doListRow();
33: WAllTests.assertEquals("two", page.getField("id").getText());
34: WAllTests.assertEquals(
35: "/dummyCtx/swb/Simple/WManualCrudPage.swb?id=two", page
36: .getField("id").getAnchorHRef());
37: struct.doFinalize();
38: }
39:
40: static void filtered() throws Exception {
41: Map<String, String> fields = new LinkedHashMap();
42: fields.put("nameWord", "row");
43: fields.put(WButton.BUTTONS_NAME, "Search");
44:
45: WManualListPage page = WAllTests.MENUS.simple.manualList
46: .newPage();
47:
48: page.setPageContext(new WPageContextTest(page, fields));
49: WPageStructure struct = page.getPageStructure();
50: struct.doMain();
51: struct.doListRow();
52: struct.doListRow();
53: WAllTests.assertEquals("three", page.getField("id").getText());
54: struct.doFinalize();
55: }
56:
57: }
|