JBoss Rich Faces SVN: r11260 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/WEB-INF and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-11-20 06:10:18 -0500 (Thu, 20 Nov 2008)
New Revision: 11260
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/EffectBean.java
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/effect/effectTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ContextMenuTest.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/EffectTest.java
Log:
RF-4967
Added: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/EffectBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/EffectBean.java (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/EffectBean.java 2008-11-20 11:10:18 UTC (rev 11260)
@@ -0,0 +1,39 @@
+/**
+ *
+ */
+package org.ajax4jsf.bean;
+
+/**
+ * @author Andrey Markavtsov
+ *
+ */
+public class EffectBean {
+
+ Boolean rendered = true;
+
+ public String testRendered() {
+ rendered = false;
+ return null;
+ }
+
+ public void reset() {
+ rendered = true;
+ }
+
+ /**
+ * @return the rendered
+ */
+ public Boolean getRendered() {
+ return rendered;
+ }
+
+ /**
+ * @param rendered the rendered to set
+ */
+ public void setRendered(Boolean rendered) {
+ this.rendered = rendered;
+ }
+
+
+
+}
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2008-11-20 10:44:45 UTC (rev 11259)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2008-11-20 11:10:18 UTC (rev 11260)
@@ -265,6 +265,11 @@
<managed-bean-name>treeBean</managed-bean-name>
<managed-bean-class>org.ajax4jsf.bean.tree.TreeTestBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
+ <managed-bean-name>effectBean</managed-bean-name>
+ <managed-bean-class>org.ajax4jsf.bean.EffectBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/pages/ajaxInclude/step1.xhtml</from-view-id>
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/effect/effectTest.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/effect/effectTest.xhtml 2008-11-20 10:44:45 UTC (rev 11259)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/effect/effectTest.xhtml 2008-11-20 11:10:18 UTC (rev 11260)
@@ -9,6 +9,10 @@
<ui:composition template="#{templateBean.template}">
<ui:define name="component">
+ <h:form id="_controls">
+ <h:commandButton action="#{effectBean.testRendered}" value="testRendered" id="testRendered"></h:commandButton>
+ </h:form>
+
<input type="button" id="button1" value="Button1"/>
<h:commandButton id="button2" value="Button2"></h:commandButton>
<h:commandButton id="button3" value="Button3">
@@ -20,16 +24,21 @@
<a href="#" id="hideLink1">Hide Button</a><br/>
<a href="#" id="showLink2">Show Command Button</a><br/>
- <a href="#" id="hideLink2">Hide Command Button</a>
+ <a href="#" id="hideLink2">Hide Command Button</a><br/>
+ <a href="#" id="testLink" onclick="myEffect({duration:1, from:1.0, to:0.1})">Test named effect</a>
<rich:effect for="hideLink1" event="onclick" type="Fade"
params="targetId: 'button1', duration: 2.0, from: 1.0, to: 0.0"></rich:effect>
- <rich:effect for="hideLink2" event="onclick" type="Fade"
+ <rich:effect rendered="#{effectBean.rendered}" for="hideLink2" event="onclick" type="Fade"
params="targetId: getParentId() + 'button2', duration: 0, from: 1.0, to: 0.0"></rich:effect>
<rich:effect for="showLink2" event="onclick" type="Appear"
params="targetId: getParentId() + 'button2', duration: 0"></rich:effect>
+
+ <rich:effect name="myEffect" type="Opacity"
+ targetId="testLink">
+ </rich:effect>
</ui:define>
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ContextMenuTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ContextMenuTest.java 2008-11-20 10:44:45 UTC (rev 11259)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ContextMenuTest.java 2008-11-20 11:10:18 UTC (rev 11260)
@@ -106,7 +106,7 @@
}
- //@Test
+ @Test
public void testExternalValidation(Template template) {
AutoTester autoTester = getAutoTester(this);
autoTester.renderPage(template, RESET_METHOD);
@@ -114,7 +114,7 @@
autoTester.testExtrenalValidationFailure();
}
- //@Test
+ @Test
public void testImmediate(Template template) {
AutoTester autoTester = getAutoTester(this);
autoTester.renderPage(template, RESET_METHOD);
@@ -122,7 +122,7 @@
autoTester.testImmediate();
}
- //@Test
+ @Test
public void testImmediateWithExternalValidation(Template template) {
AutoTester autoTester = getAutoTester(this);
autoTester.renderPage(template, RESET_METHOD);
@@ -130,7 +130,7 @@
autoTester.testImmediateWithExternalValidationFailed();
}
- //Test
+ @Test
public void testLimitToList(Template template) {
AutoTester autoTester = getAutoTester(this);
autoTester.renderPage(template, RESET_METHOD);
@@ -138,7 +138,7 @@
autoTester.testLimitToList();
}
- //@Test
+ @Test
public void testByPassUpdate(Template template) {
AutoTester autoTester = getAutoTester(this);
autoTester.renderPage(template, RESET_METHOD);
@@ -146,7 +146,7 @@
autoTester.testBypassUpdate();
}
- //@Test
+ @Test
public void testReRender(Template template) {
AutoTester autoTester = getAutoTester(this);
autoTester.renderPage(template, RESET_METHOD);
@@ -154,7 +154,7 @@
autoTester.testReRender();
}
- //@Test
+ @Test
public void testNestedParams(Template template) {
AutoTester autoTester = getAutoTester(this);
autoTester.renderPage(template, RESET_METHOD);
@@ -162,7 +162,7 @@
autoTester.testRequestParameters(PARAMS);
}
- //@Test
+ @Test
public void testDisableDefault(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId(), "contextMenu2");
@@ -179,7 +179,7 @@
}
- //@Test
+ @Test
public void testRendered(Template template) {
AutoTester autoTester = getAutoTester(this);
autoTester.renderPage(template, RESET_METHOD);
@@ -187,7 +187,7 @@
autoTester.testRendered();
}
- //@Test
+ @Test
public void testActionListener(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId(), UNATTACHED_CONTEXTMENU);
@@ -216,7 +216,7 @@
}
- //@Test
+ @Test
public void testAttachedAndAttachedTo(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId(), UNATTACHED_CONTEXTMENU);
@@ -239,7 +239,7 @@
AssertPresent(contextMenuBody, "Context menu has not been shown");
}
- //@Test
+ @Test
public void testSubmitMode(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId(), UNATTACHED_CONTEXTMENU);
@@ -270,7 +270,7 @@
}
- //@Test
+ @Test
public void testContextMenuRendering(Template template) {
renderPage(template, RESET_METHOD);
@@ -365,7 +365,7 @@
}
- //@Test
+ @Test
public void testContextMenuStandAlone(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId(), UNATTACHED_CONTEXTMENU);
@@ -387,7 +387,7 @@
AssertNotVisible(contextMenuBody, "Context menu has not been hidden");
}
- //@Test
+ @Test
public void testComponentControlManagement(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId(), UNATTACHED_CONTEXTMENU);
@@ -409,7 +409,7 @@
AssertNotVisible(contextMenuBody, "Context menu has not been hidden");
}
- //@Test
+ @Test
public void testMacrodefinitions(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId(), UNATTACHED_CONTEXTMENU);
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/EffectTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/EffectTest.java 2008-11-20 10:44:45 UTC (rev 11259)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/EffectTest.java 2008-11-20 11:10:18 UTC (rev 11260)
@@ -13,10 +13,41 @@
*/
public class EffectTest extends SeleniumTestBase {
+ static final String RESET_METHOD = "#{effectBean.reset}";
@Test
+ public void testRendered(Template template) {
+ renderPage(template, RESET_METHOD);
+ String parentId = getParentId();
+
+ String controlId = parentId + "_controls:testRendered";
+ clickCommandAndWait(controlId);
+
+ String button2Id = parentId + "button2";
+ String hideLink2 = "hideLink2";
+
+ AssertVisible(button2Id);
+ clickById(hideLink2);
+ AssertVisible(button2Id, "Button should not be hidden in case on effect rendered = false");
+ }
+
+ @Test
+ public void testNamedEffect(Template template) {
+ renderPage(template, RESET_METHOD);
+
+ String testLink = "testLink";
+ AssertVisible(testLink);
+
+ clickById(testLink);
+ pause(200, testLink);
+ assertStyleAttribute(testLink, "opacity", "Named effect does not work");
+ pause(1500, testLink);
+ assertStyleAttribute(testLink, "opacity: 0.1", "Opacity effect has not been completed");
+ }
+
+ @Test
public void testComponentHideShow(Template template) {
- renderPage(template);
+ renderPage(template, RESET_METHOD);
String parentId = getParentId();
String button2Id = parentId + "button2";
@@ -43,7 +74,7 @@
@Test
public void testFadeEffect(Template template) {
- renderPage(template);
+ renderPage(template, RESET_METHOD);
String parentId = getParentId();
String button1Id = "button1";
17 years, 5 months
JBoss Rich Faces SVN: r11259 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces/testng and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-11-20 05:44:45 -0500 (Thu, 20 Nov 2008)
New Revision: 11259
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/effect/effectTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/EffectTest.java
Log:
RF-4965
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/effect/effectTest.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/effect/effectTest.xhtml 2008-11-20 10:18:47 UTC (rev 11258)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/effect/effectTest.xhtml 2008-11-20 10:44:45 UTC (rev 11259)
@@ -9,19 +9,27 @@
<ui:composition template="#{templateBean.template}">
<ui:define name="component">
- <input type="button" id="button1" />
- <h:commandButton id="button2"></h:commandButton>
+ <input type="button" id="button1" value="Button1"/>
+ <h:commandButton id="button2" value="Button2"></h:commandButton>
+ <h:commandButton id="button3" value="Button3">
+ <rich:effect event="onclick" type="Fade" params="duration: 0"></rich:effect>
+ <rich:effect event="onclick" for="button3" type="Appear" params="delay: 1"></rich:effect>
+ </h:commandButton>
<br/>
<a href="#" id="hideLink1">Hide Button</a><br/>
+ <a href="#" id="showLink2">Show Command Button</a><br/>
<a href="#" id="hideLink2">Hide Command Button</a>
<rich:effect for="hideLink1" event="onclick" type="Fade"
params="targetId: 'button1', duration: 2.0, from: 1.0, to: 0.0"></rich:effect>
<rich:effect for="hideLink2" event="onclick" type="Fade"
- params="targetId: 'button2', duration: 0, from: 1.0, to: 0.0"></rich:effect>
+ params="targetId: getParentId() + 'button2', duration: 0, from: 1.0, to: 0.0"></rich:effect>
+
+ <rich:effect for="showLink2" event="onclick" type="Appear"
+ params="targetId: getParentId() + 'button2', duration: 0"></rich:effect>
</ui:define>
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/EffectTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/EffectTest.java 2008-11-20 10:18:47 UTC (rev 11258)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/EffectTest.java 2008-11-20 10:44:45 UTC (rev 11259)
@@ -15,6 +15,33 @@
@Test
+ public void testComponentHideShow(Template template) {
+ renderPage(template);
+ String parentId = getParentId();
+
+ String button2Id = parentId + "button2";
+ String button3Id = parentId + "button3";
+
+ String hideLink2 = "hideLink2";
+ String showLink2 = "showLink2";
+
+ AssertVisible(button2Id);
+ clickById(hideLink2);
+ AssertNotVisible(button2Id, "Command Button has not been hidden by Fade effect");
+ clickById(showLink2);
+ AssertVisible(button2Id, "Command Button has not been appeared by Fade effect");
+
+ AssertVisible(button3Id);
+ clickById(button3Id);
+ AssertNotVisible(button3Id, "Command Button has not been hidden by Fade effect attached to parent");
+
+ pause(1500, button3Id);
+ AssertVisible(button3Id, "Command Button has not been appeared after 1 second duration by Fade effect attached to parent");
+
+ }
+
+
+ @Test
public void testFadeEffect(Template template) {
renderPage(template);
String parentId = getParentId();
@@ -35,10 +62,10 @@
pause(2000, hideLink1);
- AssertNotVisible(button1Id, "Input button has not been hidden by Fade effect");
+ AssertNotVisible(button1Id, "Input button has not been hidden by Fade effect or targetId has not been resolved");
clickById(hideLink2);
- AssertNotVisible(button1Id, "Command Button has not been hidden by Fade effect");
+ AssertNotVisible(button2Id, "Command Button has not been hidden by Fade effect or targetId has not been resolved");
}
17 years, 5 months
JBoss Rich Faces SVN: r11258 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/pages and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-11-20 05:18:47 -0500 (Thu, 20 Nov 2008)
New Revision: 11258
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/effect/
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/effect/effectTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/EffectTest.java
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/IndexBean.java
Log:
RF-4964
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/IndexBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/IndexBean.java 2008-11-20 09:55:14 UTC (rev 11257)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/IndexBean.java 2008-11-20 10:18:47 UTC (rev 11258)
@@ -99,6 +99,7 @@
list.add(new ComponentItem("<rich:datascroller>", "dataScroller/dataScroller.xhtml"));
list.add(new ComponentItem("<rich:dragSupport>", "dnd/dndTest.xhtml"));
list.add(new ComponentItem("<rich:dropSupport>", "dnd/dndTest.xhtml"));
+ list.add(new ComponentItem("<rich:effect>", "effect/effectTest.xhtml"));
sortList();
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/effect/effectTest.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/effect/effectTest.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/effect/effectTest.xhtml 2008-11-20 10:18:47 UTC (rev 11258)
@@ -0,0 +1,30 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition template="#{templateBean.template}">
+ <ui:define name="component">
+
+ <input type="button" id="button1" />
+ <h:commandButton id="button2"></h:commandButton>
+
+ <br/>
+
+ <a href="#" id="hideLink1">Hide Button</a><br/>
+ <a href="#" id="hideLink2">Hide Command Button</a>
+
+ <rich:effect for="hideLink1" event="onclick" type="Fade"
+ params="targetId: 'button1', duration: 2.0, from: 1.0, to: 0.0"></rich:effect>
+
+ <rich:effect for="hideLink2" event="onclick" type="Fade"
+ params="targetId: 'button2', duration: 0, from: 1.0, to: 0.0"></rich:effect>
+
+
+ </ui:define>
+
+</ui:composition>
+</html>
\ No newline at end of file
Added: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/EffectTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/EffectTest.java (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/EffectTest.java 2008-11-20 10:18:47 UTC (rev 11258)
@@ -0,0 +1,53 @@
+/**
+ *
+ */
+package org.richfaces.testng;
+
+import org.ajax4jsf.template.Template;
+import org.richfaces.SeleniumTestBase;
+import org.testng.annotations.Test;
+
+/**
+ * @author Andrey
+ *
+ */
+public class EffectTest extends SeleniumTestBase {
+
+
+ @Test
+ public void testFadeEffect(Template template) {
+ renderPage(template);
+ String parentId = getParentId();
+
+ String button1Id = "button1";
+ String button2Id = parentId + "button2";
+
+ String hideLink1 = "hideLink1";
+ String hideLink2 = "hideLink2";
+
+ AssertVisible(button1Id);
+ AssertVisible(button2Id);
+
+ clickById(hideLink1);
+ pause(500, hideLink1);
+ AssertVisible(button1Id, "Duration param of Fade effect does not work ");
+ assertStyleAttribute(button1Id, "opacity", "Element has no opacity style");
+
+ pause(2000, hideLink1);
+
+ AssertNotVisible(button1Id, "Input button has not been hidden by Fade effect");
+
+ clickById(hideLink2);
+ AssertNotVisible(button1Id, "Command Button has not been hidden by Fade effect");
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.SeleniumTestBase#getTestUrl()
+ */
+ @Override
+ public String getTestUrl() {
+ return "pages/effect/effectTest.xhtml";
+ }
+
+}
17 years, 5 months
JBoss Rich Faces SVN: r11257 - trunk/ui/extendedDataTable/src/main/templates/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: pgolawski
Date: 2008-11-20 04:55:14 -0500 (Thu, 20 Nov 2008)
New Revision: 11257
Modified:
trunk/ui/extendedDataTable/src/main/templates/org/richfaces/htmlExtendedDataTable.jspx
Log:
removed scripts for context menu (included by context-menu component)
set relative paths for xcss files
Modified: trunk/ui/extendedDataTable/src/main/templates/org/richfaces/htmlExtendedDataTable.jspx
===================================================================
--- trunk/ui/extendedDataTable/src/main/templates/org/richfaces/htmlExtendedDataTable.jspx 2008-11-20 09:35:40 UTC (rev 11256)
+++ trunk/ui/extendedDataTable/src/main/templates/org/richfaces/htmlExtendedDataTable.jspx 2008-11-20 09:55:14 UTC (rev 11257)
@@ -14,8 +14,8 @@
>
<h:styles>
css/extendedDataTable.xcss,
- /org/richfaces/renderkit/html/css/dragIndicator.xcss,
- /org/richfaces/renderkit/html/css/menucomponents.xcss,
+ css/dragIndicator.xcss,
+ css/menucomponents.xcss
</h:styles>
<h:scripts>
new org.ajax4jsf.javascript.AjaxScript(),
@@ -30,8 +30,6 @@
/org/richfaces/renderkit/html/scripts/dnd/dnd-dropzone.js,
/org/richfaces/renderkit/html/scripts/browser_info.js,
- /org/richfaces/renderkit/html/scripts/menu.js,
- /org/richfaces/renderkit/html/scripts/context-menu.js,
/org/ajax4jsf/javascript/scripts/form.js,
/org/richfaces/renderkit/html/scripts/form.js,
17 years, 5 months
JBoss Rich Faces SVN: r11256 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces/testng and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-11-20 04:35:40 -0500 (Thu, 20 Nov 2008)
New Revision: 11256
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/contextMenu/contextMenu.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ContextMenuTest.java
Log:
Context Manu tests
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/contextMenu/contextMenu.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ContextMenuTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ContextMenuTest.java 2008-11-20 09:30:23 UTC (rev 11255)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ContextMenuTest.java 2008-11-20 09:35:40 UTC (rev 11256)
@@ -82,6 +82,55 @@
}
@Test
+ public void testOncomplete(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, RESET_METHOD);
+
+ autoTester.testOncomplete();
+ }
+
+ @Test
+ public void testAjaxSingleWithExternalValidation(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, RESET_METHOD);
+
+ autoTester.testAjaxSingleWithInternalValidationFailed();
+ }
+
+ @Test
+ public void testAjaxSingle(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, RESET_METHOD);
+
+ autoTester.testAjaxSingle();
+ }
+
+
+ //@Test
+ public void testExternalValidation(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, RESET_METHOD);
+
+ autoTester.testExtrenalValidationFailure();
+ }
+
+ //@Test
+ public void testImmediate(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, RESET_METHOD);
+
+ autoTester.testImmediate();
+ }
+
+ //@Test
+ public void testImmediateWithExternalValidation(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, RESET_METHOD);
+
+ autoTester.testImmediateWithExternalValidationFailed();
+ }
+
+ //Test
public void testLimitToList(Template template) {
AutoTester autoTester = getAutoTester(this);
autoTester.renderPage(template, RESET_METHOD);
@@ -89,7 +138,7 @@
autoTester.testLimitToList();
}
- @Test
+ //@Test
public void testByPassUpdate(Template template) {
AutoTester autoTester = getAutoTester(this);
autoTester.renderPage(template, RESET_METHOD);
@@ -97,7 +146,7 @@
autoTester.testBypassUpdate();
}
- @Test
+ //@Test
public void testReRender(Template template) {
AutoTester autoTester = getAutoTester(this);
autoTester.renderPage(template, RESET_METHOD);
@@ -105,7 +154,7 @@
autoTester.testReRender();
}
- @Test
+ //@Test
public void testNestedParams(Template template) {
AutoTester autoTester = getAutoTester(this);
autoTester.renderPage(template, RESET_METHOD);
@@ -113,7 +162,7 @@
autoTester.testRequestParameters(PARAMS);
}
- @Test
+ //@Test
public void testDisableDefault(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId(), "contextMenu2");
@@ -130,7 +179,7 @@
}
- @Test
+ //@Test
public void testRendered(Template template) {
AutoTester autoTester = getAutoTester(this);
autoTester.renderPage(template, RESET_METHOD);
@@ -138,7 +187,7 @@
autoTester.testRendered();
}
- @Test
+ //@Test
public void testActionListener(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId(), UNATTACHED_CONTEXTMENU);
@@ -167,7 +216,7 @@
}
- @Test
+ //@Test
public void testAttachedAndAttachedTo(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId(), UNATTACHED_CONTEXTMENU);
@@ -190,7 +239,7 @@
AssertPresent(contextMenuBody, "Context menu has not been shown");
}
- @Test
+ //@Test
public void testSubmitMode(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId(), UNATTACHED_CONTEXTMENU);
@@ -221,7 +270,7 @@
}
- @Test
+ //@Test
public void testContextMenuRendering(Template template) {
renderPage(template, RESET_METHOD);
@@ -316,7 +365,7 @@
}
- @Test
+ //@Test
public void testContextMenuStandAlone(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId(), UNATTACHED_CONTEXTMENU);
@@ -338,7 +387,7 @@
AssertNotVisible(contextMenuBody, "Context menu has not been hidden");
}
- @Test
+ //@Test
public void testComponentControlManagement(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId(), UNATTACHED_CONTEXTMENU);
@@ -360,7 +409,7 @@
AssertNotVisible(contextMenuBody, "Context menu has not been hidden");
}
- @Test
+ //@Test
public void testMacrodefinitions(Template template) {
renderPage(template, RESET_METHOD);
initIds(getParentId(), UNATTACHED_CONTEXTMENU);
17 years, 5 months
JBoss Rich Faces SVN: r11255 - in trunk/sandbox: ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/themes/advanced/skins/richfaces and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2008-11-20 04:30:23 -0500 (Thu, 20 Nov 2008)
New Revision: 11255
Modified:
trunk/sandbox/samples/editor-sample/src/main/webapp/pages/editor.jsp
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/themes/advanced/skins/richfaces/dialog.xcss
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/themes/advanced/skins/richfaces/ui.xcss
trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/themes/simple/skins/richfaces/ui.xcss
Log:
xcss changes
Modified: trunk/sandbox/samples/editor-sample/src/main/webapp/pages/editor.jsp
===================================================================
--- trunk/sandbox/samples/editor-sample/src/main/webapp/pages/editor.jsp 2008-11-19 23:08:09 UTC (rev 11254)
+++ trunk/sandbox/samples/editor-sample/src/main/webapp/pages/editor.jsp 2008-11-20 09:30:23 UTC (rev 11255)
@@ -56,9 +56,9 @@
</h:selectOneRadio>
<h:outputText value="Select language:" />
<h:selectOneRadio onchange="submit()" value="#{editorBean.language}">
- <f:selectItem itemLabel="default" itemValue="default"/>
- <f:selectItem itemLabel="o2k7" itemValue="o2k7"/>
- <f:selectItem itemLabel="richfaces" itemValue="richfaces"/>
+ <f:selectItem itemLabel="english" itemValue="en"/>
+ <f:selectItem itemLabel="russian" itemValue="ru"/>
+ <f:selectItem itemLabel="french" itemValue="fr"/>
</h:selectOneRadio>
<h:outputText value="Is readonly:" />
<h:selectBooleanCheckbox value="#{editorBean.readonly}" onclick="submit()">
Modified: trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/themes/advanced/skins/richfaces/dialog.xcss
===================================================================
--- trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/themes/advanced/skins/richfaces/dialog.xcss 2008-11-19 23:08:09 UTC (rev 11254)
+++ trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/themes/advanced/skins/richfaces/dialog.xcss 2008-11-20 09:30:23 UTC (rev 11255)
@@ -248,7 +248,7 @@
<u:style name="color" skin="generalTextColor"/>
<u:style name="border-width" value="1px"/>
<u:style name="border-style" value="solid"/>
- <u:style name="border-color" value="#00ff00"/>
+ <u:style name="border-color" skin="tableBorderColor"/>
</u:selector>
<u:selector name="#charmap a">
@@ -257,7 +257,7 @@
</u:selector>
<u:selector name="#charmap a:hover">
- <u:style name="background" skin="tableBorderColor"/>
+ <u:style name="background" skin="tableBackgroundColor"/>
<u:style name="color" skin="hoverLinkColor"/>
</u:selector>
@@ -352,7 +352,7 @@
<u:selector name="#colorpicker #colors">
<u:style name="border-width" value="1px"/>
<u:style name="border-style" value="solid"/>
- <u:style name="border-color" value="red"/>
+ <u:style name="border-color" skin="panelBorderColor"/>
</u:selector>
<u:selector name="#colorpicker #light">
Modified: trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/themes/advanced/skins/richfaces/ui.xcss
===================================================================
--- trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/themes/advanced/skins/richfaces/ui.xcss 2008-11-19 23:08:09 UTC (rev 11254)
+++ trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/themes/advanced/skins/richfaces/ui.xcss 2008-11-20 09:30:23 UTC (rev 11255)
@@ -362,7 +362,7 @@
</u:selector>
<u:selector name=".richfacesSkin td.mceMenuItemSeparator">
- <u:style name="background" value="#FF0000"/>
+ <u:style name="background" skin="panelBorderColor"/>
<u:style name="height" value="1px"/>
</u:selector>
@@ -422,7 +422,7 @@
</u:selector>
<u:selector name=".richfacesSkin a.mceButtonEnabled:hover">
- <u:style name="background-color" value="#ff0000"/>
+ <u:style name="background-color" skin="headerBackgroundColor"/>
</u:selector>
<f:verbatim><![CDATA[
Modified: trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/themes/simple/skins/richfaces/ui.xcss
===================================================================
--- trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/themes/simple/skins/richfaces/ui.xcss 2008-11-19 23:08:09 UTC (rev 11254)
+++ trunk/sandbox/ui/editor/src/main/resources/org/richfaces/renderkit/html/scripts/tiny_mce/themes/simple/skins/richfaces/ui.xcss 2008-11-20 09:30:23 UTC (rev 11255)
@@ -101,7 +101,7 @@
</f:verbatim>
<u:selector name=".richfacesSimpleSkin a.mceButtonEnabled:hover">
- <u:style name="background-color" value="#B2BBD0"/>
+ <u:style name="background-color" skin="headerBackgroundColor"/>
<u:style name="background-position" value="0 -22px"/>
</u:selector>
17 years, 5 months
JBoss Rich Faces SVN: r11254 - in trunk: docs/xslt and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2008-11-19 18:08:09 -0500 (Wed, 19 Nov 2008)
New Revision: 11254
Added:
trunk/docs/xslt/
trunk/docs/xslt/en/
trunk/framework/jsf-test/src/main/javadoc/overview.html
Modified:
trunk/framework/jsf-test/src/main/java/org/richfaces/test/LocalWebResponse.java
trunk/framework/jsf-test/src/main/java/org/richfaces/test/TestException.java
trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/EventInvoker.java
trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/InvocationErrorEvent.java
trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/InvocationEvent.java
trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingConnection.java
trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingServer.java
trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/StaticServlet.java
trunk/framework/jsf-test/src/test/java/org/richfaces/test/FacesServerTest.java
Log:
Edit Javadoc comments in the public classes
Modified: trunk/framework/jsf-test/src/main/java/org/richfaces/test/LocalWebResponse.java
===================================================================
--- trunk/framework/jsf-test/src/main/java/org/richfaces/test/LocalWebResponse.java 2008-11-19 19:11:32 UTC (rev 11253)
+++ trunk/framework/jsf-test/src/main/java/org/richfaces/test/LocalWebResponse.java 2008-11-19 23:08:09 UTC (rev 11254)
@@ -50,11 +50,11 @@
* @see com.gargoylesoftware.htmlunit.WebResponse#getContentCharSet()
*/
public String getContentCharSet() {
- return serverConnection.getCharacterEncoding();
+ return serverConnection.getResponseCharacterEncoding();
}
public String getContentType() {
- return serverConnection.getContentType();
+ return serverConnection.getResponseContentType();
}
/* (non-Javadoc)
@@ -68,7 +68,7 @@
* @see com.gargoylesoftware.htmlunit.WebResponse#getRequestMethod()
*/
public com.gargoylesoftware.htmlunit.HttpMethod getRequestMethod() {
- return com.gargoylesoftware.htmlunit.HttpMethod.valueOf(serverConnection.getMethod().toString());
+ return com.gargoylesoftware.htmlunit.HttpMethod.valueOf(serverConnection.getRequestMethod().toString());
}
/* (non-Javadoc)
@@ -97,7 +97,7 @@
* @see com.gargoylesoftware.htmlunit.WebResponse#getStatusCode()
*/
public int getStatusCode() {
- return serverConnection.getStatus();
+ return serverConnection.getResponseStatus();
}
/* (non-Javadoc)
Modified: trunk/framework/jsf-test/src/main/java/org/richfaces/test/TestException.java
===================================================================
--- trunk/framework/jsf-test/src/main/java/org/richfaces/test/TestException.java 2008-11-19 19:11:32 UTC (rev 11253)
+++ trunk/framework/jsf-test/src/main/java/org/richfaces/test/TestException.java 2008-11-19 23:08:09 UTC (rev 11254)
@@ -14,7 +14,7 @@
public class TestException extends RuntimeException {
/**
- *
+ * Default constructor.
*/
public TestException() {
super();
Modified: trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/EventInvoker.java
===================================================================
--- trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/EventInvoker.java 2008-11-19 19:11:32 UTC (rev 11253)
+++ trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/EventInvoker.java 2008-11-19 23:08:09 UTC (rev 11254)
@@ -5,6 +5,13 @@
import java.util.EventListener;
+/**
+ * Internal interface, used to invoke listeners of different types.
+
+ * @author asmirnov
+ *
+ * @param <T> listener type.
+ */
interface EventInvoker<T extends EventListener> {
public void invoke(T listener);
}
\ No newline at end of file
Modified: trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/InvocationErrorEvent.java
===================================================================
--- trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/InvocationErrorEvent.java 2008-11-19 19:11:32 UTC (rev 11253)
+++ trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/InvocationErrorEvent.java 2008-11-19 23:08:09 UTC (rev 11254)
@@ -3,6 +3,18 @@
import java.lang.reflect.Method;
import java.util.EventObject;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+/**
+ * This event sent from the virtual server introspection method to the registered
+ * {@link InvocationListener} instance after any exception thrown from calls to {@link HttpServletRequest} , {@link HttpServletResponse}, {@link HttpSession} and {@link ServletContext} objects.
+
+ * @author asmirnov
+ *
+ */
+@SuppressWarnings("serial")
public class InvocationErrorEvent extends EventObject {
private Object target;
private Method method;
@@ -30,6 +42,9 @@
return args;
}
+ /**
+ * @return thrown exception.
+ */
public Throwable getE() {
return e;
}
Modified: trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/InvocationEvent.java
===================================================================
--- trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/InvocationEvent.java 2008-11-19 19:11:32 UTC (rev 11253)
+++ trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/InvocationEvent.java 2008-11-19 23:08:09 UTC (rev 11254)
@@ -3,6 +3,17 @@
import java.lang.reflect.Method;
import java.util.EventObject;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+/**
+ * This event sent from the staging server introspection method to the registered
+ * {@link InvocationListener} instance after all calls to {@link HttpServletRequest} , {@link HttpServletResponse}, {@link HttpSession} and {@link ServletContext} objects.
+ * @author asmirnov
+ *
+ */
+@SuppressWarnings("serial")
public class InvocationEvent extends EventObject {
private Object target;
private Method method;
@@ -18,18 +29,30 @@
this.result = result;
}
+ /**
+ * @return target object instance.
+ */
public Object getTarget() {
return target;
}
+ /**
+ * @return {@link Method} that was called.
+ */
public Method getMethod() {
return method;
}
+ /**
+ * @return method arguments.
+ */
public Object[] getArgs() {
return args;
}
+ /**
+ * @return value returned from the invoked method.
+ */
public Object getResult() {
return result;
}
Modified: trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingConnection.java
===================================================================
--- trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingConnection.java 2008-11-19 19:11:32 UTC (rev 11253)
+++ trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingConnection.java 2008-11-19 23:08:09 UTC (rev 11254)
@@ -29,8 +29,9 @@
import org.richfaces.test.TestException;
/**
- * This class represent single connection to the server.
- *
+ * This class represent single connection ( request ) to the virtual server. These instance should not be created directly, but by the {@link StagingServer#getConnection(URL)}.
+ * method only.
+ * Since instance have been created, additional request parameters and headers can be set.
* @author asmirnov
*
*/
@@ -70,9 +71,15 @@
private HttpServletResponse responseProxy;
- public StagingConnection(StagingServer localServer, URL url) {
+ /**
+ * Create connection instance.
+ * @param localServer virtual server instance.
+ * @param url request URL.
+ */
+ StagingConnection(StagingServer localServer, URL url) {
this.server = localServer;
this.url = url;
+ // TODO - context path support.
String path = url.getPath();
servlet = localServer.getServlet(path);
if (null == servlet) {
@@ -100,6 +107,11 @@
responseProxy = (HttpServletResponse) Proxy.newProxyInstance(loader, new Class[]{HttpServletResponse.class}, server.getInvocationHandler(response));
}
+ /**
+ * Parse 'application/x-www-form-urlencoded' string with parameters name/value pairs,
+ * as it expected after a form submit.
+ * @param queryString URL query string or POST content.
+ */
public void parseFormParameters(String queryString) {
String[] queryParams = queryString.split("&");
for (int i = 0; i < queryParams.length; i++) {
@@ -140,19 +152,24 @@
private void checkStarted() {
if (!isFinished()) {
- throw new IllegalStateException("request have not been started");
+ throw new TestException("request have not been started");
}
}
private void checkNotStarted() {
if (isStarted()) {
- throw new IllegalStateException("request was started, no parameters changes allowed");
+ throw new TestException("request was started, no parameters changes allowed");
}
}
+ /**
+ * Execute this connection request on the associated servlet or filter chain.
+ * @throws ServletException
+ * @throws IOException
+ */
public void execute() throws ServletException, IOException {
if (isStarted() || isFinished()) {
- throw new IllegalStateException(
+ throw new TestException(
"request have already been executed");
}
start();
@@ -160,13 +177,20 @@
finish();
}
+ /**
+ * Finish request to the this connection, inform server listeners about request status.
+ */
public void finish() {
server.requestFinished(request);
finished = true;
}
+ /**
+ * Start request to the this connection, inform server listeners about request status.
+ * No request parameters changes allowed after connection start.
+ */
public void start() {
- log.fine("start " + getMethod() + " request processing for file "
+ log.fine("start " + getRequestMethod() + " request processing for file "
+ url.getFile());
log.fine("request parameters: " + requestParameters);
server.requestStarted(request);
@@ -174,15 +198,19 @@
}
/**
+ * Get request HTTP methos ( GET, POST etc ).
* @return the method
*/
- public HttpMethod getMethod() {
+ public HttpMethod getRequestMethod() {
return method;
}
/**
+ * Set request HTTP methos ( GET, POST etc ).
* @param method
* the method to set
+ * @throws TestException
+ * if connection have already been started.
*/
public void setRequestMethod(HttpMethod method) {
checkNotStarted();
@@ -190,12 +218,20 @@
}
/**
+ * Get request url.
* @return the url
*/
public URL getUrl() {
return url;
}
+ /**
+ * Append additional request parameter.
+ * @param name
+ * @param value
+ * @throws TestException
+ * if connection have already been started.
+ */
public void addRequestParameter(String name, String value) {
checkNotStarted();
String[] values = requestParameters.get(name);
@@ -211,7 +247,10 @@
}
/**
- * @return
+ * Get content of the response as String.
+ * @return content of the response writer or String created from the ServletOutputStream with current response encoding.
+ * @throws TestException
+ * if connection have not been started or response has an unsupported encoding.
*/
public String getContentAsString() {
checkStarted();
@@ -234,6 +273,12 @@
return content;
}
+ /**
+ * Get content of the response as byte array.
+ * @return content of the ServletOutputStream or convert String, collected by response writer, with current response encoding.
+ * @throws TestException
+ * if connection have not been started or response has unsupported encoding.
+ */
public byte[] getResponseBody() {
checkStarted();
byte[] content = response.getStreamContent();
@@ -254,6 +299,7 @@
}
/**
+ * List of the {@link Cookie} used by the request or response ( There are same cookies for both request and response ).
* @return the cookies
*/
public List<Cookie> getCookies() {
@@ -261,6 +307,7 @@
}
/**
+ * request object for the this connection.
* @return the request
*/
public HttpServletRequest getRequest() {
@@ -268,18 +315,127 @@
}
/**
+ * response object for the this connection.
* @return the response
*/
public HttpServletResponse getResponse() {
return responseProxy;
}
+ /**
+ * @return encoding used to write response.
+ * @throws TestException
+ * if connection have not been started .
+ */
+ public String getResponseCharacterEncoding() {
+ checkStarted();
+ return response.getCharacterEncoding();
+ }
+
+ /**
+ * @return content type ( eg 'text/html' ) of the response.
+ * @throws TestException
+ * if connection have not been started .
+ */
+ public String getResponseContentType() {
+ checkStarted();
+ return response.getContentType();
+ }
+
+ /**
+ * @return HTTP status code of the response.
+ * @throws TestException
+ * if connection have not been started .
+ */
+ public int getResponseStatus() {
+ checkStarted();
+ return response.getStatus();
+ }
+
+ /**
+ * @return HTTP error message.
+ * @throws TestException
+ * if connection have not been started .
+ */
+ public String getErrorMessage() {
+ checkStarted();
+ return response.getErrorMessage();
+ }
+
+ /**
+ * Set request Query string. This method does not parse query string, {@link #parseFormParameters(String)} should be used.
+ * @param queryString
+ * the queryString to set
+ * @throws TestException
+ * if connection have already been started .
+ */
+ public void setQueryString(String queryString) {
+ checkNotStarted();
+ this.queryString = queryString;
+ }
+
+ /**
+ * @return the queryString
+ */
+ public String getQueryString() {
+ return queryString;
+ }
+
+ /**
+ * Get HTTP response headers.
+ * @return headers name-values map.
+ * @throws TestException
+ * if connection have not been started .
+ */
+ public Map<String, String[]> getResponseHeaders() {
+ checkStarted();
+ return response.getHeaders();
+ }
+
+ /**
+ * Set charset for the request body.
+ * @param charset
+ * @throws UnsupportedEncodingException
+ */
+ public void setRequestCharacterEncoding(String charset) throws UnsupportedEncodingException {
+ checkNotStarted();
+ request.setCharacterEncoding(charset);
+ }
+
+ /**
+ * Set HTTP POST/PUT methods uploading content.
+ * @param body
+ */
+ public void setRequestBody(String body) {
+ checkNotStarted();
+ request.setRequestBody(body);
+ }
+
+ /**
+ * Set HTTP request content type ( eg 'application/x-www-form-urlencoded' or 'text/xml' ).
+ * @param contentType
+ */
+ public void setRequestContentType(String contentType) {
+ checkNotStarted();
+ request.setContentType(contentType);
+
+ }
+
+ /**
+ * Append additional HTTP request headers.
+ * @param headers
+ */
+ public void addRequestHeaders(Map<String, String> headers) {
+ checkNotStarted();
+ request.addHeaders(headers);
+ }
+
private class ConnectionRequest extends StagingHttpRequest {
-
+
public Cookie[] getCookies() {
return cookies.toArray(COOKIE);
}
-
+
/*
* (non-Javadoc)
*
@@ -288,7 +444,7 @@
public String getMethod() {
return method.toString();
}
-
+
/*
* (non-Javadoc)
*
@@ -297,7 +453,7 @@
public String getServletPath() {
return servletPath;
}
-
+
/*
* (non-Javadoc)
*
@@ -306,7 +462,7 @@
public String getPathInfo() {
return pathInfo;
}
-
+
/*
* (non-Javadoc)
*
@@ -315,7 +471,7 @@
public String getQueryString() {
return queryString;
}
-
+
/*
* (non-Javadoc)
*
@@ -324,7 +480,24 @@
public String getRequestURI() {
return url.getPath();
}
-
+
+ /* (non-Javadoc)
+ * @see org.richfaces.test.staging.StagingHttpRequest#getServerName()
+ */
+ @Override
+ public String getServerName() {
+ return url.getHost();
+ }
+
+
+ @Override
+ public int getLocalPort() {
+ int port = url.getPort();
+ if(port < 0){
+ port = super.getLocalPort();
+ }
+ return port;
+ }
/*
* (non-Javadoc)
*
@@ -337,7 +510,7 @@
}
return null;
}
-
+
/*
* (non-Javadoc)
*
@@ -347,7 +520,7 @@
public Map getParameterMap() {
return Collections.unmodifiableMap(requestParameters);
}
-
+
/*
* (non-Javadoc)
*
@@ -357,7 +530,7 @@
public Enumeration getParameterNames() {
return Collections.enumeration(requestParameters.keySet());
}
-
+
/*
* (non-Javadoc)
*
@@ -367,7 +540,7 @@
public String[] getParameterValues(String name) {
return requestParameters.get(name);
}
-
+
/*
* (non-Javadoc)
*
@@ -376,7 +549,7 @@
public HttpSession getSession() {
return server.getSession();
}
-
+
/*
* (non-Javadoc)
*
@@ -385,7 +558,7 @@
public HttpSession getSession(boolean create) {
return server.getSession(create);
}
-
+
@Override
public RequestDispatcher getRequestDispatcher(String path) {
RequestDispatcher dispatcher = null;
@@ -400,43 +573,43 @@
final RequestChain dispatchedServlet = server.getServlet(path);
if (null != dispatchedServlet) {
dispatcher = new RequestDispatcher() {
-
+
public void forward(ServletRequest request,
ServletResponse response) throws ServletException,
IOException {
response.reset();
dispatchedServlet.execute(request, response);
}
-
+
public void include(ServletRequest request,
ServletResponse response) throws ServletException,
IOException {
dispatchedServlet.execute(request, response);
}
-
+
};
}
return dispatcher;
}
-
+
@Override
protected void attributeAdded(String name, Object o) {
server.requestAttributeAdded(this, name, o);
-
+
}
-
+
@Override
protected void attributeRemoved(String name, Object removed) {
server.requestAttributeRemoved(this, name, removed);
-
+
}
-
+
@Override
protected void attributeReplaced(String name, Object o) {
server.requestAttributeReplaced(this, name, o);
-
+
}
-
+
}
private class ConnectionResponse extends StagingHttpResponse {
@@ -449,73 +622,9 @@
*/
public void addCookie(Cookie cookie) {
cookies.add(cookie);
-
+
}
-
+
}
- public String getCharacterEncoding() {
- checkStarted();
- return response.getCharacterEncoding();
- }
-
- public String getContentType() {
- checkStarted();
- return response.getContentType();
- }
-
- public int getStatus() {
- checkStarted();
- return response.getStatus();
- }
-
- public String getErrorMessage() {
- checkStarted();
- return response.getErrorMessage();
- }
-
- /**
- * @param queryString
- * the queryString to set
- */
- public void setQueryString(String queryString) {
- checkNotStarted();
- this.queryString = queryString;
- }
-
- /**
- * @return the queryString
- */
- public String getQueryString() {
- return queryString;
- }
-
- /**
- * @return
- */
- public Map<String, String[]> getResponseHeaders() {
- checkStarted();
- return response.getHeaders();
- }
-
- public void setRequestCharacterEncoding(String charset) throws UnsupportedEncodingException {
- checkNotStarted();
- request.setCharacterEncoding(charset);
- }
-
- public void setRequestBody(String body) {
- checkNotStarted();
- request.setRequestBody(body);
- }
-
- public void setRequestContentType(String contentType) {
- checkNotStarted();
- request.setContentType(contentType);
-
- }
-
- public void addRequestHeaders(Map<String, String> headers) {
- request.addHeaders(headers);
- }
-
}
Modified: trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingServer.java
===================================================================
--- trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingServer.java 2008-11-19 19:11:32 UTC (rev 11253)
+++ trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/StagingServer.java 2008-11-19 23:08:09 UTC (rev 11254)
@@ -15,6 +15,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.logging.Logger;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@@ -31,6 +32,8 @@
import javax.servlet.ServletRequestAttributeListener;
import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionBindingEvent;
@@ -41,9 +44,17 @@
import org.richfaces.test.TestException;
/**
- * This class implements limited Http servlet container 2.5 functionality. It
- * supports only calls only, java code configuration, just one web application
- * etc...
+ * This class implements limited Http servlet container 2.5 functionality. It is designed for a test purposes only ,so that has a limitations:
+ * <ul>
+ * <li>supports local calls only.</li>
+ * <li>java code only configuration ( no xml files processed ).</li>
+ * <li>just one web application, 'deployed' in the root context.</li>
+ * <li>only one client session</li>
+ * <li>communicates by the local java calls only, no network connection</li>
+ * <li>no JSP compilator support ( but it is possible to register pre-compiled pages as servlets)</li>
+ * <li>...</li>
+ * </ul>
+ * It is main part of the test framework.
*
*/
public class StagingServer {
@@ -58,6 +69,8 @@
private static final Class<HttpSessionAttributeListener> SESSION_ATTRIBUTE_LISTENER_CLASS = HttpSessionAttributeListener.class;
+ private static final Logger log = ServerLogger.SERVER.getLogger();
+
private List<RequestChain> servlets = new ArrayList<RequestChain>();
private RequestChain defaultServlet;
@@ -80,6 +93,11 @@
private HttpSession sessionProxy;
+ /**
+ * This inner class links ServletContext calls to the server instance.
+ * @author asmirnov
+ *
+ */
private class LocalContext extends StagingServletContext {
/*
@@ -96,6 +114,9 @@
return mimeTypes.get(file);
}
+ /* (non-Javadoc)
+ * @see org.richfaces.test.staging.StagingServletContext#valueBound(javax.servlet.ServletContextAttributeEvent)
+ */
@Override
protected void valueBound(ServletContextAttributeEvent event) {
// inform listeners.
@@ -107,6 +128,9 @@
}
}
+ /* (non-Javadoc)
+ * @see org.richfaces.test.staging.StagingServletContext#valueReplaced(javax.servlet.ServletContextAttributeEvent)
+ */
@Override
protected void valueReplaced(ServletContextAttributeEvent event) {
// inform listeners.
@@ -118,6 +142,9 @@
}
}
+ /* (non-Javadoc)
+ * @see org.richfaces.test.staging.StagingServletContext#valueUnbound(javax.servlet.ServletContextAttributeEvent)
+ */
@Override
protected void valueUnbound(ServletContextAttributeEvent event) {
// inform listeners.
@@ -129,24 +156,33 @@
}
}
+ /* (non-Javadoc)
+ * @see org.richfaces.test.staging.StagingServletContext#getServerResource(java.lang.String)
+ */
@Override
- /*
- * @param path
- *
- * @return
- */
protected ServerResource getServerResource(String path) {
return serverRoot.getResource(new ServerResourcePath(path));
}
}
+ /**
+ * This inner class links session object calls to the server instance.
+ * @author asmirnov
+ *
+ */
private class ServerHttpSession extends StagingHttpSession {
+ /* (non-Javadoc)
+ * @see javax.servlet.http.HttpSession#getServletContext()
+ */
public ServletContext getServletContext() {
return context;
}
+ /* (non-Javadoc)
+ * @see org.richfaces.test.staging.StagingHttpSession#valueBound(javax.servlet.http.HttpSessionBindingEvent)
+ */
@Override
protected void valueBound(
final HttpSessionBindingEvent sessionBindingEvent) {
@@ -159,6 +195,9 @@
});
}
+ /* (non-Javadoc)
+ * @see org.richfaces.test.staging.StagingHttpSession#valueUnbound(javax.servlet.http.HttpSessionBindingEvent)
+ */
@Override
protected void valueUnbound(
final HttpSessionBindingEvent sessionBindingEvent) {
@@ -171,6 +210,9 @@
});
}
+ /* (non-Javadoc)
+ * @see org.richfaces.test.staging.StagingHttpSession#valueReplaced(javax.servlet.http.HttpSessionBindingEvent)
+ */
@Override
protected void valueReplaced(
final HttpSessionBindingEvent sessionBindingEvent) {
@@ -199,7 +241,7 @@
/**
* Append executable server object ( {@link Filter} or {@link Servlet}
- * container.
+ * to the server.
*
* @param servlet
*/
@@ -224,7 +266,8 @@
*
* @param path
* request path relative to web application context.
- * @return
+ * @return Appropriate Filter or Servlet executable object to serve given request. If no servlet was registered for the given path,
+ * try to send requested object directly.
*/
public RequestChain getServlet(String path) {
RequestChain result = null;
@@ -235,9 +278,11 @@
}
}
if (null == result) {
+ // Is requested object exist in the virtual content ?
try {
URL resource = context.getResource(path);
if (null != resource) {
+ // Serve it directly.
result = defaultServlet;
}
} catch (MalformedURLException e) {
@@ -247,29 +292,55 @@
return result;
}
+ /**
+ * Add web application init parameter.
+ * @param name
+ * @param value
+ */
public void addInitParameter(String name, String value) {
initParameters.put(name, value);
}
- void addMimeType(String extension, String mimeType) {
+ /**
+ * Add default mime type for serve files with given extension.
+ * @param extension
+ * @param mimeType
+ */
+ public void addMimeType(String extension, String mimeType) {
mimeTypes.put(extension, mimeType);
}
+ /**
+ * Add java resource to the virtual web application content. This method makes all parent directories as needed.
+ * @param path path to the file in the virtual web server.
+ * @param resource path to the resource in the classpath, as required by the {@link ClassLoader#getResource(String)}.
+ */
public void addResource(String path, String resource) {
ServerResourcePath resourcePath = new ServerResourcePath(path);
serverRoot.addResource(resourcePath, new ClasspathServerResource(
resource));
}
+ /**
+ * Add resource to the virtual veb application content. This method makes all parent directories as needed.
+ * @param path path to the file in the virtual web server.
+ * @param resource {@code URL} to the file content.
+ */
public void addResource(String path, URL resource) {
serverRoot.addResource(new ServerResourcePath(path),
new UrlServerResource(resource));
}
+ /**
+ * Add all resources from the directory to the virtual web application content.
+ * @param path name of the target directory in the virtual web application. If no such directory exists, it will be created, as well as all parent directories as needed.
+ * @param resource {@code URL} to the source directory or any file in the source directory. Only 'file' or 'jar' protocols are supported. If this parameter points to a file, it will be converted to a enclosing directory.
+ */
public void addResourcesFromDirectory(String path, URL resource) {
ServerResourcePath resourcePath = new ServerResourcePath(path);
ServerResource baseDirectory = serverRoot.getResource(resourcePath);
if (null == baseDirectory) {
+ // Create target directory.
baseDirectory = new ServerResourcesDirectory();
serverRoot.addResource(resourcePath, baseDirectory);
}
@@ -283,6 +354,11 @@
}
}
+ /**
+ * Internal method used by the {@link #addResourcesFromDirectory(String, URL)} to process 'file' protocol.
+ * @param resource source directory.
+ * @param baseDirectory target virtual directory.
+ */
protected void addResourcesFromFile(URL resource,
ServerResource baseDirectory) {
File file = new File(resource.getPath());
@@ -296,6 +372,11 @@
}
}
+ /**
+ * Internal method used by the {@link #addResourcesFromDirectory(String, URL)} to process 'jar' protocol.
+ * @param resource URL to the any object in the source directory.
+ * @param baseDirectory target virtual directory.
+ */
protected void addResourcesFromJar(URL resource,
ServerResource baseDirectory) {
try {
@@ -326,6 +407,7 @@
}
/**
+ * Internal reccursive method process directory content and all subdirectories.
* @param baseDirectory
* @param file
* @throws MalformedURLException
@@ -349,11 +431,26 @@
}
}
+ /**
+ * Add web-application wide listenes, same as it is defined by the
+ * <listener> element in the web.xml file for a real server.
+ * Supported listener types:
+ * <ul>
+ * <li>{@link ServletContextListener}</li>
+ * <li>{@link ServletContextAttributeListener}</li>
+ * <li>{@link HttpSessionListener}</li>
+ * <li>{@link HttpSessionAttributeListener}</li>
+ * <li>{@link ServletRequestListener}</li>
+ * <li>{@link ServletRequestAttributeListener}</li>
+ * </ul>
+ * @param listener web listener instance.
+ */
public void addWebListener(EventListener listener) {
contextListeners.add(listener);
}
/**
+ * Getter method for 'interceptor' events listener.
* @return the invocationListener
*/
public InvocationListener getInvocationListener() {
@@ -361,6 +458,8 @@
}
/**
+ * Set listener which gets events on all calls to any methods of the {@link ServletContext}, {@link HttpSession}, {@link HttpServletRequest}, {@link HttpServletResponse} instances
+ * in the virtual server. this interceptor can be used to check internal calls in the tests .
* @param invocationListener
* the invocationListener to set
*/
@@ -369,9 +468,11 @@
}
/**
+ * Create instance of the {@link InvocationHandler} for the proxy objects. This handler fire events to the
+ * registered {@link InvocationListener} ( if present ) after target object method call.
* @return the invocationHandler
*/
- public InvocationHandler getInvocationHandler(final Object target) {
+ InvocationHandler getInvocationHandler(final Object target) {
return new InvocationHandler() {
public Object invoke(Object proxy, Method method, Object[] args)
@@ -397,10 +498,39 @@
}
+ /**
+ * Get virtual server session object. Create new one if necessary.
+ * @return instance of the virtual server session.
+ */
public HttpSession getSession() {
return getSession(true);
}
+ /**
+ *
+ * Returns the current <code>HttpSession</code>
+ * associated with this server or, if there is no
+ * current session and <code>create</code> is true, returns
+ * a new session. Staging server supports only one session per instance,
+ * different clients for the same server instance does not supported.
+ *
+ * <p>If <code>create</code> is <code>false</code>
+ * and the request has no valid <code>HttpSession</code>,
+ * this method returns <code>null</code>.
+ *
+ *
+ * @param create <code>true</code> to create
+ * a new session for this request if necessary;
+ * <code>false</code> to return <code>null</code>
+ * if there's no current session
+ *
+ *
+ * @return the <code>HttpSession</code> associated
+ * with this server instance or <code>null</code> if
+ * <code>create</code> is <code>false</code>
+ * and the server has no session
+ *
+ */
public synchronized HttpSession getSession(boolean create) {
if (null == this.session && create) {
this.session = new ServerHttpSession();
@@ -424,6 +554,11 @@
return sessionProxy;
}
+ /**
+ * Virtual server initialization. This method creates instances of the {@link ServletContext}, {@link JspFactory},
+ * informs {@link ServletContextListener} ind inits all {@link Filter} and {@link Servlet} instances.
+ * It should be called from test setUp method to prepare testing environment.
+ */
public void init() {
// Create context.
this.context = new LocalContext();
@@ -461,6 +596,11 @@
}
}
+ /**
+ * Stop wirtual server. This method informs {@link ServletContextListener} ind inits all {@link Filter} and {@link Servlet} instances, as well remove all internal objects.
+ * It should be called from the testt thearDown method to clean up testing environment.
+ *
+ */
public void destroy() {
// Destroy session
if (null != this.session) {
@@ -493,15 +633,30 @@
}
+ /**
+ * Get virtual connection to the given URL. Even thought for an http request to the
+ * external servers, only local connection to the virtual server will be created.
+ * @param url request url.
+ * @return local connection to the appropriate servlet in the virtual server.
+ * @throws {@link TestException} if no servlet found to process given URL.
+ */
public StagingConnection getConnection(URL url) {
return new StagingConnection(this, url);
}
+ /**
+ * Get instance of virtual web application context.
+ * @return context instance.
+ */
public ServletContext getContext() {
return contextProxy;
}
- public void requestStarted(ServletRequest request) {
+ /**
+ * Inform {@link ServletRequestListener} instances. For internal use only.
+ * @param request started request.
+ */
+ void requestStarted(ServletRequest request) {
final ServletRequestEvent event = new ServletRequestEvent(context,
request);
fireEvent(REQUEST_LISTENER_CLASS,
@@ -513,7 +668,11 @@
});
}
- public void requestFinished(ServletRequest request) {
+ /**
+ * Inform {@link ServletRequestListener} instances. For internal use only.
+ * @param request finished request.
+ */
+ void requestFinished(ServletRequest request) {
final ServletRequestEvent event = new ServletRequestEvent(context,
request);
fireEvent(REQUEST_LISTENER_CLASS,
@@ -524,7 +683,7 @@
});
}
- public void requestAttributeAdded(ServletRequest request, String name,
+ void requestAttributeAdded(ServletRequest request, String name,
Object o) {
final ServletRequestAttributeEvent event = new ServletRequestAttributeEvent(
context, request, name, o);
@@ -536,7 +695,7 @@
});
}
- public void requestAttributeRemoved(ServletRequest request, String name,
+ void requestAttributeRemoved(ServletRequest request, String name,
Object removed) {
final ServletRequestAttributeEvent event = new ServletRequestAttributeEvent(
context, request, name, removed);
@@ -548,7 +707,7 @@
});
}
- public void requestAttributeReplaced(ServletRequest request, String name,
+ void requestAttributeReplaced(ServletRequest request, String name,
Object value) {
final ServletRequestAttributeEvent event = new ServletRequestAttributeEvent(
context, request, name, value);
Modified: trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/StaticServlet.java
===================================================================
--- trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/StaticServlet.java 2008-11-19 19:11:32 UTC (rev 11253)
+++ trunk/framework/jsf-test/src/main/java/org/richfaces/test/staging/StaticServlet.java 2008-11-19 23:08:09 UTC (rev 11254)
@@ -24,6 +24,12 @@
throws ServletException, IOException {
InputStream inputStream = getServletContext().getResourceAsStream(req.getServletPath());
if(null != inputStream){
+ String fileName = req.getServletPath();
+ String mimeType = getServletContext().getMimeType(fileName);
+ if(null == mimeType){
+ mimeType = "text/plain";
+ }
+ resp.setContentType(mimeType);
ServletOutputStream outputStream = resp.getOutputStream();
int c;
while((c = inputStream.read())>0){
Added: trunk/framework/jsf-test/src/main/javadoc/overview.html
===================================================================
--- trunk/framework/jsf-test/src/main/javadoc/overview.html (rev 0)
+++ trunk/framework/jsf-test/src/main/javadoc/overview.html 2008-11-19 23:08:09 UTC (rev 11254)
@@ -0,0 +1,10 @@
+<!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>Insert title here</title>
+</head>
+<body>
+
+</body>
+</html>
\ No newline at end of file
Property changes on: trunk/framework/jsf-test/src/main/javadoc/overview.html
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/framework/jsf-test/src/test/java/org/richfaces/test/FacesServerTest.java
===================================================================
--- trunk/framework/jsf-test/src/test/java/org/richfaces/test/FacesServerTest.java 2008-11-19 19:11:32 UTC (rev 11253)
+++ trunk/framework/jsf-test/src/test/java/org/richfaces/test/FacesServerTest.java 2008-11-19 23:08:09 UTC (rev 11254)
@@ -5,33 +5,18 @@
import static org.junit.Assert.*;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.logging.Level;
-import java.util.logging.LogManager;
-import java.util.logging.Logger;
-
-import javax.faces.application.StateManager;
-import javax.faces.application.ViewHandler;
-import javax.faces.webapp.FacesServlet;
import javax.servlet.http.HttpSession;
import org.junit.After;
-import org.junit.AfterClass;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Test;
import org.w3c.dom.Element;
-import com.gargoylesoftware.htmlunit.Page;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlInput;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.SubmittableElement;
-import com.sun.faces.config.ConfigureListener;
-import com.sun.faces.util.FacesLogger;
/**
* @author asmirnov
@@ -44,7 +29,7 @@
* @throws java.lang.Exception
*/
@Before
- public void setUp() throws Exception {
+ public void setUpTest() throws Exception {
}
@Override
@@ -59,7 +44,7 @@
* @throws java.lang.Exception
*/
@After
- public void tearDown() throws Exception {
+ public void tearDownTest() throws Exception {
}
/**
17 years, 5 months
JBoss Rich Faces SVN: r11253 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/pages/tree and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2008-11-19 14:11:32 -0500 (Wed, 19 Nov 2008)
New Revision: 11253
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/treeAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeTest.java
Log:
https://jira.jboss.org/jira/browse/RF-4829, https://jira.jboss.org/jira/browse/RF-4830 started
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeTestBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeTestBean.java 2008-11-19 17:50:44 UTC (rev 11252)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/tree/TreeTestBean.java 2008-11-19 19:11:32 UTC (rev 11253)
@@ -157,4 +157,59 @@
this.nodeTitle = nodeTitle;
}
+ private String switchType = "ajax";
+
+ /**
+ * Gets value of switchType field.
+ * @return value of switchType field
+ */
+ public String getSwitchType() {
+ return switchType;
+ }
+
+ /**
+ * Set a new value for switchType field.
+ * @param switchType a new value for switchType field
+ */
+ public void setSwitchType(String switchType) {
+ this.switchType = switchType;
+ }
+
+ private boolean toggleOnClick = false;
+
+ /**
+ * Gets value of toggleOnClick field.
+ * @return value of toggleOnClick field
+ */
+ public boolean isToggleOnClick() {
+ return toggleOnClick;
+ }
+
+ /**
+ * Set a new value for toggleOnClick field.
+ * @param toggleOnClick a new value for toggleOnClick field
+ */
+ public void setToggleOnClick(boolean toggleOnClick) {
+ this.toggleOnClick = toggleOnClick;
+ }
+
+ public void initToggleOnClickTestServerMode() {
+ setToggleOnClick(true);
+ setSwitchType("server");
+ }
+
+ public void initToggleOnClickTestAjaxMode() {
+ setToggleOnClick(true);
+ setSwitchType("ajax");
+ }
+
+ public void initToggleOnClickTestClientMode() {
+ setToggleOnClick(true);
+ setSwitchType("client");
+ }
+
+ public void initAjaxCoreTest() {
+ setSwitchType("ajax");
+ setToggleOnClick(false);
+ }
}
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tree/treeAutoTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2008-11-19 17:50:44 UTC (rev 11252)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2008-11-19 19:11:32 UTC (rev 11253)
@@ -736,16 +736,28 @@
/**
* Returns true if element with given id is present.
- *
+ * @deprecated replaced by <code>isPresent(String locator)</code>.
* @param id -
* DOM element id
* @return true if element with given id is present, otherwise - false
*/
+ @Deprecated
public boolean isPresentById(String id) {
return selenium.isElementPresent("id=" + id);
}
/**
+ * Returns true if element with given locator is present.
+ *
+ * @param locator
+ * an element locator
+ * @return true if element with given locator is present, otherwise - false
+ */
+ public boolean isPresent(String locator) {
+ return selenium.isElementPresent(locator);
+ }
+
+ /**
* Invokes JS method on client.
*
* @param id -
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeTest.java 2008-11-19 17:50:44 UTC (rev 11252)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TreeTest.java 2008-11-19 19:11:32 UTC (rev 11253)
@@ -7,11 +7,16 @@
import org.richfaces.AutoTester;
import org.richfaces.SeleniumTestBase;
import org.richfaces.AutoTester.TestSetupEntry;
+import org.testng.Assert;
import org.testng.annotations.Test;
public class TreeTest extends SeleniumTestBase {
private static Map<String, String> params = new HashMap<String, String>();
+ private final static String INIT_TOGGLE_ON_CLICK_SERVER_MODE = "#{treeBean.initToggleOnClickTestServerMode}";
+ private final static String INIT_TOGGLE_ON_CLICK_AJAX_MODE = "#{treeBean.initToggleOnClickTestAjaxMode}";
+ private final static String INIT_TOGGLE_ON_CLICK_CLIENT_MODE = "#{treeBean.initToggleOnClickTestClientMode}";
+ private final static String INIT_AJAX_CORE_TEST = "#{treeBean.initAjaxCoreTest}";
static {
params.put("parameter1", "value1");
@@ -22,7 +27,7 @@
@Test
public void testRenderedAttribute(Template template) {
AutoTester tester = getAutoTester(this);
- tester.renderPage(template, null);
+ tester.renderPage(template, INIT_AJAX_CORE_TEST);
writeStatus("Test component with rendered = false is not present on the page");
tester.testRendered();
}
@@ -30,7 +35,7 @@
@Test
public void testNestedParams(Template template) {
AutoTester tester = getAutoTester(this);
- tester.renderPage(template, null);
+ tester.renderPage(template, INIT_AJAX_CORE_TEST);
writeStatus("Test component encodes nested f:param tags and their values are present as request parameters");
tester.testRequestParameters(params);
}
@@ -38,11 +43,11 @@
@Test
public void testAjaxSingle(Template template) {
AutoTester tester = getAutoTester(this);
- tester.renderPage(template, null);
+ tester.renderPage(template, INIT_AJAX_CORE_TEST);
tester.reset();
tester.setupControl(TestSetupEntry.ajaxSingle, Boolean.TRUE);
tester.clickLoad();
- //navigate to the first child
+ writeStatus("Navigate to the first child");
String compId = getAutoTester(this).getClientId(AutoTester.COMPONENT_ID);
clickAjaxCommandAndWait("//*[@id='"+ compId + ":childs']/table[1]/tbody/tr/td/div/a");
clickAjaxCommandAndWait("//*[@id='"+ compId + ":childs']/div/table[1]/tbody/tr/td/div/a");
@@ -58,7 +63,7 @@
@Test
public void testAjaxSingleWithInternalValidationFailed(Template template) {
AutoTester tester = getAutoTester(this);
- tester.renderPage(template, null);
+ tester.renderPage(template, INIT_AJAX_CORE_TEST);
tester.reset();
tester.setupControl(TestSetupEntry.ajaxSingle, Boolean.TRUE);
tester.clickLoad();
@@ -78,7 +83,7 @@
@Test
public void testImmediate(Template template) {
AutoTester tester = getAutoTester(this);
- tester.renderPage(template, null);
+ tester.renderPage(template, INIT_AJAX_CORE_TEST);
tester.reset();
tester.setupControl(TestSetupEntry.immediate, Boolean.TRUE);
tester.clickLoad();
@@ -98,11 +103,10 @@
@Test
public void testImmediateWithExternalValidationFailed(Template template) {
AutoTester tester = getAutoTester(this);
- tester.renderPage(template, null);
+ tester.renderPage(template, INIT_AJAX_CORE_TEST);
tester.reset();
tester.setupControl(TestSetupEntry.immediate, Boolean.TRUE);
tester.clickLoad();
- tester.startTracing();
writeStatus("Navigate to the first child");
String compId = getAutoTester(this).getClientId(AutoTester.COMPONENT_ID);
clickAjaxCommandAndWait("//*[@id='"+ compId + ":childs']/table[1]/tbody/tr/td/div/a");
@@ -118,6 +122,32 @@
tester.checkNodeExpandedListener(true);
}
+ @Test
+ public void testToggleOnClickTrueWithServerMode(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, INIT_TOGGLE_ON_CLICK_SERVER_MODE);
+ tester.reset();
+ tester.clickLoad();
+ writeStatus("Try to toggle a node with server swith type");
+ String compId = getAutoTester(this).getClientId(AutoTester.COMPONENT_ID);
+ selenium.click("//*[@id='"+ compId + ":childs']/table[1]/tbody/tr/td[3]");
+ waitForPageToLoad();
+ writeStatus("Check the node is expanded and proper listeners are invoked");
+ Assert.assertTrue(isPresent("//*[@id='"+ compId + ":childs']/div/table[1]/tbody/tr/td[3]"), "Node has not been expanded");
+ tester.checkNodeExpandedListener(true);
+ tester.checkUpdateModel(true);
+ tester.startTracing();
+ writeStatus("Test the same in case of external validation failure");
+ writeStatus("Set external validation to fail");
+ tester.setExtrenalValidationFailed();
+ selenium.click("//*[@id='"+ compId + ":childs']/div/table[1]/tbody/tr/td[3]");
+ waitForPageToLoad();
+ writeStatus("Check the node is not collapsed and no listeners are invoked due to external validation error");
+ Assert.assertTrue(isPresent("//*[@id='"+ compId + ":childs']/div/table[1]/tbody/tr/td[3]"), "Node has been collapsed");
+ tester.checkNodeExpandedListener(false);
+ tester.checkUpdateModel(false);
+ }
+
@Override
public void sendAjax() {
AutoTester tester = getAutoTester(this);
17 years, 5 months
JBoss Rich Faces SVN: r11252 - trunk/ui/core/src/test/java/org/ajax4jsf/component.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-11-19 12:50:44 -0500 (Wed, 19 Nov 2008)
New Revision: 11252
Modified:
trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueSizeTest.java
Log:
Test method added to QueueSizeTest in order to be runnable ok by Maven
Modified: trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueSizeTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueSizeTest.java 2008-11-19 17:46:41 UTC (rev 11251)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueSizeTest.java 2008-11-19 17:50:44 UTC (rev 11252)
@@ -21,6 +21,10 @@
package org.ajax4jsf.component;
+import java.util.UUID;
+
+
+
/**
* @author Nick Belaevski
* @since 3.3.0
@@ -32,6 +36,14 @@
super(name);
}
+ public void testUnlimited() throws Exception {
+ renderView("/queue-size.xhtml");
+ ParametersBuilder parametersBuilder = createAjaxParameters().eventsQueue("defaultSizeQueue");
+
+ ajax("a", parametersBuilder.requestId(UUID.randomUUID().toString()));
+
+ TestsResult result = getTestsResult();
+ }
}
17 years, 5 months
JBoss Rich Faces SVN: r11251 - in trunk/ui/core/src/test: resources/org/ajax4jsf/component and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-11-19 12:46:41 -0500 (Wed, 19 Nov 2008)
New Revision: 11251
Added:
trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueScriptedTest.java
trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-scripted.xhtml
Removed:
trunk/ui/core/src/test/java/org/ajax4jsf/component/ScriptTest.java
trunk/ui/core/src/test/resources/org/ajax4jsf/component/script.xhtml
Log:
Queue test resources refactored
Copied: trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueScriptedTest.java (from rev 11246, trunk/ui/core/src/test/java/org/ajax4jsf/component/ScriptTest.java)
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueScriptedTest.java (rev 0)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueScriptedTest.java 2008-11-19 17:46:41 UTC (rev 11251)
@@ -0,0 +1,111 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+package org.ajax4jsf.component;
+
+import java.util.List;
+
+/**
+ * @author Denis Morozov
+ * @author Nick Belaevski
+ */
+public class QueueScriptedTest extends AbstractQueueComponentTest {
+
+ private static final String QUEUE_NAME = "testQueue";
+
+ private static final String VIEW_NAME = "/queue-scripted.xhtml";
+
+ public QueueScriptedTest(String name) {
+ super(name);
+ }
+
+ public void testSimpleAjax() throws Exception {
+ renderView(VIEW_NAME);
+
+ delay(50);
+ ajax("a", createAjaxParameters().requestTime(100));
+ ajax("b", createAjaxParameters().requestTime(150));
+
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+ assertEquals(2, dataList.size());
+ assertRequestData(dataList.get(0), "a", 50, 150, false);
+ assertRequestData(dataList.get(1), "b", 50, 200, false);
+
+ assertEquals(200d, result.getCurrentTime());
+ }
+
+ public void testSimpleQueuedAjax() throws Exception {
+ renderView(VIEW_NAME);
+
+ delay(50);
+ ParametersBuilder queueParameters = createAjaxParameters().requestTime(500).eventsQueue(QUEUE_NAME);
+ ajax("a", queueParameters.requestId(0));
+ delay(200);
+ ajax("b", queueParameters.requestId(1));
+
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+ assertEquals(2, dataList.size());
+ assertRequestData(dataList.get(0), "a", 50, 550, false);
+ assertRequestData(dataList.get(1), "b", 550, 1050, false);
+
+ assertEquals(1050d, result.getCurrentTime());
+ }
+
+ public void testScript() throws Exception {
+ renderView(VIEW_NAME);
+
+ delay(500);
+ ajax("a", "{requestDelay: 100, requestId: '12', requestTime: 100, eventsQueue: 'q'}");
+ delay(4100);
+ ajax("b", "{requestDelay: 4400, requestId: '12', requestTime: 101, timeout: 10, eventsQueue: 'q'}");
+ ajax("c", "{requestDelay: 0, requestId: '123', requestTime: 1, timeout: 10, eventsQueue: 'q'}");
+
+ System.out.println(getTestsResult());
+ }
+
+ public void testImplicitQueue() throws Exception {
+ renderView(VIEW_NAME);
+
+ ParametersBuilder parameters = createAjaxParameters().
+ requestDelay(100).
+ implicitEventsQueue("myqueue").
+ requestTime(10);
+
+ ajax("a", parameters);
+ delay(10);
+ ajax("b", parameters);
+ delay(10);
+ ajax("c", parameters.requestDelay(50));
+
+ TestsResult result = getTestsResult();
+ List<RequestData> dataList = result.getDataList();
+ assertEquals(1, dataList.size());
+
+ RequestData requestData = dataList.get(0);
+ assertRequestData(requestData, "c", 70, 80, false);
+
+ assertEquals(80d, result.getCurrentTime());
+
+ }
+}
Property changes on: trunk/ui/core/src/test/java/org/ajax4jsf/component/QueueScriptedTest.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: trunk/ui/core/src/test/java/org/ajax4jsf/component/ScriptTest.java
===================================================================
--- trunk/ui/core/src/test/java/org/ajax4jsf/component/ScriptTest.java 2008-11-19 17:45:32 UTC (rev 11250)
+++ trunk/ui/core/src/test/java/org/ajax4jsf/component/ScriptTest.java 2008-11-19 17:46:41 UTC (rev 11251)
@@ -1,111 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-package org.ajax4jsf.component;
-
-import java.util.List;
-
-/**
- * @author Denis Morozov
- * @author Nick Belaevski
- */
-public class ScriptTest extends AbstractQueueComponentTest {
-
- private static final String QUEUE_NAME = "testQueue";
-
- private static final String VIEW_NAME = "/script.xhtml";
-
- public ScriptTest(String name) {
- super(name);
- }
-
- public void testSimpleAjax() throws Exception {
- renderView(VIEW_NAME);
-
- delay(50);
- ajax("a", createAjaxParameters().requestTime(100));
- ajax("b", createAjaxParameters().requestTime(150));
-
- TestsResult result = getTestsResult();
- List<RequestData> dataList = result.getDataList();
- assertEquals(2, dataList.size());
- assertRequestData(dataList.get(0), "a", 50, 150, false);
- assertRequestData(dataList.get(1), "b", 50, 200, false);
-
- assertEquals(200d, result.getCurrentTime());
- }
-
- public void testSimpleQueuedAjax() throws Exception {
- renderView(VIEW_NAME);
-
- delay(50);
- ParametersBuilder queueParameters = createAjaxParameters().requestTime(500).eventsQueue(QUEUE_NAME);
- ajax("a", queueParameters.requestId(0));
- delay(200);
- ajax("b", queueParameters.requestId(1));
-
- TestsResult result = getTestsResult();
- List<RequestData> dataList = result.getDataList();
- assertEquals(2, dataList.size());
- assertRequestData(dataList.get(0), "a", 50, 550, false);
- assertRequestData(dataList.get(1), "b", 550, 1050, false);
-
- assertEquals(1050d, result.getCurrentTime());
- }
-
- public void testScript() throws Exception {
- renderView(VIEW_NAME);
-
- delay(500);
- ajax("a", "{requestDelay: 100, requestId: '12', requestTime: 100, eventsQueue: 'q'}");
- delay(4100);
- ajax("b", "{requestDelay: 4400, requestId: '12', requestTime: 101, timeout: 10, eventsQueue: 'q'}");
- ajax("c", "{requestDelay: 0, requestId: '123', requestTime: 1, timeout: 10, eventsQueue: 'q'}");
-
- System.out.println(getTestsResult());
- }
-
- public void testImplicitQueue() throws Exception {
- renderView(VIEW_NAME);
-
- ParametersBuilder parameters = createAjaxParameters().
- requestDelay(100).
- implicitEventsQueue("myqueue").
- requestTime(10);
-
- ajax("a", parameters);
- delay(10);
- ajax("b", parameters);
- delay(10);
- ajax("c", parameters.requestDelay(50));
-
- TestsResult result = getTestsResult();
- List<RequestData> dataList = result.getDataList();
- assertEquals(1, dataList.size());
-
- RequestData requestData = dataList.get(0);
- assertRequestData(requestData, "c", 70, 80, false);
-
- assertEquals(80d, result.getCurrentTime());
-
- }
-}
Copied: trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-scripted.xhtml (from rev 11246, trunk/ui/core/src/test/resources/org/ajax4jsf/component/script.xhtml)
===================================================================
--- trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-scripted.xhtml (rev 0)
+++ trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-scripted.xhtml 2008-11-19 17:46:41 UTC (rev 11251)
@@ -0,0 +1,18 @@
+<html
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:c="http://java.sun.com/jstl/core">
+ <head>
+ <title></title>
+ </head>
+ <body>
+ <f:view>
+ <a4j:status startText="...running..." stopText="stopped" startStyle="color: green" />
+
+ <a4j:queue size="2" sizeExceededBehavior="fireNext" name="testQueue" />
+
+ </f:view>
+ </body>
+</html>
Property changes on: trunk/ui/core/src/test/resources/org/ajax4jsf/component/queue-scripted.xhtml
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: trunk/ui/core/src/test/resources/org/ajax4jsf/component/script.xhtml
===================================================================
--- trunk/ui/core/src/test/resources/org/ajax4jsf/component/script.xhtml 2008-11-19 17:45:32 UTC (rev 11250)
+++ trunk/ui/core/src/test/resources/org/ajax4jsf/component/script.xhtml 2008-11-19 17:46:41 UTC (rev 11251)
@@ -1,18 +0,0 @@
-<html
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:a4j="http://richfaces.org/a4j"
- xmlns:c="http://java.sun.com/jstl/core">
- <head>
- <title></title>
- </head>
- <body>
- <f:view>
- <a4j:status startText="...running..." stopText="stopped" startStyle="color: green" />
-
- <a4j:queue size="2" sizeExceededBehavior="fireNext" name="testQueue" />
-
- </f:view>
- </body>
-</html>
17 years, 5 months