lipog-commit Mailing List for Little Portal Gizmo (Page 3)
Status: Beta
Brought to you by:
jbu
You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(94) |
Jun
(14) |
Jul
(168) |
Aug
(39) |
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(6) |
Dec
|
From: Joerg B. <jb...@us...> - 2009-07-31 18:09:08
|
Update of /cvsroot/lipog/net.heilancoo.portal.testutils/src/net/heilancoo/portal/testutils In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv27336/src/net/heilancoo/portal/testutils Added Files: AppUtils.java Log Message: this is going to be a collection of web test convenience methods --- NEW FILE: AppUtils.java --- /* * Copyright (c) 2009 Heilan' Coo -- Joerg Bullmann * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which is available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Joerg Bullmann <jb...@he...> */ package net.heilancoo.portal.testutils; import static org.junit.Assert.assertEquals; import java.io.IOException; import java.net.MalformedURLException; import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.HtmlForm; import com.gargoylesoftware.htmlunit.html.HtmlPage; /** * @author joerg * */ public class AppUtils { public static HtmlPage doDefaultLogin(String protoHostPort, String app, String user, String passwd) throws FailingHttpStatusCodeException, MalformedURLException, IOException { WebClient cl = new WebClient(); HtmlPage loginPage = cl.getPage(protoHostPort + "/" + app); assertEquals("Login", loginPage.getTitleText()); HtmlForm login = loginPage.getFormByName("loginForm"); login.getInputByName("user").setValueAttribute(user); login.getInputByName("password").setValueAttribute(passwd); HtmlPage loggedIn = login.getInputByName("login").click(); return loggedIn; } } |
From: Joerg B. <jb...@us...> - 2009-07-28 17:04:49
|
Update of /cvsroot/lipog/net.heilancoo.portal.documentation/doc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17337/doc Modified Files: webapp-123.html Log Message: more fixes to session class example code Index: webapp-123.html =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.documentation/doc/webapp-123.html,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** webapp-123.html 28 Jul 2009 16:59:47 -0000 1.18 --- webapp-123.html 28 Jul 2009 17:04:40 -0000 1.19 *************** *** 126,135 **** public class BingoSession implements Session { - @Override - public Controller getInitialController() { - // TODO Auto-generated method stub - return null; - } - } </pre> --- 126,129 ---- *************** *** 158,167 **** } - @Override - public Controller getInitialController() { - // TODO Auto-generated method stub - return null; - } - @Request public void main(HttpRequest request, FormFieldContainer fields, --- 152,155 ---- |
From: Joerg B. <jb...@us...> - 2009-07-28 16:59:55
|
Update of /cvsroot/lipog/net.heilancoo.portal.documentation/doc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv16153/doc Modified Files: webapp-123.html Log Message: fix session Index: webapp-123.html =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.documentation/doc/webapp-123.html,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** webapp-123.html 13 Jul 2009 18:22:09 -0000 1.17 --- webapp-123.html 28 Jul 2009 16:59:47 -0000 1.18 *************** *** 298,305 **** } ! @Override ! public Controller getInitialController() { ! // TODO Auto-generated method stub ! return null; } --- 298,303 ---- } ! public long getAccessCounter() { ! return accessCounter; } |
From: Joerg B. <jb...@us...> - 2009-07-28 16:55:42
|
Update of /cvsroot/lipog/net.heilancoo.portal.documentation/doc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15665/doc Modified Files: apptest-123.html Log Message: cosmetic comment fix Index: apptest-123.html =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.documentation/doc/apptest-123.html,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** apptest-123.html 28 Jul 2009 16:40:56 -0000 1.2 --- apptest-123.html 28 Jul 2009 16:55:25 -0000 1.3 *************** *** 91,95 **** assertEquals(2, s.getAccessCounter()); ! // ===================================================== // Back on the client side. Log out! HtmlPage loggedOut = loggedIn.getAnchorByHref("logout").click(); --- 91,95 ---- assertEquals(2, s.getAccessCounter()); ! // ================================= // Back on the client side. Log out! HtmlPage loggedOut = loggedIn.getAnchorByHref("logout").click(); |
From: Joerg B. <jb...@us...> - 2009-07-28 16:41:10
|
Update of /cvsroot/lipog/net.heilancoo.portal.examples.test/src/net/heilancoo/portal/examples/redirect/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13909/src/net/heilancoo/portal/examples/redirect/test Modified Files: WebTests.java Log Message: tweaks to SessonException concept in test helper classes Index: WebTests.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.examples.test/src/net/heilancoo/portal/examples/redirect/test/WebTests.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WebTests.java 26 Jul 2009 15:27:39 -0000 1.2 --- WebTests.java 28 Jul 2009 16:40:59 -0000 1.3 *************** *** 13,16 **** --- 13,17 ---- import static org.junit.Assert.assertEquals; + import static org.junit.Assert.assertNull; import java.io.IOException; *************** *** 19,23 **** import net.heilancoo.portal.application.ApplicationException; import net.heilancoo.portal.examples.redirect.ToDoSession; - import net.heilancoo.portal.session.SessionException; import net.heilancoo.portal.testutils.PortalTest; --- 20,23 ---- *************** *** 33,36 **** --- 33,39 ---- public class WebTests { + // First, the web application service is fired up (we + // wait 500 ms after kicking it off). + @BeforeClass public static void setUpBeforeClass() throws Exception { *************** *** 39,43 **** @Test ! public void loginAndAddItemLogout() throws FailingHttpStatusCodeException, MalformedURLException, IOException, SessionException, ApplicationException { // =========================================================== // Log into the web application. This is client side activity. --- 42,46 ---- @Test ! public void loginAndAddItemLogout() throws FailingHttpStatusCodeException, MalformedURLException, IOException, ApplicationException { // =========================================================== // Log into the web application. This is client side activity. *************** *** 47,52 **** HtmlForm login = pg.getFormByName("input"); ! login.getInputByName("user").setValueAttribute("joerg"); ! login.getInputByName("password").setValueAttribute("joerg"); HtmlPage loggedIn = login.getInputByName("button").click(); --- 50,55 ---- HtmlForm login = pg.getFormByName("input"); ! login.getInputByName("user").setValueAttribute("jimmy"); ! login.getInputByName("password").setValueAttribute("jimmy"); HtmlPage loggedIn = login.getInputByName("button").click(); *************** *** 55,60 **** // Now peep directly into the server side of the application: ToDoSession s = (ToDoSession) PortalTest.getSessionForPage(loggedIn); ! assertEquals("joerg", s.getUser().getName()); ! assertEquals("joerg", s.getUser().getPasswd()); // ===================================================== --- 58,63 ---- // Now peep directly into the server side of the application: ToDoSession s = (ToDoSession) PortalTest.getSessionForPage(loggedIn); ! assertEquals("jimmy", s.getUser().getName()); ! assertEquals("jimmy", s.getUser().getPasswd()); // ===================================================== *************** *** 72,77 **** } ! @Test(expected=SessionException.class) ! public void loginLogoutGetSession() throws FailingHttpStatusCodeException, MalformedURLException, IOException, SessionException, ApplicationException { WebClient cl = new WebClient(); HtmlPage pg = cl.getPage("http://127.0.0.1:8080/todo"); --- 75,83 ---- } ! @Test ! public void loginLogoutGetSession() throws FailingHttpStatusCodeException, MalformedURLException, IOException, ApplicationException { ! // Start off with logging the user in. This is a client-side activity: ! // get the login page, fill in the fields and click the button. ! WebClient cl = new WebClient(); HtmlPage pg = cl.getPage("http://127.0.0.1:8080/todo"); *************** *** 79,98 **** HtmlForm login = pg.getFormByName("input"); ! login.getInputByName("user").setValueAttribute("joerg"); ! login.getInputByName("password").setValueAttribute("joerg"); HtmlPage loggedIn = login.getInputByName("button").click(); ToDoSession s = (ToDoSession) PortalTest.getSessionForPage(loggedIn); ! assertEquals("joerg", s.getUser().getName()); ! assertEquals("joerg", s.getUser().getPasswd()); HtmlPage logout = loggedIn.getAnchorByHref("logout").click(); assertEquals("Logout", logout.getTitleText()); ! // =========================================================== ! // We have logged out and the session is gone from the server. ! // Trying to access it now will result in a SessionException ! PortalTest.getSessionForPage(loggedIn); } --- 85,111 ---- HtmlForm login = pg.getFormByName("input"); ! login.getInputByName("user").setValueAttribute("jimmy"); ! login.getInputByName("password").setValueAttribute("jimmy"); HtmlPage loggedIn = login.getInputByName("button").click(); + // After the successful login we now inspect the application on + // the server and extract the session object from it that corresponds + // to the login activity above. We can do this very easily because + // the web application runs in the same JVM as the test code. + ToDoSession s = (ToDoSession) PortalTest.getSessionForPage(loggedIn); ! assertEquals("jimmy", s.getUser().getName()); ! assertEquals("jimmy", s.getUser().getPasswd()); + // Now we log out. This will remove the session from the server + // application's session map. + HtmlPage logout = loggedIn.getAnchorByHref("logout").click(); assertEquals("Logout", logout.getTitleText()); ! // Trying to get the session again will return a null reference. ! ! assertNull(PortalTest.getSessionForPage(loggedIn)); } |
From: Joerg B. <jb...@us...> - 2009-07-28 16:41:07
|
Update of /cvsroot/lipog/net.heilancoo.portal.documentation/doc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13898/doc Modified Files: apptest-123.html Log Message: tweaks to SessonException concept in test helper classes Index: apptest-123.html =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.documentation/doc/apptest-123.html,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** apptest-123.html 26 Jul 2009 16:47:39 -0000 1.1 --- apptest-123.html 28 Jul 2009 16:40:56 -0000 1.2 *************** *** 64,68 **** @Test ! public void doLoginTest() throws FailingHttpStatusCodeException, MalformedURLException, IOException, SessionException, ApplicationException { // =========================================================== // Log into the web application. This is client side activity. --- 64,68 ---- @Test ! public void doLoginTest() throws FailingHttpStatusCodeException, MalformedURLException, IOException, ApplicationException { // =========================================================== // Log into the web application. This is client side activity. *************** *** 90,93 **** --- 90,102 ---- // And again inspect the server side: assertEquals(2, s.getAccessCounter()); + + // ===================================================== + // Back on the client side. Log out! + HtmlPage loggedOut = loggedIn.getAnchorByHref("logout").click(); + assertEquals("Logout", loggedOut.getTitleText()); + + // ================================= + // The session should now be gone... + assertNull(PortalTest.getSessionForPage(loggedIn)); } |
From: Joerg B. <jb...@us...> - 2009-07-28 16:41:06
|
Update of /cvsroot/lipog/net.heilancoo.bingo.test/src/net/heilancoo/bingo/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13837/src/net/heilancoo/bingo/test Modified Files: BingoApp.java Log Message: tweaks to SessonException concept in test helper classes Index: BingoApp.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.bingo.test/src/net/heilancoo/bingo/test/BingoApp.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BingoApp.java 26 Jul 2009 16:49:00 -0000 1.1 --- BingoApp.java 28 Jul 2009 16:40:47 -0000 1.2 *************** *** 14,17 **** --- 14,18 ---- import static org.junit.Assert.assertEquals; + import static org.junit.Assert.assertNull; import java.io.IOException; *************** *** 20,24 **** import net.heilancoo.bingo.BingoSession; import net.heilancoo.portal.application.ApplicationException; - import net.heilancoo.portal.session.SessionException; import net.heilancoo.portal.testutils.PortalTest; --- 21,24 ---- *************** *** 46,50 **** @Test ! public void doLoginTest() throws FailingHttpStatusCodeException, MalformedURLException, IOException, SessionException, ApplicationException { // =========================================================== // Log into the web application. This is client side activity. --- 46,50 ---- @Test ! public void doLoginTest() throws FailingHttpStatusCodeException, MalformedURLException, IOException, ApplicationException { // =========================================================== // Log into the web application. This is client side activity. *************** *** 54,59 **** HtmlForm login = pg.getFormByName("input"); ! login.getInputByName("user").setValueAttribute("joerg"); ! login.getInputByName("password").setValueAttribute("joerg"); HtmlPage loggedIn = login.getInputByName("button").click(); --- 54,59 ---- HtmlForm login = pg.getFormByName("input"); ! login.getInputByName("user").setValueAttribute("jimmy"); ! login.getInputByName("password").setValueAttribute("jimmy"); HtmlPage loggedIn = login.getInputByName("button").click(); *************** *** 72,75 **** --- 72,84 ---- // And again inspect the server side: assertEquals(2, s.getAccessCounter()); + + // ================================= + // Back on the client side. Log out! + HtmlPage loggedOut = loggedIn.getAnchorByHref("logout").click(); + assertEquals("Logout", loggedOut.getTitleText()); + + // ================================= + // The session should now be gone... + assertNull(PortalTest.getSessionForPage(loggedIn)); } |
From: Joerg B. <jb...@us...> - 2009-07-28 16:41:05
|
Update of /cvsroot/lipog/net.heilancoo.portal.testutils/src/net/heilancoo/portal/testutils In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13889/src/net/heilancoo/portal/testutils Modified Files: PortalTest.java Log Message: tweaks to SessonException concept in test helper classes Index: PortalTest.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.testutils/src/net/heilancoo/portal/testutils/PortalTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PortalTest.java 26 Jul 2009 15:27:36 -0000 1.1 --- PortalTest.java 28 Jul 2009 16:40:53 -0000 1.2 *************** *** 30,39 **** } ! public static Application getApplicationForPage(HtmlPage page) throws ApplicationException { String name = PageUtils.getApplicationName(page); return PortalPlugin.getDefault().getApplication(name); } ! public static Session getSessionForPage(HtmlPage page) throws SessionException, ApplicationException { String name = PageUtils.getApplicationName(page); String key = PageUtils.getSessionKey(page); --- 30,39 ---- } ! public static Application getApplicationForPage(HtmlPage page) { String name = PageUtils.getApplicationName(page); return PortalPlugin.getDefault().getApplication(name); } ! public static Session getSessionForPage(HtmlPage page) throws ApplicationException { String name = PageUtils.getApplicationName(page); String key = PageUtils.getSessionKey(page); |
From: Joerg B. <jb...@us...> - 2009-07-28 16:41:01
|
Update of /cvsroot/lipog/net.heilancoo.portal/src/net/heilancoo/portal/application In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13849/src/net/heilancoo/portal/application Modified Files: ApplicationInfo.java Log Message: tweaks to SessonException concept in test helper classes Index: ApplicationInfo.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal/src/net/heilancoo/portal/application/ApplicationInfo.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ApplicationInfo.java 26 Jul 2009 15:27:33 -0000 1.2 --- ApplicationInfo.java 28 Jul 2009 16:40:50 -0000 1.3 *************** *** 65,78 **** * The returned session is bound to be changed by other threads and * access to it must be synchronised. ! * @return the session for the given key or null if the key is not in use. ! * @throws SessionException */ ! public Session getSessionFor(String key) throws SessionException { SessionCompound c = handler.getSessionFor(key); ! if(c == null) ! throw new SessionException("No session for key '" + key + "'."); ! ! return c.getSession(); } --- 65,74 ---- * The returned session is bound to be changed by other threads and * access to it must be synchronised. ! * @return the session for the given key or null if the key is not in use. */ ! public Session getSessionFor(String key) { SessionCompound c = handler.getSessionFor(key); ! return c == null ? null : c.getSession(); } |
From: Joerg B. <jb...@us...> - 2009-07-28 16:41:00
|
Update of /cvsroot/lipog/net.heilancoo.portal/src/net/heilancoo/portal In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv13849/src/net/heilancoo/portal Modified Files: PortalPlugin.java Log Message: tweaks to SessonException concept in test helper classes Index: PortalPlugin.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal/src/net/heilancoo/portal/PortalPlugin.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** PortalPlugin.java 26 Jul 2009 15:27:33 -0000 1.24 --- PortalPlugin.java 28 Jul 2009 16:40:50 -0000 1.25 *************** *** 355,368 **** } ! public Application getApplication(String name) throws ApplicationException { ApplicationRequestHandler h = webAppMap.get(name); ! if(h == null) ! throw new ApplicationException("No application with URI prefix '" + name + "'"); ! ! return h.getApplication(); } ! public Session getSession(String name, String key) throws SessionException, ApplicationException { ApplicationRequestHandler h = webAppMap.get(name); --- 355,365 ---- } ! public Application getApplication(String name) { ApplicationRequestHandler h = webAppMap.get(name); ! return h == null ? null : h.getApplication(); } ! public Session getSession(String name, String key) throws ApplicationException { ApplicationRequestHandler h = webAppMap.get(name); |
From: Joerg B. <jb...@us...> - 2009-07-26 16:51:28
|
Update of /cvsroot/lipog/net.heilancoo.portal.documentation/doc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15690/doc Modified Files: change-log.html getting-ready.html Log Message: bingo test tutorial Index: getting-ready.html =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.documentation/doc/getting-ready.html,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** getting-ready.html 25 Jul 2009 06:26:24 -0000 1.9 --- getting-ready.html 26 Jul 2009 16:51:20 -0000 1.10 *************** *** 99,102 **** --- 99,107 ---- </tr> <tr> + <td>net.heilancoo.portal.bingo.test</td> + <td>The bingo web app tests used as example in the tutorials. Not + needed for development.</td> + </tr> + <tr> <td>org.dojotoolkit</td> <td>The Dojo JavaScript library files packaged in an Eclipse Index: change-log.html =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.documentation/doc/change-log.html,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** change-log.html 26 Jul 2009 15:28:38 -0000 1.29 --- change-log.html 26 Jul 2009 16:51:20 -0000 1.30 *************** *** 11,14 **** --- 11,15 ---- <h2>Release 4 (upcoming)</h2> <ul> + <li>Web application test tutorial.</li> <li>Methods like PortalTest.getSessionForPage(HtmlPage) that allows finding session, application and controller objects in automated tests.</li> |
From: Joerg B. <jb...@us...> - 2009-07-26 16:49:13
|
Update of /cvsroot/lipog/net.heilancoo.bingo.test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15438 Added Files: .project .classpath build.properties Log Message: web application test tutorial example --- NEW FILE: .project --- <?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>net.heilancoo.bingo.test</name> <comment></comment> <projects> </projects> <buildSpec> <buildCommand> <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>org.eclipse.pde.ManifestBuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>org.eclipse.pde.SchemaBuilder</name> <arguments> </arguments> </buildCommand> </buildSpec> <natures> <nature>org.eclipse.pde.PluginNature</nature> <nature>org.eclipse.jdt.core.javanature</nature> </natures> </projectDescription> --- NEW FILE: build.properties --- source.. = src/ output.. = bin/ bin.includes = META-INF/,\ . --- NEW FILE: .classpath --- <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="bin"/> </classpath> |
From: Joerg B. <jb...@us...> - 2009-07-26 16:49:11
|
Update of /cvsroot/lipog/net.heilancoo.bingo.test/src/net/heilancoo/bingo/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15438/src/net/heilancoo/bingo/test Added Files: BingoApp.java Log Message: web application test tutorial example --- NEW FILE: BingoApp.java --- /* * Copyright (c) 2009 Heilan' Coo -- Joerg Bullmann * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which is available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Joerg Bullmann <jb...@he...> */ package net.heilancoo.bingo.test; import static org.junit.Assert.assertEquals; import java.io.IOException; import java.net.MalformedURLException; import net.heilancoo.bingo.BingoSession; import net.heilancoo.portal.application.ApplicationException; import net.heilancoo.portal.session.SessionException; import net.heilancoo.portal.testutils.PortalTest; import org.junit.BeforeClass; import org.junit.Test; import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.html.HtmlForm; import com.gargoylesoftware.htmlunit.html.HtmlPage; /** * @author joerg * */ public class BingoApp { /** * @throws java.lang.Exception */ @BeforeClass public static void setUpBeforeClass() throws Exception { PortalTest.startPortal(500); } @Test public void doLoginTest() throws FailingHttpStatusCodeException, MalformedURLException, IOException, SessionException, ApplicationException { // =========================================================== // Log into the web application. This is client side activity. WebClient cl = new WebClient(); HtmlPage pg = cl.getPage("http://127.0.0.1:8080/bingo"); assertEquals("Login", pg.getTitleText()); HtmlForm login = pg.getFormByName("input"); login.getInputByName("user").setValueAttribute("joerg"); login.getInputByName("password").setValueAttribute("joerg"); HtmlPage loggedIn = login.getInputByName("button").click(); // ========================================================== // Now peep directly into the server side of the application: BingoSession s = (BingoSession) PortalTest.getSessionForPage(loggedIn); assertEquals(1, s.getAccessCounter()); // ===================================================== // Back on the client side. Continue with some activity. loggedIn.getAnchorByHref("main").click(); // ================================== // And again inspect the server side: assertEquals(2, s.getAccessCounter()); } } |
From: Joerg B. <jb...@us...> - 2009-07-26 16:49:10
|
Update of /cvsroot/lipog/net.heilancoo.bingo.test/META-INF In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15438/META-INF Added Files: MANIFEST.MF Log Message: web application test tutorial example --- NEW FILE: MANIFEST.MF --- Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Bingo Test Fragment Bundle-SymbolicName: net.heilancoo.bingo.test Bundle-Version: 1.0.0.alpha Bundle-Vendor: Heilan' Coo Fragment-Host: net.heilancoo.bingo;bundle-version="1.0.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Require-Bundle: net.heilancoo.portal.testutils;bundle-version="1.0.0" |
From: Joerg B. <jb...@us...> - 2009-07-26 16:49:08
|
Update of /cvsroot/lipog/net.heilancoo.bingo.test/.settings In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15438/.settings Added Files: org.eclipse.jdt.core.prefs Log Message: web application test tutorial example --- NEW FILE: org.eclipse.jdt.core.prefs --- #Sun Jul 26 17:36:32 CEST 2009 eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.6 |
From: Joerg B. <jb...@us...> - 2009-07-26 16:49:01
|
Update of /cvsroot/lipog/net.heilancoo.bingo.test/.settings In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15355/.settings Log Message: Directory /cvsroot/lipog/net.heilancoo.bingo.test/.settings added to the repository |
From: Joerg B. <jb...@us...> - 2009-07-26 16:49:01
|
Update of /cvsroot/lipog/net.heilancoo.bingo.test/META-INF In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15355/META-INF Log Message: Directory /cvsroot/lipog/net.heilancoo.bingo.test/META-INF added to the repository |
From: Joerg B. <jb...@us...> - 2009-07-26 16:49:00
|
Update of /cvsroot/lipog/net.heilancoo.bingo.test/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15355/src Log Message: Directory /cvsroot/lipog/net.heilancoo.bingo.test/src added to the repository |
From: Joerg B. <jb...@us...> - 2009-07-26 16:49:00
|
Update of /cvsroot/lipog/net.heilancoo.bingo.test/src/net/heilancoo/bingo In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15355/src/net/heilancoo/bingo Log Message: Directory /cvsroot/lipog/net.heilancoo.bingo.test/src/net/heilancoo/bingo added to the repository |
From: Joerg B. <jb...@us...> - 2009-07-26 16:48:59
|
Update of /cvsroot/lipog/net.heilancoo.bingo.test/src/net/heilancoo/bingo/test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15355/src/net/heilancoo/bingo/test Log Message: Directory /cvsroot/lipog/net.heilancoo.bingo.test/src/net/heilancoo/bingo/test added to the repository |
From: Joerg B. <jb...@us...> - 2009-07-26 16:48:59
|
Update of /cvsroot/lipog/net.heilancoo.bingo.test/src/net In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15355/src/net Log Message: Directory /cvsroot/lipog/net.heilancoo.bingo.test/src/net added to the repository |
From: Joerg B. <jb...@us...> - 2009-07-26 16:48:37
|
Update of /cvsroot/lipog/net.heilancoo.bingo.test In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15320/net.heilancoo.bingo.test Log Message: Directory /cvsroot/lipog/net.heilancoo.bingo.test added to the repository |
From: Joerg B. <jb...@us...> - 2009-07-26 16:47:47
|
Update of /cvsroot/lipog/net.heilancoo.portal.documentation/doc/snaps In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15149/doc/snaps Added Files: new-test-fragment-1.png test-run-configuration-2.png test-run-configuration-1.png test-fragment-junit-test-case-1.png test-fragment-dependency-1.png new-test-fragment-2.png new-test-fragment-3.png Log Message: web application test tutorial --- NEW FILE: test-fragment-junit-test-case-1.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: test-fragment-dependency-1.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: new-test-fragment-3.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: test-run-configuration-1.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: new-test-fragment-2.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: new-test-fragment-1.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: test-run-configuration-2.png --- (This appears to be a binary file; contents omitted.) |
From: Joerg B. <jb...@us...> - 2009-07-26 16:47:47
|
Update of /cvsroot/lipog/net.heilancoo.portal.documentation/doc In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15149/doc Modified Files: index.html Added Files: apptest-123.html Log Message: web application test tutorial --- NEW FILE: apptest-123.html --- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Automated Web Application Testing with the Gizmo</title> </head> <body> <link rel="stylesheet" type="text/css" href="default.css" /> <p><a href="index.html">Home of Little Portal Gizmo</a></p> <h1>Automated Web Application Testing with the Gizmo</h1> <p>This short tutorial should see you through the basic steps necessary to to create automated tests for your web application. We use the bingo plug-in project that was created in the <a href="webapp-123.html">Creating a Web Application with the Gizmo</a> tutorial. So we assume your development workspace is set up and contains the Gizmo plug-ins and the bingo web application plug-in. <p> <h2>Create a Fragment Project for the Tests</h2> <p>Invoke the "File > New... > Project..." command. This will bring the following dialog to the screen.</p> <img src="snaps/new-test-fragment-1.png"> <p>Select "Fragment Project" from the "Plug-in Development" category. Then click "Next."</p> <img src="snaps/new-test-fragment-2.png"> <p>In the "Fragment Project" dialog fill in the project name (here "net.heilancoo.bingo.test") and click "Next."</p> <img src="snaps/new-test-fragment-3.png"> <p>In the "Fragment Content" dialog, fill in "net.heilancoo.bingo" as host plug-in id (and add a few other details as shown in the screen shot above. Then click "Finish" to create the project.</p> <h2>Add Dependency to the Test Fragment</h2> <p>Add plug-in "net.heilancoo.portal.testutils" as a dependency to the bingo test fragment.</p> <img src="snaps/test-fragment-dependency-1.png"> <h2>Add Test Code</h2> <p>Create Java package "net.heilancoo.bingo.test"</p> <p>Create a JUnit test class:</p> <img src="snaps/test-fragment-junit-test-case-1.png"> <p>Clicking "Finish" in the above dialog will create test case file content like this:</p> <pre> public class BingoApp { @BeforeClass public static void setUpBeforeClass() throws Exception { } } </pre> <p>Add a call to start the Gizmo web apps so that the file looks like this:</p> <pre> public class BingoApp { @BeforeClass public static void setUpBeforeClass() throws Exception { PortalTest.startPortal(500); } } </pre> <p>This will start the web application in the background and wait 500 ms before returning.</p> <p>Now add a test.</p> <pre> public class BingoApp { @BeforeClass public static void setUpBeforeClass() throws Exception { PortalTest.startPortal(500); } @Test public void doLoginTest() throws FailingHttpStatusCodeException, MalformedURLException, IOException, SessionException, ApplicationException { // =========================================================== // Log into the web application. This is client side activity. WebClient cl = new WebClient(); HtmlPage pg = cl.getPage("http://127.0.0.1:8080/bingo"); assertEquals("Login", pg.getTitleText()); HtmlForm login = pg.getFormByName("input"); login.getInputByName("user").setValueAttribute("joerg"); login.getInputByName("password").setValueAttribute("joerg"); HtmlPage loggedIn = login.getInputByName("button").click(); // ========================================================== // Now peep directly into the server side of the application: BingoSession s = (BingoSession) PortalTest.getSessionForPage(loggedIn); assertEquals(1, s.getAccessCounter()); // ===================================================== // Back on the client side. Continue with some activity. loggedIn.getAnchorByHref("main").click(); // ================================== // And again inspect the server side: assertEquals(2, s.getAccessCounter()); } } </pre> <h2>Create a Run Configuration to Execute the Test</h2> <p>Use the "Run > Run configurations..." command to bring up the run configurations management dialog.</p> <img src="snaps/test-run-configuration-1.png"> <p>Press the "New launch configuration" button in the launch configuration dialog and you should see a lauch configuration like the one in the screen shot below.</p> <img src="snaps/test-run-configuration-2.png"> <p>Press the "Run" button to run the test. The test should succeed.</p> <p class="revinfo"> <div id="rev">$Revision: 1.1 $</div> <div id="date">$Date: 2009/07/26 16:47:39 $</div> <div id="auth">$Author: jbu $</div> </p> <a href="http://sourceforge.net/projects/lipog"> <img src="http://sflogo.sourceforge.net/sflogo.php?group_id=257822&type=16" border="0" width="150" height="40" alt="Get Little Portal Gizmo at SourceForge.net. Fast, secure and Free Open Source software downloads" /></a> </body> </html> Index: index.html =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.portal.documentation/doc/index.html,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** index.html 25 Jul 2009 06:26:24 -0000 1.19 --- index.html 26 Jul 2009 16:47:39 -0000 1.20 *************** *** 32,36 **** <ul> <li>have as few lines of code and configuration as possible in applications </li> ! <li>automatic decoding of parameters in HTTP PUT and GET requests</li> <li>be able to serve static content</li> <li>straightforward integrated session handling</li> --- 32,36 ---- <ul> <li>have as few lines of code and configuration as possible in applications </li> ! <li>automatic decoding of parameters in HTTP POST and GET requests</li> <li>be able to serve static content</li> <li>straightforward integrated session handling</li> *************** *** 119,122 **** --- 119,123 ---- <ul> <li><a href="webapp-123.html">Web Application</a></li> + <li><a href="apptest-123.html">Web Application Testing</a></li> <li><a href="product-123.html">Deployment</a></li> <li><a href="webfolder-123.html">Web Folder</a></li> |
From: Joerg B. <jb...@us...> - 2009-07-26 16:45:04
|
Update of /cvsroot/lipog/net.heilancoo.bingo/src/net/heilancoo/bingo In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14877/src/net/heilancoo/bingo Modified Files: BingoSession.java Log Message: added access counter accessor Index: BingoSession.java =================================================================== RCS file: /cvsroot/lipog/net.heilancoo.bingo/src/net/heilancoo/bingo/BingoSession.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** BingoSession.java 29 May 2009 18:26:52 -0000 1.11 --- BingoSession.java 26 Jul 2009 16:44:55 -0000 1.12 *************** *** 44,47 **** --- 44,51 ---- } + public long getAccessCounter() { + return accessCounter; + } + @Request public void main(HttpRequest request, FormFieldContainer fields, |