[richfaces-svn-commits] JBoss Rich Faces SVN: r266 - trunk/richfaces/tree/src/test/java/org/richfaces/component.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Wed Apr 4 08:00:33 EDT 2007


Author: nbelaevski
Date: 2007-04-04 08:00:33 -0400 (Wed, 04 Apr 2007)
New Revision: 266

Added:
   trunk/richfaces/tree/src/test/java/org/richfaces/component/TreeComponentTest.java
Removed:
   trunk/richfaces/tree/src/test/java/org/richfaces/component/JSFComponentTest.java
Log:
JSFComponentTest renamed to TreeComponentTest

Deleted: trunk/richfaces/tree/src/test/java/org/richfaces/component/JSFComponentTest.java
===================================================================
--- trunk/richfaces/tree/src/test/java/org/richfaces/component/JSFComponentTest.java	2007-04-04 11:57:57 UTC (rev 265)
+++ trunk/richfaces/tree/src/test/java/org/richfaces/component/JSFComponentTest.java	2007-04-04 12:00:33 UTC (rev 266)
@@ -1,150 +0,0 @@
-/**
- * License Agreement.
- *
- *  JBoss RichFaces 3.0 - Ajax4jsf Component Library
- *
- * 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.richfaces.component;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.faces.component.UICommand;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIForm;
-import javax.faces.component.UIInput;
-import javax.faces.component.UIViewRoot;
-import javax.faces.component.html.HtmlCommandLink;
-import javax.faces.component.html.HtmlForm;
-import javax.faces.context.FacesContext;
-
-import org.ajax4jsf.framework.ViewHandlerWrapper;
-import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
-import org.richfaces.component.xml.XmlTreeDataBuilder;
-import org.xml.sax.InputSource;
-
-import com.gargoylesoftware.htmlunit.KeyValuePair;
-import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
-import com.gargoylesoftware.htmlunit.html.HtmlInput;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-
-/**
- * Unit test for simple Component.
- */
-public class JSFComponentTest 
-    extends AbstractAjax4JsfTestCase
-{
-	private UICommand command = null;
-	private UIInput input = null;
-	private UIForm form = null;
-	private UIComponent tree = null;
-	
-    /**
-     * Create the test case
-     *
-     * @param testName name of the test case
-     */
-    public JSFComponentTest( String testName )
-    {
-        super( testName );
-    }
-
-    public void setUp() throws Exception {
-		super.setUp();
-		
-		form = new HtmlForm();
-		
-		facesContext.getViewRoot().getChildren().add(form);
-		
-		input = new UIInput() {
-			public void decode(FacesContext context) {
-				// TODO Auto-generated method stub
-				super.decode(context);
-			}
-		};
-		input.setId("input");
-		
-		form.getChildren().add(input);
-
-		command = new HtmlCommandLink();
-		command.setId("command");
-		
-		form.getChildren().add(command);
-
-		tree = application.createComponent(UITree.COMPONENT_TYPE);
-		
-		((UITree) tree).setValue(
-				XmlTreeDataBuilder.build(
-						new InputSource(
-								this.getClass().
-								getResourceAsStream("/org/richfaces/component/xml/XmlTreeDataBuilderTest.xml")
-								)));
-		
-		form.getChildren().add(tree);
-		((UITree) tree).queueExpandAll();
-    }
-
-    
-    
-    public void tearDown() throws Exception {
-		super.tearDown();
-		
-		this.input = null;
-		this.form = null;
-		this.command = null;
-		this.tree = null;
-    }
-
-	/**
-     * Rigourous Test :-)
-	 * @throws Exception 
-     */
-    public void testComponent() throws Exception
-    {
-    	HtmlPage renderedView = renderView();
-    	System.out.println(renderedView.getWebResponse().getContentAsString());
-    	
-    	HtmlInput htmlInput = (HtmlInput) renderedView.getHtmlElementById(input.getClientId(facesContext));
-    	htmlInput.setValueAttribute("testInput");
-    	
-    	HtmlAnchor htmlLink = (HtmlAnchor) renderedView.getHtmlElementById(command.getClientId(facesContext));
-    	htmlLink.click();
-
-    	List lastParameters = this.webConnection.getLastParameters();
-    	for (Iterator iterator = lastParameters.iterator(); iterator.hasNext();) {
-			KeyValuePair keyValue = (KeyValuePair) iterator.next();
-			
-			externalContext.addRequestParameterMap((String) keyValue.getKey(), (String) keyValue.getValue());
-		}
-    	
-    	System.out.println(this.webConnection.getLastParameters());
-    	
-    	UIViewRoot root = facesContext.getViewRoot();
-    	root.processDecodes(facesContext);
-    	root.processValidators(facesContext);
-    	root.processUpdates(facesContext);
-    	root.processApplication(facesContext);
-    	
-    	renderedView = renderView();
-    	System.out.println(renderedView.getWebResponse().getContentAsString());
-    }
-    
-    public void testProcess() {
-    }
-}

