Source Code Cross Referenced for ContainerWicketTest.java in  » Net » Terracotta » com » tctest » wicket » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » Terracotta » com.tctest.wicket 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice.  All rights reserved.
003:         */
004:        package com.tctest.wicket;
005:
006:        import java.util.Collections;
007:        import java.util.Date;
008:
009:        import junit.framework.Test;
010:
011:        import org.apache.commons.logging.LogFactory;
012:        import org.apache.log4j.Logger;
013:        import org.apache.wicket.Page;
014:        import org.apache.wicket.markup.html.WebPage;
015:        import org.apache.wicket.markup.html.basic.Label;
016:        import org.apache.wicket.markup.html.link.Link;
017:        import org.apache.wicket.model.PropertyModel;
018:        import org.apache.wicket.protocol.http.WebApplication;
019:        import org.apache.wicket.protocol.http.WicketServlet;
020:
021:        import com.meterware.httpunit.WebConversation;
022:        import com.meterware.httpunit.WebLink;
023:        import com.meterware.httpunit.WebResponse;
024:        import com.tc.test.server.appserver.deployment.AbstractTwoServerDeploymentTest;
025:        import com.tc.test.server.appserver.deployment.DeploymentBuilder;
026:        import com.tc.test.server.appserver.deployment.WebApplicationServer;
027:        import com.tc.test.server.util.TcConfigBuilder;
028:        import com.tc.util.TIMUtil;
029:        import com.tc.util.runtime.Vm;
030:
031:        /**
032:         * An in-container smoke test for Wicket framework
033:         * 
034:         * @author Eugene Kuleshov
035:         */
036:        public class ContainerWicketTest extends
037:                AbstractTwoServerDeploymentTest {
038:            private static final String CONFIG_FILE_FOR_TEST = "/tc-config-files/wicket-tc-config.xml";
039:
040:            public static Test suite() {
041:                return new ContainerWicketTestSetup();
042:            }
043:
044:            public ContainerWicketTest() {
045:                if (Vm.isIBM()) {
046:                    this .disableAllUntil(new Date(Long.MAX_VALUE));
047:                }
048:            }
049:
050:            public boolean shouldDisable() {
051:                return super .shouldDisable() || Vm.isIBM();
052:            }
053:
054:            public void testWicketInitialization() throws Exception {
055:
056:                WebConversation webConversation1 = new WebConversation();
057:
058:                WebResponse response1 = request(server0, webConversation1, "");
059:                WebLink[] links1 = response1.getLinks();
060:                assertEquals(1, links1.length);
061:                assertEquals("Action link clicked 0 times", links1[0].getText());
062:
063:                WebResponse response2 = request(server0, webConversation1,
064:                        links1[0].getURLString());
065:                WebLink[] links2 = response2.getLinks();
066:                assertEquals(1, links2.length);
067:                assertEquals("Action link clicked 1 times", links2[0].getText());
068:
069:                WebResponse response3 = request(server1, webConversation1, "?"
070:                        + response2.getURL().getQuery());
071:                WebLink[] links3 = response3.getLinks();
072:                assertEquals(1, links3.length);
073:                assertEquals("Action link clicked 1 times", links3[0].getText());
074:
075:                WebResponse response4 = request(server1, webConversation1,
076:                        links3[0].getURLString());
077:                WebLink[] links4 = response4.getLinks();
078:                assertEquals(1, links4.length);
079:                assertEquals("Action link clicked 2 times", links4[0].getText());
080:
081:                WebResponse response5 = request(server0, webConversation1, "?"
082:                        + response4.getURL().getQuery());
083:                WebLink[] links5 = response5.getLinks();
084:                assertEquals(1, links5.length);
085:                assertEquals("Action link clicked 2 times", links5[0].getText());
086:
087:            }
088:
089:            private WebResponse request(WebApplicationServer server,
090:                    WebConversation conversation, String params)
091:                    throws Exception {
092:                return server.ping("/wicket-test/clickcounter/" + params,
093:                        conversation);
094:            }
095:
096:            private static class ContainerWicketTestSetup extends
097:                    TwoServerTestSetup {
098:                private ContainerWicketTestSetup() {
099:                    super (ContainerWicketTest.class, CONFIG_FILE_FOR_TEST,
100:                            "wicket-test");
101:                }
102:
103:                protected void configureWar(DeploymentBuilder builder) {
104:                    // builder.addBeanDefinitionFile(BEAN_DEFINITION_FILE_FOR_TEST);
105:                    // builder.addRemoteService(REMOTE_SERVICE_NAME, "singleton",
106:                    // ISingleton.class);
107:
108:                    builder.addDirectoryOrJARContainingClass(Page.class); // wicket*.jar
109:                    builder.addDirectoryOrJARContainingClass(Logger.class); // log4j
110:                    builder.addDirectoryOrJARContainingClass(LogFactory.class); // common-loggings
111:                    builder
112:                            .addDirectoryContainingResource("/com/tctest/wicket/ContainerWicketTest$ClickCounter.html");
113:
114:                    builder.addServlet("ClickCounter", "/clickcounter/*",
115:                            WicketServlet.class, Collections.singletonMap(
116:                                    "applicationClassName",
117:                                    ClickCounterApp.class.getName()), true);
118:                }
119:
120:                protected void configureTcConfig(TcConfigBuilder clientConfig) {
121:                    clientConfig.addModule(TIMUtil.WICKET_1_3, TIMUtil
122:                            .getVersion(TIMUtil.WEBSPHERE_6_1_0_7));
123:                }
124:
125:            }
126:
127:            public static final class ClickCounterApp extends WebApplication {
128:                public Class getHomePage() {
129:                    return ClickCounter.class;
130:                }
131:            }
132:
133:            public static class ClickCounter extends WebPage {
134:                private static final long serialVersionUID = 1L;
135:
136:                private int linkClickCount;
137:
138:                public ClickCounter() {
139:                    final Link actionLink = new Link("actionLink") {
140:                        private static final long serialVersionUID = 1L;
141:
142:                        public void onClick() {
143:                            linkClickCount++;
144:                        }
145:                    };
146:                    actionLink.add(new Label("linkClickCount",
147:                            new PropertyModel(this , "linkClickCount")));
148:                    add(actionLink);
149:                }
150:            }
151:
152:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.