Copied: trunk/richfaces/tree/src/test/java/org/richfaces/component/TreeComponentTest.java (from rev 265, trunk/richfaces/tree/src/test/java/org/richfaces/component/JSFComponentTest.java)
===================================================================
--- trunk/richfaces/tree/src/test/java/org/richfaces/component/TreeComponentTest.java	                        (rev 0)
+++ trunk/richfaces/tree/src/test/java/org/richfaces/component/TreeComponentTest.java	2007-04-04 12:00:33 UTC (rev 266)
@@ -0,0 +1,150 @@
+/**
+ * License Agreement.
+ *
+ *  JBoss RichFaces 3.0 - Ajax4jsf Component Library
+ *
+ * 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.richfaces.component;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.faces.component.UICommand;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIForm;
+import javax.faces.component.UIInput;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlCommandLink;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.framework.ViewHandlerWrapper;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.richfaces.component.xml.XmlTreeDataBuilder;
+import org.xml.sax.InputSource;
+
+import com.gargoylesoftware.htmlunit.KeyValuePair;
+import com.gargoylesoftware.htmlunit.html.HtmlAnchor;
+import com.gargoylesoftware.htmlunit.html.HtmlInput;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+/**
+ * Unit test for simple Component.
+ */
+public class TreeComponentTest 
+    extends AbstractAjax4JsfTestCase
+{
+	private UICommand command = null;
+	private UIInput input = null;
+	private UIForm form = null;
+	private UIComponent tree = null;
+	
+    /**
+     * Create the test case
+     *
+     * @param testName name of the test case
+     */
+    public TreeComponentTest( String testName )
+    {
+        super( testName );
+    }
+
+    public void setUp() throws Exception {
+		super.setUp();
+		
+		form = new HtmlForm();
+		
+		facesContext.getViewRoot().getChildren().add(form);
+		
+		input = new UIInput() {
+			public void decode(FacesContext context) {
+				// TODO Auto-generated method stub
+				super.decode(context);
+			}
+		};
+		input.setId("input");
+		
+		form.getChildren().add(input);
+
+		command = new HtmlCommandLink();
+		command.setId("command");
+		
+		form.getChildren().add(command);
+
+		tree = application.createComponent(UITree.COMPONENT_TYPE);
+		
+		((UITree) tree).setValue(
+				XmlTreeDataBuilder.build(
+						new InputSource(
+								this.getClass().
+								getResourceAsStream("/org/richfaces/component/xml/XmlTreeDataBuilderTest.xml")
+								)));
+		
+		form.getChildren().add(tree);
+		((UITree) tree).queueExpandAll();
+    }
+
+    
+    
+    public void tearDown() throws Exception {
+		super.tearDown();
+		
+		this.input = null;
+		this.form = null;
+		this.command = null;
+		this.tree = null;
+    }
+
+	/**
+     * Rigourous Test :-)
+	 * @throws Exception 
+     */
+    public void testComponent() throws Exception
+    {
+    	HtmlPage renderedView = renderView();
+    	System.out.println(renderedView.getWebResponse().getContentAsString());
+    	
+    	HtmlInput htmlInput = (HtmlInput) renderedView.getHtmlElementById(input.getClientId(facesContext));
+    	htmlInput.setValueAttribute("testInput");
+    	
+    	HtmlAnchor htmlLink = (HtmlAnchor) renderedView.getHtmlElementById(command.getClientId(facesContext));
+    	htmlLink.click();
+
+    	List lastParameters = this.webConnection.getLastParameters();
+    	for (Iterator iterator = lastParameters.iterator(); iterator.hasNext();) {
+			KeyValuePair keyValue = (KeyValuePair) iterator.next();
+			
+			externalContext.addRequestParameterMap((String) keyValue.getKey(), (String) keyValue.getValue());
+		}
+    	
+    	System.out.println(this.webConnection.getLastParameters());
+    	
+    	UIViewRoot root = facesContext.getViewRoot();
+    	root.processDecodes(facesContext);
+    	root.processValidators(facesContext);
+    	root.processUpdates(facesContext);
+    	root.processApplication(facesContext);
+    	
+    	renderedView = renderView();
+    	System.out.println(renderedView.getWebResponse().getContentAsString());
+    }
+    
+    public void testProcess() {
+    }
+}




More information about the richfaces-svn-commits mailing list