Author: alexsmirnov
Date: 2007-06-28 17:59:51 -0400 (Thu, 28 Jun 2007)
New Revision: 1395
Added:
branches/refactor1/framework/api/target/
branches/refactor1/framework/api/target/classes/
branches/refactor1/framework/impl/src/main/java/org/richfaces/
branches/refactor1/framework/test/
branches/refactor1/framework/test/.svnignore
branches/refactor1/framework/test/pom.xml
branches/refactor1/framework/test/src/
branches/refactor1/framework/test/src/main/
branches/refactor1/framework/test/src/main/java/
branches/refactor1/framework/test/src/main/java/org/
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/AbstractAjax4JsfTestCase.java
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/AbstractThreadedAjax4JsfTestCase.java
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockAjax4JsfLifecycle.java
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockFacesResourceContext.java
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockMethodBinding.java
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockUIInputRenderer.java
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockValueBinding.java
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockViewHandler.java
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockViewRoot.java
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/org/
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/org/apache/
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/org/apache/shale/
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/org/apache/shale/test/
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/org/apache/shale/test/config/
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/org/apache/shale/test/config/ConfigParser.java
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/xml/
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/xml/FacesEntityResolver.java
branches/refactor1/framework/test/src/main/resources/
branches/refactor1/framework/test/src/main/resources/WEB-INF/
branches/refactor1/framework/test/src/main/resources/WEB-INF/complex-web.xml
branches/refactor1/framework/test/src/main/resources/WEB-INF/web.xml
branches/refactor1/framework/test/src/test/
branches/refactor1/framework/test/src/test/java/
branches/refactor1/framework/test/src/test/java/DnDScriptTest.java
branches/refactor1/framework/test/src/test/java/README.txt
branches/refactor1/framework/test/src/test/java/org/
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/ActionListenerTest.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/AllUIRepeatTests.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/DataAdaptorTestCase.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/MockComponentState.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/MockDataAdaptor.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/MockDataModel.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/MockRange.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/MockSerializableDataModel.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/RepeatTestCase.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/codec/
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/codec/CodecTest.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/codec/CodecTestSuite.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/ajax/
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/ajax/xmlfilter/
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/ajax/xmlfilter/AllTests.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/ajax/xmlfilter/CacheContentTest.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/ajax/xmlfilter/NekkoParserTest.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/renderer/
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/renderer/BeforeRendererListenerTestCase.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/renderer/ChameleonRenderKitImplTestCase.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/renderer/RenderTests.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/AllResourcesTests.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/CSSTemplateTestCase.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/InternetResourceServiceTestCase.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/MockCacheableResource.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/MockFilterConfig.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/MockResourceRequest.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/ParametersEncodingTestCase.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/ResourceServiceThreadsTestCase.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/skin/
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/skin/Bean.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/skin/SkinTestCase.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/skin/SkinTests.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/skin/SkinThreadsTestCase.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/skin/TestApplicationFactory.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/util/
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/util/config/
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/util/config/AllTests.java
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/util/config/WebXmlTest.java
branches/refactor1/framework/test/src/test/resources/
branches/refactor1/framework/test/src/test/resources/META-INF/
branches/refactor1/framework/test/src/test/resources/META-INF/skins/
branches/refactor1/framework/test/src/test/resources/META-INF/skins/DEFAULT.skin.properties
branches/refactor1/framework/test/src/test/resources/META-INF/skins/cyclic.skin.properties
branches/refactor1/framework/test/src/test/resources/META-INF/skins/noref.skin.properties
branches/refactor1/framework/test/src/test/resources/META-INF/skins/style.skin.properties
branches/refactor1/framework/test/src/test/resources/META-INF/skins/test.skin.properties
branches/refactor1/framework/test/src/test/resources/WEB-INF/
branches/refactor1/framework/test/src/test/resources/WEB-INF/complex-web.xml
branches/refactor1/framework/test/src/test/resources/WEB-INF/web.xml
branches/refactor1/framework/test/src/test/resources/bindedtest.skin.properties
branches/refactor1/framework/test/src/test/resources/log4j.xml
branches/refactor1/framework/test/src/test/resources/org/
branches/refactor1/framework/test/src/test/resources/org/ajax4jsf/
branches/refactor1/framework/test/src/test/resources/org/ajax4jsf/framework/
branches/refactor1/framework/test/src/test/resources/org/ajax4jsf/framework/resource/
branches/refactor1/framework/test/src/test/resources/org/ajax4jsf/framework/resource/call.xml
branches/refactor1/framework/test/src/test/resources/org/ajax4jsf/framework/resource/callWithParam.xml
branches/refactor1/framework/test/src/test/resources/org/ajax4jsf/framework/resource/styles.xml
branches/refactor1/framework/test/src/test/resources/org/ajax4jsf/framework/resource/test.js
branches/refactor1/framework/test/src/test/resources/oscache.properties
branches/refactor1/framework/test/src/test/resources/placeholder.txt
branches/refactor1/framework/test/src/test/resources/test.skin.properties
branches/refactor1/framework/test/src/test/resources/test.web.root
Removed:
branches/refactor1/ui/common/src/main/java/org/richfaces/
Modified:
branches/refactor1/framework/impl/pom.xml
branches/refactor1/framework/pom.xml
branches/refactor1/pom.xml
branches/refactor1/ui/assembly/pom.xml
branches/refactor1/ui/common/pom.xml
branches/refactor1/ui/dataFilterSlider/pom.xml
branches/refactor1/ui/dataTable/pom.xml
branches/refactor1/ui/datascroller/pom.xml
branches/refactor1/ui/drag-drop/pom.xml
branches/refactor1/ui/dropdown-menu/pom.xml
branches/refactor1/ui/gmap/pom.xml
branches/refactor1/ui/inputnumber-slider/pom.xml
branches/refactor1/ui/inputnumber-spinner/pom.xml
branches/refactor1/ui/menu-components/pom.xml
branches/refactor1/ui/modal-panel/pom.xml
branches/refactor1/ui/paint2D/pom.xml
branches/refactor1/ui/panel/pom.xml
branches/refactor1/ui/panelbar/pom.xml
branches/refactor1/ui/pom.xml
branches/refactor1/ui/separator/pom.xml
branches/refactor1/ui/simpleTogglePanel/pom.xml
branches/refactor1/ui/spacer/pom.xml
branches/refactor1/ui/suggestionbox/pom.xml
branches/refactor1/ui/tabPanel/pom.xml
branches/refactor1/ui/togglePanel/pom.xml
branches/refactor1/ui/toolBar/pom.xml
branches/refactor1/ui/tree/pom.xml
Log:
continue refactoring
Modified: branches/refactor1/framework/impl/pom.xml
===================================================================
--- branches/refactor1/framework/impl/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/framework/impl/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -114,6 +114,11 @@
<artifactId>commons-collections</artifactId>
<version>3.2</version>
</dependency>
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
<profiles>
<profile>
Copied: branches/refactor1/framework/impl/src/main/java/org/richfaces (from rev 1393,
branches/refactor1/ui/common/src/main/java/org/richfaces)
Modified: branches/refactor1/framework/pom.xml
===================================================================
--- branches/refactor1/framework/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/framework/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -7,7 +7,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.richfaces</groupId>
- <artifactId>cdk</artifactId>
+ <artifactId>framework</artifactId>
<packaging>pom</packaging>
<name>Java Server Faces AJAX framework</name>
<dependencies />
Added: branches/refactor1/framework/test/.svnignore
===================================================================
--- branches/refactor1/framework/test/.svnignore (rev 0)
+++ branches/refactor1/framework/test/.svnignore 2007-06-28 21:59:51 UTC (rev 1395)
@@ -0,0 +1 @@
+target
Added: branches/refactor1/framework/test/pom.xml
===================================================================
--- branches/refactor1/framework/test/pom.xml (rev 0)
+++ branches/refactor1/framework/test/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -0,0 +1,76 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>framework</artifactId>
+ <groupId>org.richfaces</groupId>
+ <version>3.1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>test</artifactId>
+ <name>Ajax4Jsf test framework</name>
+ <url>https://ajax4jsf.dev.java.net</url>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shale</groupId>
+ <artifactId>shale-test</artifactId>
+ <version>1.0.4</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.myfaces</groupId>
+ <artifactId>myfaces-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.myfaces</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>myfaces</groupId>
+ <artifactId>myfaces-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>myfaces</groupId>
+ <artifactId>myfaces-impl</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>htmlunit</groupId>
+ <artifactId>htmlunit</artifactId>
+ <version>1.10</version>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymock</artifactId>
+ <version>2.2</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ <version>2.2.1</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>2.0</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added:
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/AbstractAjax4JsfTestCase.java
===================================================================
---
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/AbstractAjax4JsfTestCase.java
(rev 0)
+++
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/AbstractAjax4JsfTestCase.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,477 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.tests;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Random;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import javax.faces.FacesException;
+import javax.faces.FactoryFinder;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.render.RenderKitFactory;
+import javax.faces.render.Renderer;
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+
+import org.ajax4jsf.framework.ajax.AjaxContext;
+import org.ajax4jsf.framework.renderer.AjaxViewRootRenderer;
+import org.ajax4jsf.framework.renderer.ChameleonRenderKitImpl;
+import org.ajax4jsf.framework.resource.InternetResource;
+import org.ajax4jsf.framework.resource.InternetResourceBuilder;
+import org.ajax4jsf.framework.skin.SkinBean;
+import org.ajax4jsf.framework.skin.SkinFactory;
+import org.ajax4jsf.framework.skin.VersionBean;
+import org.ajax4jsf.framework.util.config.WebXml;
+import org.ajax4jsf.tests.org.apache.shale.test.config.ConfigParser;
+import org.apache.shale.test.base.AbstractJsfTestCase;
+import org.apache.shale.test.mock.MockPrintWriter;
+import org.apache.shale.test.mock.MockResponseWriter;
+import org.apache.shale.test.mock.MockServletOutputStream;
+
+import com.gargoylesoftware.htmlunit.MockWebConnection;
+import com.gargoylesoftware.htmlunit.Page;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.WebRequestSettings;
+import com.gargoylesoftware.htmlunit.WebResponse;
+import com.gargoylesoftware.htmlunit.WebResponseData;
+import com.gargoylesoftware.htmlunit.WebResponseImpl;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+
+/**
+ * Base class for testing components and renderers in a4j framework
+ * Simulate a4j environment for perform requests.
+ * For concrete tests MUST be overriden setUp/tearDown methods, even if no actions
+ * performed - it need for junit initializations.
+ * All output html collected and can be checked by htmlunit
+ * @author shura (latest modification by $Author: ishabalov $)
+ * @version $Revision: 1.1.2.5 $ $Date: 2007/02/20 20:58:08 $
+ *
+ */
+public class AbstractAjax4JsfTestCase extends AbstractJsfTestCase {
+
+ protected final static String SLASHED_RESOURCE_URI_PREFIX = "/" +
WebXml.RESOURCE_URI_PREFIX;
+
+ private File tmpRoot = null;
+
+ /**
+ * @param name
+ */
+ public AbstractAjax4JsfTestCase(String name) {
+ super(name);
+ // TODO Auto-generated constructor stub
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.shale.test.base.AbstractJsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ // This method MUST BE OVERRIDEN in any subclasses - since Junit see for it in class
for call
+ super.setUp();
+
+ // Setup FacesContext with nessesary init parameters.
+ this.servletContext.addInitParameter(SkinFactory.SKIN_PARAMETER, getSkinName());
+ // setup VCP renderKit, create renderers.
+ RenderKitFactory vcpRenderKitFactory = (RenderKitFactory)
FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
+ vcpRenderKit = new ChameleonRenderKitImpl();
+ vcpRenderKitFactory.addRenderKit("HTML_CHAMELEON", vcpRenderKit);
+ renderKit.addRenderer(UIViewRoot.COMPONENT_FAMILY, UIViewRoot.COMPONENT_TYPE, new
AjaxViewRootRenderer());
+ // setup nessesary components.
+ application.addComponent("javax.faces.ViewRoot",
MockViewRoot.class.getName());
+ // setup AjaxContext.
+ ajaxContext = new AjaxContext();
+ request.setAttribute(AjaxContext.AJAX_CONTEXT_KEY, ajaxContext);
+ // Setup ViewHandler / ViewRoot.
+ application.setViewHandler(new MockViewHandler(application.getViewHandler()));
+ facesContext.setViewRoot(application.getViewHandler().createView(facesContext,
facesContext.getViewRoot().getViewId()));
+ // Setup Skin avd version variables.
+ servletContext.setAttribute("a4j", new VersionBean());
+ servletContext.setAttribute("a4jSkin", new SkinBean());
+ // Setup servlet context and testing web.xml
+ request.setPathElements("/testContext","/faces","/vievId.jsf","");
+
+ File webRoot = new
File(getClass().getResource("/WEB-INF/web.xml").getFile()).getParentFile().getParentFile();
+ if (webRoot.exists()) {
+ servletContext.setDocumentRoot(webRoot);
+ } else {
+ // Prepare WEB-ROOT in temp folder
+ tmpRoot = File.createTempFile("TmpTestRoot" + new Random().nextInt(),
null);
+ tmpRoot.delete();
+ tmpRoot.mkdir();
+ servletContext.setDocumentRoot(tmpRoot);
+
+ URL jarUrl =
AbstractAjax4JsfTestCase.class.getProtectionDomain().getCodeSource().getLocation();
+ ZipInputStream zis = new ZipInputStream(jarUrl.openStream());
+ try {
+ ZipEntry entry;
+ byte[] buffer = new byte[8192];
+ while ((entry = zis.getNextEntry()) != null) {
+ String name = entry.getName();
+ if (name.startsWith("WEB-INF/")) {
+ File out = new File(tmpRoot, name);
+ if (entry.isDirectory()) {
+ out.mkdirs();
+ } else {
+ out.getParentFile().mkdirs();
+ OutputStream os = new FileOutputStream(out);
+ try {
+ int count;
+ while ((count = zis.read(buffer)) > 0) {
+ os.write(buffer, 0, count);
+ }
+ } finally {
+ os.close();
+ }
+ zis.closeEntry();
+ }
+ }
+ }
+ } catch (IOException e) {
+ deleteRecursively(tmpRoot);
+ throw e;
+ }
+ servletContext.setDocumentRoot(tmpRoot);
+ }
+
+ try {
+ InternetResourceBuilder.getInstance().init();
+ } catch (FacesException e) {
+ InternetResourceBuilder.setInstance(null);
+ }
+ webXml = new WebXml();
+ webXml.init(servletContext, "A4J");
+
+ ConfigParser parser = new ConfigParser();
+ parser.parse(parser.getPlatformURLs());
+
+ Enumeration resources =
getClass().getClassLoader().getResources("META-INF/faces-config.xml");
+ while (resources.hasMoreElements()) {
+ parser.parse((URL) resources.nextElement());
+ }
+ }
+
+ protected WebClient createWebClient() {
+ WebClient client = new WebClient();
+ //disable javascript for now as HtmlUnit doesn't treat prototype.js well
+ client.setJavaScriptEnabled(false);
+
+ return client;
+ }
+
+ /**
+ *
+ */
+ protected void setupWebClient() {
+ ajaxContext = null;
+ // setup webClient for got response content.
+ webClient = createWebClient();
+ webConnection = new MockWebConnection(webClient) {
+ public WebResponse getResponse(WebRequestSettings settings)
+ throws IOException {
+ String testResourceContextPath =
facesContext.getExternalContext().getRequestContextPath() +
+ AbstractAjax4JsfTestCase.SLASHED_RESOURCE_URI_PREFIX;
+ if (settings.getURL().getFile().startsWith(testResourceContextPath)) {
+ String uri =
settings.getURL().getFile().substring(testResourceContextPath.length());
+
+ InternetResourceBuilder resourceBuilder = InternetResourceBuilder.getInstance();
+
+ InternetResource resource = resourceBuilder.getResourceForKey(uri);
+ Object resourceData = resourceBuilder.getResourceDataForKey(uri);
+
+ final MockFacesResourceContext resourceContext = new
MockFacesResourceContext(facesContext);
+ resourceContext.setResourceData(resourceData);
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ response.setOutputStream(new MockServletOutputStream(baos));
+
+ resource.sendHeaders(resourceContext);
+ resource.send(resourceContext);
+
+ return new WebResponseImpl(
+ new WebResponseData(
+ new ByteArrayInputStream(baos.toByteArray()),
+ HttpServletResponse.SC_OK,
+ "OK",
+ resourceContext.getHeaders()),
+ settings.getURL(),
+ settings.getSubmitMethod(),
+ 0) {
+
+ public String getContentType() {
+ return resourceContext.getContentType();
+ }
+ };
+
+ } else {
+ return super.getResponse(settings);
+ }
+ }
+ };
+ webClient.setWebConnection(webConnection);
+ webConnection.setDefaultResponse("<html><body>not
found</body></html>",404,"NOT FOUND","text/html");
+ webClient.setThrowExceptionOnFailingStatusCode(false);
+ webClient.setThrowExceptionOnScriptError(false);
+ }
+
+ private void deleteRecursively(File file) {
+ if (file != null) {
+
+ String[] list = file.list();
+ if (list != null) {
+ for (int i = 0; i < list.length; i++) {
+ String name = list[i];
+ File f = new File(file, name);
+ if (f.isDirectory()) {
+ deleteRecursively(f);
+ } else {
+ f.delete();
+ }
+ }
+ }
+
+ file.delete();
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.shale.test.base.AbstractJsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ // This method MUST BE OVERRIDEN in any subclasses - since Junit see for it in class
for call
+ super.tearDown();
+ vcpRenderKit = null;
+// Thread.currentThread().setContextClassLoader(threadContextClassLoader);
+// threadContextClassLoader = null;
+ webClient = null;
+ webConnection = null;
+ writer = null;
+ SkinFactory.reset();
+ InternetResourceBuilder.setInstance(null);
+
+ deleteRecursively(tmpRoot);
+ }
+
+ // Protected configurations URL's
+ /**
+ * Hook method for setup current VCP skin name for test. default use
"classic"
+ * @return
+ */
+ protected String getSkinName() {
+ return "DEFAULT";
+ }
+
+ /**
+ * Hook method for load diffrernt frameworks for this test.
+ * Can return URL's for jars with tested implementation.
+ * @return
+ */
+ protected URL[] getImplementationUrls() {
+ return new URL[0];
+ }
+
+ /**
+ * Create component with given render kit and unique Id from ViewRoot.
+ * @param type - component type.
+ * @param clazz - class of component.
+ * @param rendererType - name for renderer type ( can be null ).
+ * @param rendererClazz - class of renderer in HTMP_BASIC renderkit. If not null,
renderer will created and registered.
+ * @param skinRendererClazz - class of renderer in Skin render-kit.
+ * @return component instance.
+ * @throws Exception
+ */
+ protected UIComponent createComponent(String type, String className, String
rendererType, Class rendererClazz,Class skinRendererClazz) {
+ UIComponent comp;
+ try {
+ comp = application.createComponent(type);
+ } catch (FacesException e) {
+ application.addComponent(type, className);
+ comp = application.createComponent(type);
+ }
+ comp.setRendererType(rendererType);
+ String family = comp.getFamily();
+ if (null != rendererClazz) {
+ Renderer renderer = renderKit.getRenderer(family, rendererType);
+ if (null == renderer) {
+ try {
+ renderer = (Renderer) rendererClazz.newInstance();
+ } catch (InstantiationException e) {
+ assertTrue("Instantiation exception for create renderer
"+rendererClazz.getName(),false);
+ } catch (IllegalAccessException e) {
+ assertTrue("ILEGAL access exception for create renderer
"+rendererClazz.getName(),false);
+ }
+ renderKit.addRenderer(family, rendererType, renderer);
+ }
+ }
+ if(null != skinRendererClazz) {
+ Renderer renderer = renderKit.getRenderer(family, rendererType);
+ if (null == renderer) {
+ try {
+ renderer = (Renderer) skinRendererClazz.newInstance();
+ } catch (InstantiationException e) {
+ assertTrue("Instantiation exception for create renderer
"+skinRendererClazz.getName(),false);
+ } catch (IllegalAccessException e) {
+ assertTrue("ILEGAL access exception for create renderer
"+skinRendererClazz.getName(),false);
+ }
+ vcpRenderKit.addRenderer(family, rendererType, renderer);
+ }
+ }
+ comp.setId(facesContext.getViewRoot().createUniqueId());
+ return comp;
+ }
+
+
+ /**
+ * Render all children for given component.
+ * @param component
+ * @throws IOException
+ */
+ protected void renderChildren(FacesContext context,
+ UIComponent component) throws IOException {
+ if (component.getChildCount() > 0) {
+ for (Iterator it = component.getChildren().iterator(); it.hasNext();) {
+ UIComponent child = (UIComponent) it.next();
+ renderChild(context,child);
+ }
+ }
+ }
+
+
+ /**
+ * Render one component and it childrens
+ * @param child
+ * @throws IOException
+ */
+ protected void renderChild(FacesContext context, UIComponent child)
+ throws IOException {
+ if (!child.isRendered()) {
+ return;
+ }
+
+ child.encodeBegin(context);
+ if (child.getRendersChildren()) {
+ child.encodeChildren(context);
+ } else {
+ renderChildren(context, child);
+ }
+ child.encodeEnd(context);
+ }
+
+ /**
+ * Render test view and parse to htmlunit page structure.
+ * @return
+ * @throws Exception
+ */
+ protected HtmlPage renderView() throws Exception {
+ setupResponseWriter();
+ renderChild(facesContext, facesContext.getViewRoot());
+ return processResponseWriter();
+ }
+
+ /**
+ * Finish response processing by call {@link
javax.faces.context.ResponseWriter#endDocument()} and parse
+ * result to htmlunit {@link HtmlPage}
+ * @return
+ * @throws IOException
+ * @throws Exception
+ */
+ protected HtmlPage processResponseWriter() throws IOException, Exception {
+ writer.endDocument();
+ return (HtmlPage) processResponse();
+ }
+
+ /**
+ * Setup Faces {@link javax.faces.context.ResponseWriter} and prepare rendering (
startDocument ).
+ * after this method, any jsf rendering methods can be performed, and results can be
checked by {@link #processResponseWriter()}
+ * @throws IOException
+ */
+ protected void setupResponseWriter() throws IOException {
+ writer = (MockResponseWriter)
renderKit.createResponseWriter(response.getWriter(),"text/html",null);
+ facesContext.setResponseWriter(writer);
+ writer.startDocument();
+ }
+
+ /**
+ * Parse collected content of mock response to Page instance, used for check rendered
html.
+ * @return
+ * @throws Exception
+ */
+ protected Page processResponse() throws Exception {
+ setupWebClient();
+ URL page = new URL( "http:"+
facesContext.getExternalContext().getRequestContextPath() +
facesContext.getViewRoot().getViewId());
+ try {
+ char[] content = ((MockPrintWriter) response.getWriter()).content();
+ webConnection.setResponse(page,String.valueOf(content),response.getStatus(),
"OK", response.getContentType(), Collections.EMPTY_LIST);
+ } catch (IllegalStateException e) {
+ byte[] content = ((MockServletOutputStream)response.getOutputStream()).content();
+ webConnection.setResponse(page,content, response.getStatus(), "OK",
response.getContentType(), Collections.EMPTY_LIST);
+ }
+ return webClient.getPage(page);
+ }
+
+ protected AjaxContext ajaxContext = null;
+
+ /**
+ * Initialised instance of VCP render kit.
+ */
+ protected ChameleonRenderKitImpl vcpRenderKit = null;
+
+ /**
+ * Instance of Mock {@link javax.faces.context.ResponseWriter} , created by
setupResponseWriter
+ */
+ protected MockResponseWriter writer;
+
+ /**
+ * <p>The htmlunit web client for this test case. </p>
+ *
+ */
+ protected WebClient webClient = null;
+
+ /**
+ * Mock web connection for accept stored content of JSF encoding. For testing JavaScript
code, all URL's for scripts must be
+ * rregistered by {@link MockWebConnection#setResponse(java.net.URL, byte[], int,
java.lang.String, java.lang.String, java.util.List)} method
+ * By default, for unregistered pages return 404 - not found.
+ */
+ protected MockWebConnection webConnection = null;
+
+
+ // Thread context class loader saved and restored after each test
+ private ClassLoader threadContextClassLoader = null;
+
+ protected WebXml webXml;
+
+}
Added:
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/AbstractThreadedAjax4JsfTestCase.java
===================================================================
---
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/AbstractThreadedAjax4JsfTestCase.java
(rev 0)
+++
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/AbstractThreadedAjax4JsfTestCase.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,234 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.tests;
+
+import javax.faces.context.FacesContext;
+
+import junit.framework.AssertionFailedError;
+import junit.framework.TestResult;
+
+import org.ajax4jsf.framework.ajax.AjaxContext;
+import org.apache.shale.test.mock.MockFacesContext;
+import org.apache.shale.test.mock.MockHttpServletRequest;
+import org.apache.shale.test.mock.MockHttpServletResponse;
+import org.apache.shale.test.mock.MockHttpSession;
+
+/**
+ * @author asmirnov(a)exadel.com (latest modification by $Author: ishabalov $)
+ * @version $Revision: 1.1.2.3 $ $Date: 2007/02/20 20:58:08 $
+ *
+/**
+ * A multi-threaded JUnit test case, with setup faces environment.
+ * To perform test cases that spin off threads to do tests: <p>
+ * <UL>
+ * <LI>Extend <code>MultiThreadedTestCase</code>
+ * <LI>Write your tests cases as normal except for when you want to spin off
threads.
+ * <LI>When you want to spin off threads:
+ * <UL>
+ * <LI>Instead of implementing <code>Runnable</code> extend
<code>MultiThreadedTestCase.TestCaseRunnable</code>.
+ * <LI>Define <code>runTestCase ()</code> to do your test, you may call
<code>fail (), assert ()</code> etc. and throw
+ * exceptions with impunity.
+ * <LI>Handle thread interrupts by finishing.
+ * </UL>
+ * <LI>Instantiate all the runnables (one for each thread you wish to spawn) and
pass an array of them
+ * to <code>runTestCaseRunnables ()</code>.
+ * </UL>
+ * That's it. An example is below:
+ * <PRE>
+ * public class MTTest extends ThreadedVcpJsfTestCase
+ * {
+ * MTTest (String s) { super (s); }
+ * public class CounterThread extends TestCaseRunnable
+ * {
+ * public void runTestCase (FacesContext context) throws Throwable
+ * {
+ * for (int i = 0; i < 1000; i++)
+ * {
+ * System.out.println ("Counter Thread: " + Thread.currentThread () +
" : " + i);
+ * // Do some testing...
+ * if (Thread.currentThread ().isInterrupted ()) {
+ * return;
+ * }
+ * }
+ * }
+ * }
+ *
+ * public void test1 ()
+ * {
+ * TestCaseRunnable tct [] = new TestCaseRunnable [5];
+ * for (int i = 0; i < 5; i++)
+ * {
+ * tct[i] = new CounterThread ();
+ * }
+ * runTestCaseRunnables (tct);
+ * }
+ * }
+ * </PRE>
+ * <BR><STRONG>Category: Test</STRONG>
+ * <BR><STRONG>Not guaranteed to be thread safe.</STRONG>
+*/
+public class AbstractThreadedAjax4JsfTestCase extends AbstractAjax4JsfTestCase {
+
+ /**
+ * The threads that are executing.
+ */
+ private Thread threads[] = null;
+ /**
+ * The tests TestResult.*/
+ private TestResult testResult = null;
+ /**
+ * Simple constructor.
+ */
+
+ public AbstractThreadedAjax4JsfTestCase(String s) {
+ super(s);
+ }
+ /**
+ * Interrupt the running threads.
+ */
+
+ public void interruptThreads() {
+ if(threads != null) {
+ for(int i = 0;i < threads.length;i++) {
+ threads[i].interrupt();
+ }
+ }
+ }
+ /**
+ * Override run so we can squirrel away the test result.*/
+
+ public void run(final TestResult result) {
+ testResult = result;
+ super.run(result);
+ testResult = null;
+ }
+
+ /**
+ * Create instances of classes and run threads with it.
+ * @param clazz - class of test thread implementation.
+ * @param numThreads - number of threads to run.
+ * @throws InstantiationException
+ * @throws IllegalAccessException
+ */
+ protected void runTestCaseThreads(Class clazz, int numThreads) {
+ TestCaseRunnable[] runnables = new TestCaseRunnable[numThreads];
+ for (int i = 0; i < runnables.length; i++) {
+ try {
+ runnables[i]= (TestCaseRunnable) clazz.newInstance();
+ } catch (Exception e) {
+ testResult.addError(this, e);
+ return;
+ }
+ }
+ runTestCaseRunnables(runnables);
+ }
+ /**
+ * Run the test case threads.
+ * @param runnables - array with instances of {@link TestCaseRunnable} with concrete
tests
+ */
+ protected void runTestCaseRunnables (final TestCaseRunnable[] runnables) {
+ if(runnables == null) {
+ throw new IllegalArgumentException("runnables is null");
+ }
+ threads = new Thread[runnables.length];
+ for(int i = 0;i < threads.length;i++) {
+ threads[i] = new Thread(runnables[i]);
+ }
+ for(int i = 0;i < threads.length;i++) {
+ threads[i].start();
+ }
+ try {
+ for(int i = 0;i < threads.length;i++) {
+ threads[i].join();
+ }
+ }
+ catch(InterruptedException ignore) {
+ System.out.println("Thread join interrupted.");
+ }
+ threads = null;
+ }
+ /**
+ * Handle an exception. Since multiple threads won't have their
+ * exceptions caught the threads must manually catch them and call
+ * <code>handleException ()</code>.
+ * @param t Exception to handle.*/
+
+ private void handleException(final Throwable t) {
+ synchronized(testResult) {
+ if(t instanceof AssertionFailedError) {
+ testResult.addFailure(this, (AssertionFailedError)t);
+ }
+ else {
+ testResult.addError(this, t);
+ }
+ }
+ }
+
+ /**
+ * A test case thread. Override runTestCase () and define
+ * behaviour of test in there.*/
+ public abstract class TestCaseRunnable implements Runnable {
+ /**
+ * Override this to define the test*/
+
+ public abstract void runTestCase(FacesContext context)
+ throws Throwable;
+ /**
+ * Run the test in an environment where
+ * we can handle the exceptions generated by the test method.*/
+
+ public void run() {
+ FacesContext context = null;
+ try {
+ context = createFacesContext();
+ runTestCase(context);
+ }
+ catch(Throwable t) /* Any other exception we handle and then we interrupt the
other threads.*/ {
+ handleException(t);
+ interruptThreads();
+ } finally {
+ if(null != context) {
+ context.release();
+ }
+ }
+ }
+ }
+
+ /**
+ * Create instance of faces context for current thread.
+ * @return
+ */
+ protected FacesContext createFacesContext() {
+ MockHttpSession tsession = new MockHttpSession();
+ MockHttpServletRequest trequest = new MockHttpServletRequest(tsession);
+ trequest.setAttribute(AjaxContext.AJAX_CONTEXT_KEY, new AjaxContext());
+ MockHttpServletResponse tresponse = new MockHttpServletResponse();
+ MockFacesContext tfacesContext = (MockFacesContext)
+ facesContextFactory.getFacesContext(servletContext,
+ trequest,
+ tresponse,
+ lifecycle);
+ tfacesContext.setApplication(application);
+ tfacesContext.setViewRoot(application.getViewHandler().createView(facesContext,
facesContext.getViewRoot().getViewId()));
+ return tfacesContext;
+ }
+}
Added:
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockAjax4JsfLifecycle.java
===================================================================
---
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockAjax4JsfLifecycle.java
(rev 0)
+++
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockAjax4JsfLifecycle.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,39 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.tests;
+
+import javax.faces.context.FacesContext;
+
+import org.apache.shale.test.mock.MockLifecycle;
+
+/**
+ * @author asmirnov(a)exadel.com (latest modification by $Author: ishabalov $)
+ * @version $Revision: 1.1.2.2 $ $Date: 2007/02/20 20:58:08 $
+ *
+ */
+public class MockAjax4JsfLifecycle extends MockLifecycle {
+
+ public void processAll(FacesContext context) {
+
+ }
+
+}
Added:
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockFacesResourceContext.java
===================================================================
---
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockFacesResourceContext.java
(rev 0)
+++
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockFacesResourceContext.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,90 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.tests;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.framework.resource.FacesResourceContext;
+import org.apache.shale.test.mock.MockHttpServletResponse;
+
+import com.gargoylesoftware.htmlunit.KeyValuePair;
+
+/**
+ * @author Nick - mailto:nbelaevski@exadel.com
+ * created 03.04.2007
+ *
+ */
+public class MockFacesResourceContext extends FacesResourceContext {
+
+ private String contentType;
+ //used to encode headers properly
+ private MockHttpServletResponse mockResponse = new MockHttpServletResponse();
+ private Set headerSet = new LinkedHashSet();
+
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
+
+ public String getContentType() {
+ return contentType;
+ }
+
+ public void setDateHeader(String name, long value) {
+ headerSet.add(name);
+ mockResponse.setDateHeader(name, value);
+ }
+
+ public void setHeader(String name, String value) {
+ headerSet.add(name);
+ mockResponse.setHeader(name, value);
+ }
+
+ public void setIntHeader(String name, int value) {
+ headerSet.add(name);
+ mockResponse.setIntHeader(name, value);
+ }
+
+ public List getHeaders() {
+ List headers = new ArrayList();
+ for (Iterator iterator = headerSet.iterator(); iterator
+ .hasNext();) {
+ String headerName = (String) iterator.next();
+
+ String headerValue = mockResponse.getHeader(headerName);
+ if (headerValue != null) {
+ headers.add(new KeyValuePair(headerName, headerValue));
+ }
+ }
+
+ return headers;
+ }
+
+ public MockFacesResourceContext(FacesContext facesContext) {
+ super(facesContext);
+ }
+
+}
Added:
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockMethodBinding.java
===================================================================
---
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockMethodBinding.java
(rev 0)
+++
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockMethodBinding.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,87 @@
+/**
+ * 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.ajax4jsf.tests;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.context.FacesContext;
+import javax.faces.el.EvaluationException;
+import javax.faces.el.MethodBinding;
+import javax.faces.el.MethodNotFoundException;
+
+/**
+ * @author Nick - mailto:nbelaevski@exadel.com
+ * created 09.04.2007
+ *
+ */
+public class MockMethodBinding extends MethodBinding {
+
+ private Class returnType;
+ private MethodResult result;
+
+ private List invocationArgs = new ArrayList();
+
+ public static interface MethodResult {
+ public Object invoke(FacesContext facesContext, Object[] args, Class returnType);
+ }
+
+ public MockMethodBinding() {
+ this(null, null);
+ }
+
+ public MockMethodBinding(Class returnType, MethodResult result) {
+ super();
+ this.returnType = returnType;
+ this.result = result;
+ }
+
+ public Class getType(FacesContext context) throws MethodNotFoundException {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ return returnType;
+ }
+
+ public Object invoke(FacesContext context, Object[] params)
+ throws EvaluationException, MethodNotFoundException {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ invocationArgs.add(params);
+ if (result != null) {
+ return result.invoke(context, params, returnType);
+ }
+
+ return null;
+ }
+
+ public void clear() {
+ invocationArgs.clear();
+ }
+
+ public Object[][] getInvocationArgs() {
+ return (Object[][]) invocationArgs.toArray(new Object[invocationArgs.size()][]);
+ }
+}
Added:
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockUIInputRenderer.java
===================================================================
---
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockUIInputRenderer.java
(rev 0)
+++
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockUIInputRenderer.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,32 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.tests;
+
+import javax.faces.render.Renderer;
+
+/**
+ * @author shura
+ *
+ */
+public class MockUIInputRenderer extends Renderer {
+
+}
Added:
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockValueBinding.java
===================================================================
---
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockValueBinding.java
(rev 0)
+++
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockValueBinding.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,74 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.tests;
+
+import javax.faces.context.FacesContext;
+import javax.faces.el.EvaluationException;
+import javax.faces.el.PropertyNotFoundException;
+import javax.faces.el.ValueBinding;
+
+/**
+ * @author Nick Belaevski - nbelaevski(a)exadel.com
+ * created 13.04.2007
+ *
+ */
+public class MockValueBinding extends ValueBinding {
+
+ private Class clazz;
+ private Object value;
+
+ public MockValueBinding(Object value, Class clazz) {
+ super();
+ this.clazz = clazz;
+ this.value = value;
+ }
+
+ public Class getType(FacesContext context) throws EvaluationException,
+ PropertyNotFoundException {
+ return clazz;
+ }
+
+ public Object getValue(FacesContext context) throws EvaluationException,
+ PropertyNotFoundException {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ return value;
+ }
+
+ public boolean isReadOnly(FacesContext context) throws EvaluationException,
+ PropertyNotFoundException {
+ return false;
+ }
+
+ public void setValue(FacesContext context, Object value)
+ throws EvaluationException, PropertyNotFoundException {
+
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ this.value = value;
+ }
+
+}
Added:
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockViewHandler.java
===================================================================
---
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockViewHandler.java
(rev 0)
+++
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockViewHandler.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,41 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.tests;
+
+import java.io.IOException;
+
+import javax.faces.application.ViewHandler;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.framework.ajax.AjaxViewHandler;
+
+public class MockViewHandler extends AjaxViewHandler {
+
+ public MockViewHandler(ViewHandler parent) {
+ super(parent);
+ }
+
+ public void writeState(FacesContext context) throws IOException {
+ //System.out.println(".writeState()");
+ }
+
+}
\ No newline at end of file
Added:
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockViewRoot.java
===================================================================
--- branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockViewRoot.java
(rev 0)
+++
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/MockViewRoot.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,49 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.tests;
+
+import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseId;
+
+import org.ajax4jsf.framework.ajax.AjaxViewRoot;
+import org.apache.commons.collections.Buffer;
+
+/**
+ * @author Nick - mailto:nbelaevski@exadel.com
+ * created 08.04.2007
+ *
+ */
+public class MockViewRoot extends AjaxViewRoot {
+
+ public Buffer getAjaxEventsQueue(FacesContext context) {
+ return super.getAjaxEventsQueue(context);
+ }
+
+ public Buffer[] getEvents(FacesContext context) {
+ return super.getEvents(context);
+ }
+
+ public Buffer getEventsQueue(FacesContext context, PhaseId phase) {
+ return super.getEventsQueue(context, phase);
+ }
+
+}
Added:
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/org/apache/shale/test/config/ConfigParser.java
===================================================================
---
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/org/apache/shale/test/config/ConfigParser.java
(rev 0)
+++
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/org/apache/shale/test/config/ConfigParser.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,507 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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
+ */
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.ajax4jsf.tests.org.apache.shale.test.config;
+
+import java.io.IOException;
+import java.net.URL;
+import javax.faces.FactoryFinder;
+import javax.faces.application.Application;
+import javax.faces.application.ApplicationFactory;
+import javax.faces.render.RenderKit;
+import javax.faces.render.RenderKitFactory;
+import javax.faces.render.Renderer;
+
+import org.ajax4jsf.tests.xml.FacesEntityResolver;
+import org.apache.commons.digester.Digester;
+import org.apache.commons.digester.Rule;
+import org.apache.shale.test.mock.MockRenderKit;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * <p>Utility class to parse JavaServer Faces configuration resources, and
+ * register JSF artifacts with the mock object hierarchy.</p>
+ *
+ * <p>The following artifacts are registered:</p>
+ * <ul>
+ * <li><code>Converter</code> (by-id and by-class)</li>
+ * <li><code>RenderKit</code> and
<code>Renderer</code></li>
+ * <li><code>UIComponent</code></li>
+ * <li><code>Validator</code></li>
+ * </ul>
+ *
+ * <p>Note that any declared <em>factory</em> instances are explicitly
+ * <strong>NOT</strong> registered, allowing the mock object hierarchy
+ * of the Shale Test Framework to manage these APIs.</p>
+ *
+ * <p><strong>USAGE NOTE</strong> - If you are using an instance of
this
+ * class within a subclass of <code>AbstractJsfTestCase</code> or
+ * <code>AbstractJmockJsfTestCase</code>, be sure you have completed the
+ * <code>setUp()</code> processing in this base class before calling one
+ * of the <code>parse()</code> methods.</p>
+ *
+ * @since 1.1
+ */
+public final class ConfigParser {
+
+
+ // ------------------------------------------------------------ Constructors
+
+
+ /** Creates a new instance of ConfigParser */
+ public ConfigParser() {
+ }
+
+
+ // ------------------------------------------------------ Manifest Constants
+
+
+ /**
+ * <p>Configuration resource URLs for the JSF RI.</p>
+ */
+ private static final String[] JSFRI_RESOURCES =
+ { "/com/sun/faces/jsf-ri-runtime.xml",
+ };
+
+
+ /**
+ * <p>Configuration resource URLs for Apache MyFaces.</p>
+ */
+ private static final String[] MYFACES_RESOURCES =
+ { "/org/apache/myfaces/resource/standard-faces-config.xml",
+ };
+
+
+ // ------------------------------------------------------ Instance Variables
+
+
+ /**
+ * <p>The <code>Digester</code> instance we will use for
parsing.</p>
+ */
+ private Digester digester = null;
+
+
+ // ------------------------------------------------------- Public Properties
+
+
+ /**
+ * <p>Return the URLs of the platform configuration resources for this
+ * application. The following platforms are currently supported:</p>
+ * <ul>
+ * <li>JavaServer Faces Reference Implementation (version 1.0 -
1.2)</li>
+ * <li>MyFaces (version 1.1)</li>
+ * </ul>
+ *
+ * <p>If MyFaces (version 1.2), currently under development, does not change
+ * the name of the configuration resource, it will be supported as well.</p>
+ */
+ public URL[] getPlatformURLs() {
+
+ URL[] urls = translate(JSFRI_RESOURCES);
+ if (urls[0] == null) {
+ urls = translate(MYFACES_RESOURCES);
+ }
+ return urls;
+
+ }
+
+
+ // ---------------------------------------------------------- Public Methods
+
+
+ /**
+ * <p>Parse the specified JavaServer Faces configuration resource, causing
+ * the appropriate JSF artifacts to be registered with the mock object
+ * hierarchy.</p>
+ *
+ * @param url <code>URL</code> of the configuration resource to parse
+ *
+ * @exception IOException if an input/output error occurs
+ * @exception SAXException if a parsing error occurs
+ */
+ public void parse(URL url) throws IOException, SAXException {
+
+ // Acquire and configure the Digester instance we will use
+ Digester digester = digester();
+ ApplicationFactory factory = (ApplicationFactory)
+ FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
+ Application application = factory.getApplication();
+ digester.push(application);
+
+ // Perform the required parsing
+ try {
+ digester.parse(new InputSource(url.openStream()));
+ } finally {
+ digester.clear();
+ }
+
+ }
+
+
+ /**
+ * <p>Parse the specified set of JavaServer Faces configuration resources,
+ * in the listed order, causing the appropriate JSF artifacts to be registered
+ * with the mock object hierarchy.</p>
+ *
+ * @param urls <code>URL</code>s of the configuration resources to parse
+ *
+ * @exception IOException if an input/output error occurs
+ * @exception SAXException if a parsing error occurs
+ */
+ public void parse(URL[] urls) throws IOException, SAXException {
+
+ for (int i = 0; i < urls.length; i++) {
+ parse(urls[i]);
+ }
+
+ }
+
+
+ // --------------------------------------------------------- Private Methods
+
+
+ /**
+ * <p>Return the <code>Digester</code> instance we will use for
parsing,
+ * creating and configuring a new instance if necessary.</p>
+ */
+ private Digester digester() {
+
+ if (this.digester == null) {
+ this.digester = new Digester();
+ digester.addRule("faces-config/component", new ComponentRule());
+ digester.addCallMethod
+ ("faces-config/component/component-type",
"setComponentType", 0);
+ digester.addCallMethod
+ ("faces-config/component/component-class",
"setComponentClass", 0);
+ digester.addRule("faces-config/converter", new ConverterRule());
+ digester.addCallMethod
+ ("faces-config/converter/converter-id",
"setConverterId", 0);
+ digester.addCallMethod
+ ("faces-config/converter/converter-class",
"setConverterClass", 0);
+ digester.addCallMethod
+ ("faces-config/converter/converter-for-class",
"setConverterForClass", 0);
+ digester.addRule("faces-config/render-kit", new RenderKitRule());
+ digester.addRule("faces-config/render-kit/render-kit-id", new
RenderKitIdRule());
+ digester.addRule("faces-config/render-kit/renderer", new
RendererRule());
+ digester.addCallMethod
+ ("faces-config/render-kit/renderer/component-family",
"setComponentFamily", 0);
+ digester.addCallMethod
+ ("faces-config/render-kit/renderer/renderer-class",
"setRendererClass", 0);
+ digester.addCallMethod
+ ("faces-config/render-kit/renderer/renderer-type",
"setRendererType", 0);
+ digester.addRule("faces-config/validator", new ValidatorRule());
+ digester.addCallMethod
+ ("faces-config/validator/validator-id",
"setValidatorId", 0);
+ digester.addCallMethod
+ ("faces-config/validator/validator-class",
"setValidatorClass", 0);
+ }
+
+ digester.setEntityResolver(new FacesEntityResolver());
+
+ return this.digester;
+
+ }
+
+
+ /**
+ * <p>Translate an array of resource names into an array of resource
URLs.</p>
+ *
+ * @param names Resource names to translate
+ */
+ private URL[] translate(String[] names) {
+
+ URL[] results = new URL[names.length];
+ for (int i = 0; i < names.length; i++) {
+ results[i] = this.getClass().getResource(names[i]);
+ }
+ return results;
+
+ }
+
+
+ // --------------------------------------------------------- Private Classes
+
+
+ /**
+ * <p>Data bean that stores information related to a component.</p>
+ */
+ class ComponentBean {
+
+ private String componentClass;
+ public String getComponentClass() {
+ return this.componentClass;
+ }
+ public void setComponentClass(String componentClass) {
+ this.componentClass = componentClass;
+ }
+
+ private String componentType;
+ public String getComponentType() {
+ return this.componentType;
+ }
+ public void setComponentType(String componentType) {
+ this.componentType = componentType;
+ }
+
+ }
+
+
+ /**
+ * <p>Digester <code>Rule</code> for processing
components.</p>
+ */
+ class ComponentRule extends Rule {
+
+ public void begin(String namespace, String name, Attributes attributes) {
+ getDigester().push(new ComponentBean());
+ }
+
+ public void end(String namespace, String name) {
+ ComponentBean bean = (ComponentBean) getDigester().pop();
+ Application application = (Application) getDigester().peek();
+ application.addComponent(bean.getComponentType(), bean.getComponentClass());
+ }
+
+ }
+
+
+ /**
+ * <p>Data bean that stores information related to a converter.</p>
+ */
+ class ConverterBean {
+
+ private String converterClass;
+ public String getConverterClass() {
+ return this.converterClass;
+ }
+ public void setConverterClass(String converterClass) {
+ this.converterClass = converterClass;
+ }
+
+ private String converterForClass;
+ public String getConverterForClass() {
+ return this.converterForClass;
+ }
+ public void setConverterForClass(String converterForClass) {
+ this.converterForClass = converterForClass;
+ }
+
+ private String converterId;
+ public String getConverterId() {
+ return this.converterId;
+ }
+ public void setConverterId(String converterId) {
+ this.converterId = converterId;
+ }
+
+ }
+
+
+ /**
+ * <p>Digester <code>Rule</code> for processing
converers.</p>
+ */
+ class ConverterRule extends Rule {
+
+ public void begin(String namespace, String name, Attributes attributes) {
+ getDigester().push(new ConverterBean());
+ }
+
+ public void end(String namespace, String name) {
+ ConverterBean bean = (ConverterBean) getDigester().pop();
+ Application application = (Application) getDigester().peek();
+ if (bean.getConverterId() != null) {
+ application.addConverter(bean.getConverterId(),
bean.getConverterClass());
+ } else {
+ Class clazz = null;
+ try {
+ clazz =
this.getClass().getClassLoader().loadClass(bean.getConverterForClass());
+ } catch (ClassNotFoundException e) {
+ throw new
IllegalArgumentException("java.lang.ClassNotFoundException: "
+ + bean.getConverterForClass());
+ }
+ application.addConverter(clazz, bean.getConverterClass());
+ }
+ }
+
+ }
+
+
+ /**
+ * <p>Digester <code>Rule</code> for processing render
kits.</p>
+ */
+ class RenderKitRule extends Rule {
+
+ public void begin(String namespace, String name, Attributes attributes) {
+ RenderKitFactory factory = (RenderKitFactory)
+ FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
+ getDigester().push(factory.getRenderKit(null,
RenderKitFactory.HTML_BASIC_RENDER_KIT));
+ }
+
+ public void end(String namespace, String name) {
+ getDigester().pop();
+ }
+
+ }
+
+
+ /**
+ * <p>Digester <code>Rule</code> for processing render kit
identifiers.</p>
+ */
+ class RenderKitIdRule extends Rule {
+
+ public void body(String namespace, String name, String text) {
+ String renderKitId = text.trim();
+ RenderKitFactory factory = (RenderKitFactory)
+ FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
+ RenderKit renderKit = factory.getRenderKit(null, renderKitId);
+ if (renderKit == null) {
+ renderKit = new MockRenderKit();
+ factory.addRenderKit(renderKitId, renderKit);
+ }
+ digester.pop();
+ digester.push(renderKit);
+ }
+
+ }
+
+
+ /**
+ * <p>Data bean that stores information related to a renderer.</p>
+ */
+ class RendererBean {
+
+ private String componentFamily;
+ public String getComponentFamily() {
+ return this.componentFamily;
+ }
+ public void setComponentFamily(String componentFamily) {
+ this.componentFamily = componentFamily;
+ }
+
+ private String rendererClass;
+ public String getRendererClass() {
+ return this.rendererClass;
+ }
+ public void setRendererClass(String rendererClass) {
+ this.rendererClass = rendererClass;
+ }
+
+ private String rendererType;
+ public String getRendererType() {
+ return this.rendererType;
+ }
+ public void setRendererType(String rendererType) {
+ this.rendererType = rendererType;
+ }
+
+ }
+
+
+ /**
+ * <p>Digester <code>Rule</code> for processing
renderers.</p>
+ */
+ class RendererRule extends Rule {
+
+ public void begin(String namespace, String name, Attributes attributes) {
+ getDigester().push(new RendererBean());
+ }
+
+ public void end(String namespace, String name) {
+ RendererBean bean = (RendererBean) getDigester().pop();
+ RenderKit kit = (RenderKit) getDigester().peek();
+ Renderer renderer = null;
+ Class clazz = null;
+ try {
+ clazz =
this.getClass().getClassLoader().loadClass(bean.getRendererClass());
+ renderer = (Renderer) clazz.newInstance();
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Exception while trying to
instantiate"
+ + " renderer class '" + bean.getRendererClass() +
"' : "
+ + e.getMessage());
+ }
+ kit.addRenderer(bean.getComponentFamily(), bean.getRendererType(),
+ renderer);
+ }
+
+ }
+
+
+ /**
+ * <p>Data bean that stores information related to a validator.</p>
+ */
+ class ValidatorBean {
+
+ private String validatorClass;
+ public String getValidatorClass() {
+ return this.validatorClass;
+ }
+ public void setValidatorClass(String validatorClass) {
+ this.validatorClass = validatorClass;
+ }
+
+ private String validatorId;
+ public String getValidatorId() {
+ return this.validatorId;
+ }
+ public void setValidatorId(String validatorId) {
+ this.validatorId = validatorId;
+ }
+
+ }
+
+
+ /**
+ * <p>Digester <code>Rule</code> for processing
validators.</p>
+ */
+ class ValidatorRule extends Rule {
+
+ public void begin(String namespace, String name, Attributes attributes) {
+ getDigester().push(new ValidatorBean());
+ }
+
+ public void end(String namespace, String name) {
+ ValidatorBean bean = (ValidatorBean) getDigester().pop();
+ Application application = (Application) getDigester().peek();
+ application.addValidator(bean.getValidatorId(), bean.getValidatorClass());
+ }
+
+ }
+
+
+}
Added:
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/xml/FacesEntityResolver.java
===================================================================
---
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/xml/FacesEntityResolver.java
(rev 0)
+++
branches/refactor1/framework/test/src/main/java/org/ajax4jsf/tests/xml/FacesEntityResolver.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,73 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.tests.xml;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * @author Nick Belaevski - nbelaevski(a)exadel.com
+ * created 09.04.2007
+ *
+ */
+public class FacesEntityResolver implements EntityResolver {
+
+ private static final String[] PREFIXES = new String[] {
+ "/com/sun/faces/", "/org/apache/myfaces/resource/"
+ };
+
+ /* (non-Javadoc)
+ * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String)
+ */
+ public InputSource resolveEntity(String publicId, String systemId)
+ throws SAXException, IOException {
+
+ if (systemId == null) {
+ return null;
+ }
+
+ String fileName;
+
+ int idx = systemId.lastIndexOf('/');
+ if (idx == -1) {
+ fileName = systemId;
+ } else {
+ fileName = systemId.substring(idx + 1);
+ }
+
+ for (int i = 0; i < PREFIXES.length; i++) {
+ String prefix = PREFIXES[i];
+
+ URL url = getClass().getResource(prefix + fileName);
+ if (url != null) {
+ return new InputSource(url.openStream());
+ }
+ }
+
+ return null;
+ }
+
+}
Added: branches/refactor1/framework/test/src/main/resources/WEB-INF/complex-web.xml
===================================================================
--- branches/refactor1/framework/test/src/main/resources/WEB-INF/complex-web.xml
(rev 0)
+++
branches/refactor1/framework/test/src/main/resources/WEB-INF/complex-web.xml 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,328 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+
+ <display-name>Flex Enterprise Services</display-name>
+ <description>Flex Enterprise Services Application</description>
+
+ <context-param>
+ <param-name>flex.class.path</param-name>
+ <param-value>/WEB-INF/flex/hotfixes,/WEB-INF/flex/jars</param-value>
+ </context-param>
+
+
+ <context-param>
+ <param-name>javax.faces.CONFIG_FILES</param-name>
+ <param-value>/WEB-INF/faces-config.xml</param-value>
+ <description>Comma separated list of URIs of (additional) faces config files.
+ (e.g. /WEB-INF/my-config.xml)
+ See JSF 1.0 PRD2, 10.3.2</description>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>client</param-value>
+ <description>State saving method: "client" or "server" (=
default)
+ See JSF Specification 2.5.2</description>
+ </context-param>
+ <context-param>
+ <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
+ <param-value>true</param-value>
+ <description>This parameter tells MyFaces if javascript code should be allowed
in the
+ rendered HTML output.
+ If javascript is allowed, command_link anchors will have javascript code
+ that submits the corresponding form.
+ If javascript is not allowed, the state saving info and nested parameters
+ will be added as url parameters.
+ Default: "true"</description>
+ </context-param>
+ <context-param>
+ <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
+ <param-value>true</param-value>
+ <description>If true, rendered HTML code will be formatted, so that it is
"human readable".
+ i.e. additional line separators and whitespace will be written, that do not
+ influence the HTML code.
+ Default: "true"</description>
+ </context-param>
+ <context-param>
+ <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
+ <param-value>false</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
+ <param-value>true</param-value>
+ <description>If true, a javascript function will be rendered that is able to
restore the
+ former vertical scroll on every request. Convenient feature if you have
pages
+ with long lists and you do not want the browser page to always jump to the
top
+ if you trigger a link or button action that stays on the same page.
+ Default: "false"</description>
+ </context-param>
+ <context-param>
+ <param-name>tiles-definitions</param-name>
+ <param-value>/WEB-INF/tiles.xml</param-value>
+ </context-param>
+ <context-param>
+<param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
+<param-value>org.apache.myfaces.application.jsp.JspTilesViewHandlerImpl</param-value>
+</context-param>
+
+
+ <filter>
+ <filter-name>extensionsFilter</filter-name>
+
<filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
+ <init-param>
+ <param-name>uploadMaxFileSize</param-name>
+ <param-value>10m</param-value>
+ <description>Set the size limit for uploaded files.
+ Format: 10 - 10 bytes
+ 10k - 10 KB
+ 10m - 10 MB
+ 1g - 1 GB</description>
+ </init-param>
+ <init-param>
+ <param-name>uploadThresholdSize</param-name>
+ <param-value>1k</param-value>
+ <description>Set the threshold size - files
+ below this limit are stored in memory, files above
+ this limit are stored on disk.
+
+ Format: 10 - 10 bytes
+ 10k - 10 KB
+ 10m - 10 MB
+ 1g - 1 GB
+ </description>
+ </init-param>
+ </filter>
+ <!-- Shale Application Controller Filter -->
+ <filter>
+ <filter-name>shale</filter-name>
+ <filter-class>
+ org.apache.shale.faces.ShaleApplicationFilter
+ </filter-class>
+ </filter>
+ <filter>
+ <filter-name>security</filter-name>
+ <filter-class>
+ com.pfizer.eNCA.filter.SecurityFilter
+ </filter-class>
+ </filter>
+ <filter>
+ <filter-name>ajax4jsf</filter-name>
+ <filter-class>org.ajax4jsf.Filter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>ajax4jsf</filter-name>
+ <servlet-name>Faces Servlet</servlet-name>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>shale</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>extensionsFilter</filter-name>
+ <url-pattern>*.jsf</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>extensionsFilter</filter-name>
+ <url-pattern>/faces/*</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>security</filter-name>
+ <url-pattern>/jsp/*</url-pattern>
+ </filter-mapping>
+
+ <listener>
+
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
+ </listener>
+ <!-- Commons Chain Configuration Listener -->
+ <listener>
+
<listener-class>org.apache.commons.chain.web.ChainListener</listener-class>
+ </listener>
+ <listener>
+ <listener-class>com.pfizer.eNCA.util.SessionListener</listener-class>
+ </listener>
+
+ <!-- MessageBroker Servlet -->
+ <servlet>
+ <servlet-name>MessageBrokerServlet</servlet-name>
+ <display-name>MessageBrokerServlet</display-name>
+ <servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>
+ <init-param>
+ <param-name>services.configuration.file</param-name>
+
<param-value>/WEB-INF/flex/flex-enterprise-services.xml</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet>
+ <servlet-name>FlexMxmlServlet</servlet-name>
+ <display-name>MXML Processor</display-name>
+ <description>Servlet wrapper for the Mxml Compiler</description>
+ <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class>
+ <init-param>
+ <param-name>servlet.class</param-name>
+ <param-value>flex2.server.j2ee.MxmlServlet</param-value>
+ </init-param>
+ <init-param>
+ <param-name>webtier.configuration.file</param-name>
+ <param-value>/WEB-INF/flex/flex-webtier-config.xml</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet>
+ <servlet-name>FlexSwfServlet</servlet-name>
+ <display-name>SWF Retriever</display-name>
+ <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class>
+ <init-param>
+ <param-name>servlet.class</param-name>
+ <param-value>flex2.server.j2ee.SwfServlet</param-value>
+ </init-param>
+ <!-- SwfServlet must be initialized after MxmlServlet -->
+ <load-on-startup>2</load-on-startup>
+ </servlet>
+
+ <servlet>
+ <servlet-name>FlexInternalServlet</servlet-name>
+ <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class>
+ <init-param>
+ <param-name>servlet.class</param-name>
+
<param-value>flex.server.j2ee.filemanager.FileManagerServlet</param-value>
+ </init-param>
+ <load-on-startup>10</load-on-startup>
+ </servlet>
+
+
+
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet>
+ <servlet-name>updateRequest</servlet-name>
+ <servlet-class>com.pfizer.eNCA.servlets.AJAXServlet</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>treeRequest</servlet-name>
+
<servlet-class>com.pfizer.eNCA.servlets.TreeStateServlet</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>renderExcel</servlet-name>
+ <servlet-class>com.pfizer.eNCA.servlets.RenderExcel</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>renderSPlus</servlet-name>
+ <servlet-class>com.pfizer.eNCA.servlets.RenderSPlus</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>pkFile</servlet-name>
+
<servlet-class>com.pfizer.eNCA.servlets.PKFileReaderServlet</servlet-class>
+ <init-param>
+ <param-name>requiredSessionObject</param-name>
+ <param-value>loggedInUser</param-value>
+ <description>Require Session Object for Security</description>
+ </init-param>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>MessageBrokerServlet</servlet-name>
+ <url-pattern>/messagebroker/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>FlexMxmlServlet</servlet-name>
+ <url-pattern>*.mxml</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>FlexSwfServlet</servlet-name>
+ <url-pattern>*.swf</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>FlexInternalServlet</servlet-name>
+ <url-pattern>/flex-internal/*</url-pattern>
+ </servlet-mapping>
+
+
+ <servlet-mapping>
+ <servlet-name>renderExcel</servlet-name>
+ <url-pattern>renderexcel.csv</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>renderSPlus</servlet-name>
+ <url-pattern>rendersplus.sdd</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>updateRequest</servlet-name>
+ <url-pattern>/updateRequest/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>treeRequest</servlet-name>
+ <url-pattern>/treeRequest/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>pkFile</servlet-name>
+ <url-pattern>/pk/*</url-pattern>
+ </servlet-mapping>
+ <mime-mapping>
+ <extension>doc</extension>
+ <mime-type>application/msword</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xls</extension>
+ <mime-type>application/vnd.ms-excel</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ppt</extension>
+ <mime-type>application/vnd.ms-powerpoint</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>swf</extension>
+ <mime-type>application/x-shockwave-flash</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pdf</extension>
+ <mime-type>application/pdf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>inc</extension>
+ <mime-type>text/html</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>zip</extension>
+ <mime-type>application/zip</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>exe</extension>
+ <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>csv</extension>
+ <mime-type>application/x-csv</mime-type>
+ </mime-mapping>
+ <welcome-file-list>
+ <welcome-file>/jsp/index.jsp</welcome-file>
+ </welcome-file-list>
+ <taglib>
+ <
taglib-uri>http://struts.apache.org/tags-tiles</taglib-uri>
+ <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
+ </taglib>
+
+ <security-constraint>
+ <display-name>Restrict access to JSP pages</display-name>
+ <web-resource-collection>
+ <web-resource-name>Restrict access to JSP pages</web-resource-name>
+ <url-pattern>/jsp/*.jsp</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <description>With no roles defined, no access granted</description>
+ </auth-constraint>
+ </security-constraint>
+</web-app>
+
Added: branches/refactor1/framework/test/src/main/resources/WEB-INF/web.xml
===================================================================
--- branches/refactor1/framework/test/src/main/resources/WEB-INF/web.xml
(rev 0)
+++ branches/refactor1/framework/test/src/main/resources/WEB-INF/web.xml 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+ <display-name>testcase</display-name>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.CONFIG_FILES</param-name>
+ <param-value>/WEB-INF/faces-config.xml</param-value>
+ </context-param>
+
+ <filter>
+ <description>Convert HTML to XML</description>
+ <display-name>Filter</display-name>
+ <filter-name>A4J</filter-name>
+ <filter-class>org.ajax4jsf.Filter</filter-class>
+ <init-param>
+ <param-name>publicid</param-name>
+ <param-value>-//W3C//DTD XHTML 1.0 Transitional//EN</param-value>
+ </init-param>
+ <init-param>
+ <param-name>systemid</param-name>
+
<
param-value>http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd<...
+ </init-param>
+ <init-param>
+ <param-name>namespace</param-name>
+ <
param-value>http://www.w3.org/1999/xhtml</param-value>
+ </init-param>
+ <init-param>
+ <param-name>forceparser</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ <init-param>
+ <param-name>rewriteid</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <init-param>
+ <param-name>mime-type</param-name>
+ <param-value>text/xml</param-value>
+ </init-param>
+ <init-param>
+ <param-name>log4j-init-file</param-name>
+ <param-value>WEB-INF/log4j.xml</param-value>
+ </init-param>
+ <init-param>
+ <param-name>enable-cache</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ </filter>
+ <filter-mapping>
+ <filter-name>A4J</filter-name>
+ <url-pattern>*.jsf</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>A4J</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+ <listener>
+ <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
+ </listener>
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+</web-app>
Added: branches/refactor1/framework/test/src/test/java/DnDScriptTest.java
===================================================================
--- branches/refactor1/framework/test/src/test/java/DnDScriptTest.java
(rev 0)
+++ branches/refactor1/framework/test/src/test/java/DnDScriptTest.java 2007-06-28 21:59:51
UTC (rev 1395)
@@ -0,0 +1,75 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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
+ */
+
+import java.io.IOException;
+
+import org.ajax4jsf.dnd.DnDScript;
+import org.ajax4jsf.framework.resource.FacesResourceContext;
+import org.ajax4jsf.framework.resource.ResourceContext;
+import org.ajax4jsf.framework.resource.TemplateCSSResource;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+/**
+ *
+ */
+
+/**
+ * @author shura
+ *
+ */
+public class DnDScriptTest extends AbstractAjax4JsfTestCase {
+
+ /**
+ * @param name
+ */
+ public DnDScriptTest(String name) {
+ super(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.framework.resource.InternetResourceBase#send(org.ajax4jsf.framework.resource.ResourceContext)}.
+ */
+ public void testSend() {
+ DnDScript resource = new DnDScript();
+ ResourceContext context = new FacesResourceContext(facesContext);
+ try {
+ resource.send(context);
+ } catch (IOException e) {
+ e.printStackTrace();
+ assertTrue("error send style",false);
+ }
+ }
+
+}
Added: branches/refactor1/framework/test/src/test/java/README.txt
===================================================================
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/ActionListenerTest.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/ActionListenerTest.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/ActionListenerTest.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,154 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.ajax;
+
+import java.io.Serializable;
+
+import javax.faces.component.UICommand;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.IntegerConverter;
+import javax.faces.event.ActionEvent;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+import junit.framework.TestCase;
+
+/**
+ * @author shura
+ *
+ */
+public class ActionListenerTest extends AbstractAjax4JsfTestCase {
+
+ /**
+ * @param name
+ */
+ public ActionListenerTest(String name) {
+ super(name);
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.ajax.UIActionParameter#getValue()}.
+ */
+ public void testGetValue() {
+ Bean bean = new Bean();
+ bean.setFirst(1);
+ bean.setSecond(2.0);
+ UIActionParameter param = new UIActionParameter();
+ param.setConverter(new TestConverter());
+ param.setValue(bean);
+ assertEquals("1;2.0", param.getValue());
+ }
+
+ public void testGetIntValue() throws Exception {
+ UIActionParameter param = new UIActionParameter();
+ application.addConverter(Integer.class, IntegerConverter.class.getName());
+ param.setValue(new Integer(1));
+ assertEquals("1", param.getValue());
+ }
+
+ static class TestConverter implements Converter {
+
+ /* (non-Javadoc)
+ * @see javax.faces.convert.Converter#getAsObject(javax.faces.context.FacesContext,
javax.faces.component.UIComponent, java.lang.String)
+ */
+ public Object getAsObject(FacesContext context, UIComponent comp, String str) {
+ Bean bean = new Bean();
+ String[] values = str.split(";");
+ bean.setFirst(Integer.parseInt(values[0]));
+ bean.setSecond(Double.parseDouble(values[1]));
+ return bean;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.convert.Converter#getAsString(javax.faces.context.FacesContext,
javax.faces.component.UIComponent, java.lang.Object)
+ */
+ public String getAsString(FacesContext context, UIComponent comp, Object value) {
+ Bean bean = (Bean) value;
+ return
String.valueOf(bean.getFirst())+";"+String.valueOf(bean.getSecond());
+ }
+
+ }
+
+ public static class Bean implements Serializable {
+ int _first;
+ double _second;
+ /**
+ * @return the first
+ */
+ public int getFirst() {
+ return this._first;
+ }
+ /**
+ * @param first the first to set
+ */
+ public void setFirst(int first) {
+ this._first = first;
+ }
+ /**
+ * @return the second
+ */
+ public double getSecond() {
+ return this._second;
+ }
+ /**
+ * @param second the second to set
+ */
+ public void setSecond(double second) {
+ this._second = second;
+ }
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.ajax.UIActionParameter#processAction(javax.faces.event.ActionEvent)}.
+ */
+ public void testProcessAction() {
+ UICommand command = new UICommand();
+ UIActionParameter param = new UIActionParameter();
+ param.setConverter(new IntegerConverter());
+ param.setName("param");
+ param.setAssignToBinding(application.createValueBinding("#{bean.first}"));
+ Bean bean = new Bean();
+ request.setAttribute("bean", bean);
+ request.addParameter("param", "123");
+ externalContext.getRequestParameterMap().put("param", "123");
+ command.addActionListener(param);
+ command.broadcast(new ActionEvent(command));
+ assertEquals(123, bean.getFirst());
+ }
+
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/AllUIRepeatTests.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/AllUIRepeatTests.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/AllUIRepeatTests.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,38 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.ajax.repeat;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllUIRepeatTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Test for org.ajax4jsf.ajax.repeat");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(DataAdaptorTestCase.class);
+ suite.addTestSuite(RepeatTestCase.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/DataAdaptorTestCase.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/DataAdaptorTestCase.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/DataAdaptorTestCase.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,387 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.ajax.repeat;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIData;
+import javax.faces.component.UIInput;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.ajax4jsf.tests.MockUIInputRenderer;
+
+/**
+ * @author shura
+ *
+ */
+public class DataAdaptorTestCase extends AbstractAjax4JsfTestCase {
+
+ private UIDataAdaptor adaptor;
+
+ private UIInput child;
+
+ private int childInvoked;
+
+ private UIInput facetChild;
+
+ private int facetInvoked;
+
+ private UIInput childChild;
+
+ private int childChildInvoked;
+
+ private UIInput childChildFacet;
+
+ private int childChildFacetInvoked;
+
+ UIData data;
+ /**
+ * @param name
+ */
+ public DataAdaptorTestCase(String name) {
+ super(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ // Create mock DataAdaptor and childs.
+ adaptor = new MockDataAdaptor();
+ child = new UIInput(){
+ public void processDecodes(FacesContext context) {
+ childInvoked++;
+ super.processDecodes(context);
+ }
+ };
+ childInvoked = 0;
+ child.setId("child");
+ adaptor.getChildren().add(child);
+ facetChild = new UIInput(){
+ public void processDecodes(FacesContext context) {
+ facetInvoked++;
+ super.processDecodes(context);
+ }
+ };
+ facetInvoked = 0;
+ facetChild.setId("facetChild");
+ adaptor.getFacets().put("facet", facetChild);
+ childChild = new UIInput(){
+ public void processDecodes(FacesContext context) {
+ childChildInvoked++;
+ super.processDecodes(context);
+ }
+ };;
+ childChildInvoked = 0;
+ childChild.setId("childChild");
+ child.getChildren().add(childChild);
+ childChildFacet = new UIInput(){
+ public void processDecodes(FacesContext context) {
+ childChildFacetInvoked++;
+ super.processDecodes(context);
+ }
+ };;
+ childChildFacetInvoked = 0;
+ childChildFacet.setId("childChildFacet");
+ childChild.getFacets().put("facet", childChildFacet);
+ data = new UIData();
+ renderKit.addRenderer(child.getFamily(), child.getRendererType(), new
MockUIInputRenderer());
+ renderKit.addRenderer(adaptor.getFamily(), adaptor.getRendererType(), new
MockUIInputRenderer());
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ adaptor = null;
+ child = null;
+ childChild = null;
+ childChildFacet = null;
+ facetChild = null;
+ }
+
+ private void createTree(){
+ facesContext.getViewRoot().getChildren().add(adaptor);
+ adaptor.setId("adaptor");
+ }
+
+ private void createDataTree(){
+ data.setId("data");
+ adaptor.setId("adaptor");
+ ArrayList value = new ArrayList(2);
+ value.add("first");
+ value.add("second");
+ data.setValue(value);
+ data.setVar("var");
+ UIColumn column = new UIColumn();
+ data.getChildren().add(column);
+ column.getChildren().add(adaptor);
+ facesContext.getViewRoot().getChildren().add(data);
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.ajax.repeat.UIDataAdaptor#isRowAvailable()}.
+ */
+ public void testIsRowAvailable() {
+ adaptor.setRowKey(new Integer(0));
+ assertTrue(adaptor.isRowAvailable());
+ adaptor.setRowKey(new Integer(MockDataModel.ROWS-1));
+ assertTrue(adaptor.isRowAvailable());
+ adaptor.setRowKey(new Integer(MockDataModel.ROWS+1));
+ assertFalse(adaptor.isRowAvailable());
+ adaptor.setRowKey(null);
+ assertFalse(adaptor.isRowAvailable());
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.ajax.repeat.UIDataAdaptor#getRowKey()}.
+ */
+ public void testGetRowKey() {
+ adaptor.setRowIndex(0);
+ assertEquals(new Integer(0), adaptor.getRowKey());
+ adaptor.setRowIndex(-1);
+ assertNull(adaptor.getRowKey());
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.ajax.repeat.UIDataAdaptor#setRowKey(java.lang.Object)}.
+ */
+ public void testSetRowKey() {
+ adaptor.setRowKey(new Integer(1));
+ assertEquals(1, adaptor.getRowIndex());
+ adaptor.setRowKey(null);
+ assertEquals(-1, adaptor.getRowIndex());
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.ajax.repeat.UIDataAdaptor#resetDataModel()}.
+ */
+ public void testResetDataModel() {
+ adaptor.setRowKey(new Integer(1));
+ adaptor.resetDataModel();
+ assertEquals(0, adaptor.getRowIndex());
+ }
+
+ public void testGetBaseClientId(){
+ createDataTree();
+ data.setRowIndex(-1);
+ assertEquals(adaptor.getBaseClientId(facesContext), "data:adaptor");
+ data.setRowIndex(0);
+ assertEquals(adaptor.getBaseClientId(facesContext), "data:0:adaptor");
+ data.setRowIndex(1);
+ assertEquals(adaptor.getBaseClientId(facesContext), "data:1:adaptor");
+ adaptor.setRowIndex(1);
+ assertEquals(adaptor.getBaseClientId(facesContext), "data:1:adaptor");
+ }
+
+
+ /**
+ * Test method for {@link
org.ajax4jsf.ajax.repeat.UIDataAdaptor#setExtendedDataModel(org.ajax4jsf.ajax.repeat.ExtendedDataModel)}.
+ */
+ public void testSetIterableDataModel() {
+ createDataTree();
+ data.setRowIndex(0);
+ MockDataModel mockDataModel0 = new MockDataModel();
+ adaptor.setExtendedDataModel(mockDataModel0);
+ data.setRowIndex(1);
+ MockDataModel mockDataModel1 = new MockDataModel();
+ adaptor.setExtendedDataModel(mockDataModel1);
+ data.setRowIndex(0);
+ assertSame(mockDataModel0, adaptor.getExtendedDataModel());
+ data.setRowIndex(1);
+ assertSame(mockDataModel1, adaptor.getExtendedDataModel());
+ }
+
+ public void testSetDataModel(){
+ MockDataModel mockDataModel1 = new MockDataModel();
+ adaptor.setExtendedDataModel(mockDataModel1);
+ assertSame(mockDataModel1, adaptor.getExtendedDataModel());
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.ajax.repeat.UIDataAdaptor#getExtendedDataModel()}.
+ */
+ public void testGetIterableDataModel() {
+ ExtendedDataModel dataModel = adaptor.getExtendedDataModel();
+ assertTrue(dataModel instanceof MockDataModel);
+ }
+
+ /**
+ * Test method for {@link org.ajax4jsf.ajax.repeat.UIDataAdaptor#getComponentState()}.
+ */
+ public void testGetComponentState() {
+ createDataTree();
+ data.setRowIndex(0);
+ DataComponentState state0 = adaptor.getComponentState();
+ assertTrue(state0 instanceof MockComponentState);
+ data.setRowIndex(1);
+ DataComponentState state1 = adaptor.getComponentState();
+ data.setRowIndex(0);
+ assertSame(state0, adaptor.getComponentState());
+ data.setRowIndex(1);
+ assertSame(state1, adaptor.getComponentState());
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.ajax.repeat.UIDataAdaptor#createComponentState()}.
+ */
+ public void testCreateComponentState() {
+ DataComponentState state = adaptor.createComponentState();
+ assertTrue(state instanceof MockComponentState);
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.ajax.repeat.UIDataAdaptor#iterate(javax.faces.context.FacesContext,
org.ajax4jsf.ajax.repeat.RepeaterInvoker)}.
+ */
+ public void testProcess() {
+ createTree();
+ MockComponentState mockState = (MockComponentState) adaptor.getComponentState();
+ mockState.setCount(4);
+ adaptor.processDecodes(facesContext);
+ assertEquals(childInvoked, 4);
+ assertEquals(facetInvoked, 1);
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.ajax.repeat.UIDataAdaptor#iterate(javax.faces.context.FacesContext,
org.ajax4jsf.ajax.repeat.RepeaterInvoker)}.
+ */
+ public void testProcessMore() {
+ createTree();
+ MockComponentState mockState = (MockComponentState) adaptor.getComponentState();
+ mockState.setCount(Integer.MAX_VALUE);
+ adaptor.processDecodes(facesContext);
+ assertEquals(childInvoked, MockDataModel.ROWS);
+ assertEquals(facetInvoked, 1);
+ }
+
+
+ /**
+ * Test method for {@link
org.ajax4jsf.ajax.repeat.UIDataAdaptor#restoreState(javax.faces.context.FacesContext,
java.lang.Object)}.
+ * @throws IllegalAccessException
+ * @throws InstantiationException
+ */
+ public void testRestoreStateFacesContextObject() throws Exception {
+ createTree();
+ MockComponentState mockState = (MockComponentState) adaptor.getComponentState();
+ mockState.setCount(123);
+ adaptor.encodeBegin(facesContext);
+ UIViewRoot viewRoot = facesContext.getViewRoot();
+ Object treeState = viewRoot.processSaveState(facesContext);
+ UIViewRoot root = (UIViewRoot) viewRoot.getClass().newInstance();
+ UIDataAdaptor restoredAdaptor = new MockDataAdaptor();
+ root.getChildren().add(restoredAdaptor);
+ root.processRestoreState(facesContext, treeState);
+ mockState = (MockComponentState) restoredAdaptor.getComponentState();
+ assertEquals(mockState.getCount(), 123);
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.ajax.repeat.UIDataAdaptor#saveState(javax.faces.context.FacesContext)}.
+ */
+ public void testSaveStateFacesContext() throws Exception {
+ createDataTree();
+ data.setRowIndex(0);
+ MockComponentState mockState = (MockComponentState) adaptor.getComponentState();
+ mockState.setCount(123);
+ adaptor.encodeBegin(facesContext);
+ data.setRowIndex(1);
+ mockState = (MockComponentState) adaptor.getComponentState();
+ mockState.setCount(321);
+ adaptor.encodeBegin(facesContext);
+ UIViewRoot viewRoot = facesContext.getViewRoot();
+ Object treeState = viewRoot.processSaveState(facesContext);
+ UIViewRoot root = (UIViewRoot) viewRoot.getClass().newInstance();
+ UIData restoredData = new UIData();
+ UIDataAdaptor restoredAdaptor = new MockDataAdaptor();
+ root.getChildren().add(restoredData);
+ UIColumn column = new UIColumn();
+ restoredData.getChildren().add(column);
+ column.getChildren().add(restoredAdaptor);
+ root.processRestoreState(facesContext, treeState);
+ restoredData.setRowIndex(0);
+ mockState = (MockComponentState) restoredAdaptor.getComponentState();
+ assertEquals(mockState.getCount(), 123);
+ restoredData.setRowIndex(1);
+ mockState = (MockComponentState) restoredAdaptor.getComponentState();
+ assertEquals(mockState.getCount(), 321);
+ }
+
+ public void testSaveChildState(){
+ createTree();
+ child.setSubmittedValue("Submitted");
+ child.setValid(true);
+ child.setValue("Value");
+ child.setLocalValueSet(true);
+ adaptor.saveChildState(facesContext);
+ child.setSubmittedValue("NonSubmitted");
+ child.setValid(false);
+ child.setValue(null);
+ child.setLocalValueSet(false);
+ adaptor.restoreChildState(facesContext);
+ assertEquals(child.getSubmittedValue(), "Submitted");
+ assertTrue(child.isValid());
+ assertEquals(child.getValue(), "Value");
+ assertTrue(child.isLocalValueSet());
+ }
+
+ public void testSaveChildChildState(){
+ createTree();
+ childChild.setSubmittedValue("Submitted");
+ childChild.setValid(true);
+ childChild.setValue("Value");
+ childChild.setLocalValueSet(true);
+ adaptor.saveChildState(facesContext);
+ childChild.setSubmittedValue("NonSubmitted");
+ childChild.setValid(false);
+ childChild.setValue(null);
+ childChild.setLocalValueSet(false);
+ adaptor.restoreChildState(facesContext);
+ assertEquals(childChild.getSubmittedValue(), "Submitted");
+ assertTrue(childChild.isValid());
+ assertEquals(childChild.getValue(), "Value");
+ assertTrue(childChild.isLocalValueSet());
+ }
+ public void testSaveChildChildFacetState(){
+ createTree();
+ childChildFacet.setSubmittedValue("Submitted");
+ childChildFacet.setValid(true);
+ childChildFacet.setValue("Value");
+ childChildFacet.setLocalValueSet(true);
+ adaptor.saveChildState(facesContext);
+ childChildFacet.setSubmittedValue("NonSubmitted");
+ childChildFacet.setValid(false);
+ childChildFacet.setValue(null);
+ childChildFacet.setLocalValueSet(false);
+ adaptor.restoreChildState(facesContext);
+ assertEquals(childChildFacet.getSubmittedValue(), "Submitted");
+ assertTrue(childChildFacet.isValid());
+ assertEquals(childChildFacet.getValue(), "Value");
+ assertTrue(childChildFacet.isLocalValueSet());
+ }
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/MockComponentState.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/MockComponentState.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/MockComponentState.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,93 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.ajax.repeat;
+
+import java.io.Serializable;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author shura
+ *
+ */
+public class MockComponentState implements DataComponentState,Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -4278697745017092414L;
+ private int _count = 2;
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.ajax.repeat.DataComponentState#getRange()
+ */
+ public Range getRange() {
+ // TODO Auto-generated method stub
+ return new MockRange(_count);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.StateHolder#isTransient()
+ */
+ public boolean isTransient() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.StateHolder#restoreState(javax.faces.context.FacesContext,
java.lang.Object)
+ */
+ public void restoreState(FacesContext context, Object state) {
+ _count = ((Integer)state).intValue();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.StateHolder#saveState(javax.faces.context.FacesContext)
+ */
+ public Object saveState(FacesContext context) {
+ // TODO Auto-generated method stub
+ return new Integer(_count);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.component.StateHolder#setTransient(boolean)
+ */
+ public void setTransient(boolean newTransientValue) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * @return the count
+ */
+ public int getCount() {
+ return _count;
+ }
+
+ /**
+ * @param count the count to set
+ */
+ public void setCount(int count) {
+ _count = count;
+ }
+
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/MockDataAdaptor.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/MockDataAdaptor.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/MockDataAdaptor.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,64 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.ajax.repeat;
+
+import java.util.Iterator;
+
+/**
+ * @author shura
+ *
+ */
+public class MockDataAdaptor extends UIDataAdaptor {
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.ajax.repeat.UIDataAdaptor#createComponentState()
+ */
+ protected DataComponentState createComponentState() {
+ // TODO Auto-generated method stub
+ return new MockComponentState();
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.ajax.repeat.UIDataAdaptor#createDataModel()
+ */
+ protected ExtendedDataModel createDataModel() {
+ // TODO Auto-generated method stub
+ return new MockDataModel();
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.ajax.repeat.UIDataAdaptor#dataChildren()
+ */
+ protected Iterator dataChildren() {
+ // TODO Auto-generated method stub
+ return getChildren().iterator();
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.ajax.repeat.UIDataAdaptor#fixedChildren()
+ */
+ protected Iterator fixedChildren() {
+ // TODO Auto-generated method stub
+ return getFacets().values().iterator();
+ }
+
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/MockDataModel.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/MockDataModel.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/MockDataModel.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,166 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.ajax.repeat;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author shura
+ *
+ */
+public class MockDataModel extends ExtendedDataModel {
+
+ public static final int ROWS = 10;
+
+ private int rowIndex = 0;
+
+ private int minRow = 0;
+
+ private int maxRow = ROWS;
+
+ /**
+ * @return the maxRow
+ */
+ public int getMaxRow() {
+ return maxRow;
+ }
+
+ /**
+ * @param maxRow the maxRow to set
+ */
+ public void setMaxRow(int maxRow) {
+ this.maxRow = maxRow;
+ }
+
+ /**
+ * @return the minRow
+ */
+ public int getMinRow() {
+ return minRow;
+ }
+
+ /**
+ * @param minRow the minRow to set
+ */
+ public void setMinRow(int minRow) {
+ this.minRow = minRow;
+ }
+
+
+ public void walk(FacesContext context, DataVisitor visitor, Range range, Object
argument) throws IOException {
+ int first=0;
+ int count=ROWS;
+ if (range instanceof MockRange) {
+ MockRange mockRange = (MockRange) range;
+ count = mockRange.getCount();
+ } else if (range instanceof SequenceRange) {
+ SequenceRange seqRange = (SequenceRange) range;
+ first = seqRange.getFirstRow();
+ int rows = seqRange.getRows();
+ if(rows>0){
+ count = rows+first;
+ }
+ }
+ for(int row = first; row < count && row < ROWS;row++){
+ visitor.process(context, new Integer(row), argument);
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.ajax.repeat.ExtendedDataModel#getRowKey()
+ */
+ public Object getRowKey() {
+ // TODO Auto-generated method stub
+ return rowIndex<0?null:new Integer(rowIndex);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.ajax.repeat.ExtendedDataModel#setRowKey(java.lang.Object)
+ */
+ public void setRowKey(Object key) {
+ if(null == key){
+ rowIndex = -1;
+ } else {
+ rowIndex = ((Integer) key).intValue();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#getRowCount()
+ */
+ public int getRowCount() {
+ // TODO Auto-generated method stub
+ return getMaxRow();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#getRowData()
+ */
+ public Object getRowData() {
+ // TODO Auto-generated method stub
+ return isRowAvailable()?String.valueOf(rowIndex):null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#getRowIndex()
+ */
+ public int getRowIndex() {
+ // TODO Auto-generated method stub
+ return rowIndex;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#getWrappedData()
+ */
+ public Object getWrappedData() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#isRowAvailable()
+ */
+ public boolean isRowAvailable() {
+ // TODO Auto-generated method stub
+ return rowIndex>=getMinRow() && rowIndex<getMaxRow();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#setRowIndex(int)
+ */
+ public void setRowIndex(int rowIndex) {
+ this.rowIndex = rowIndex;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.faces.model.DataModel#setWrappedData(java.lang.Object)
+ */
+ public void setWrappedData(Object data) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/MockRange.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/MockRange.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/MockRange.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,39 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.ajax.repeat;
+
+/**
+ * @author shura
+ *
+ */
+public class MockRange implements Range {
+
+ private int count;
+
+ public MockRange(int count) {
+ this.count = count;
+ }
+
+ public int getCount(){
+ return count;
+ }
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/MockSerializableDataModel.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/MockSerializableDataModel.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/MockSerializableDataModel.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,96 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.ajax.repeat;
+
+import java.io.IOException;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * @author shura
+ *
+ */
+public class MockSerializableDataModel extends MockDataModel {
+
+ public SerializableDataModel getSerializableModel(Range range) {
+ MockRange mockRange = (MockRange) range;
+ SerializableDataModel model = new SerializableDataModel(){
+
+ public void update() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Object getRowKey() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setRowKey(Object key) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void walk(FacesContext context, DataVisitor visitor, Range range, Object
argument) throws IOException {
+ // TODO Auto-generated method stub
+
+ }
+
+ public int getRowCount() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public Object getRowData() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int getRowIndex() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public Object getWrappedData() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean isRowAvailable() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void setRowIndex(int arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void setWrappedData(Object arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ };
+ return model;
+ }
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/RepeatTestCase.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/RepeatTestCase.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/ajax/repeat/RepeatTestCase.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,246 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.ajax.repeat;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.faces.component.UIColumn;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIData;
+import javax.faces.component.UIInput;
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.renderkit.html.RepeatRenderer;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.ajax4jsf.tests.MockUIInputRenderer;
+
+/**
+ * @author shura
+ *
+ */
+public class RepeatTestCase extends AbstractAjax4JsfTestCase {
+
+ private UIRepeat repeater;
+
+ private UIInput child;
+
+ private int childInvoked;
+
+ private UIInput facetChild;
+
+ private int facetInvoked;
+
+ private UIInput childChild;
+
+ private int childChildInvoked;
+
+ private UIInput childChildFacet;
+
+ private int childChildFacetInvoked;
+
+ private UIRepeat enclosedRepeater;
+ /**
+ * @param name
+ */
+ public RepeatTestCase(String name) {
+ super(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ // Create mock DataAdaptor and childs.
+ repeater = new UIRepeat();
+ child = new UIInput(){
+ public void processDecodes(FacesContext context) {
+ childInvoked++;
+ super.processDecodes(context);
+ }
+ };
+ childInvoked = 0;
+ child.setId("child");
+ repeater.getChildren().add(child);
+ facetChild = new UIInput(){
+ public void processDecodes(FacesContext context) {
+ facetInvoked++;
+ super.processDecodes(context);
+ }
+ };
+ facetInvoked = 0;
+ facetChild.setId("facetChild");
+ repeater.getFacets().put("facet", facetChild);
+ childChild = new UIInput(){
+ public void processDecodes(FacesContext context) {
+ childChildInvoked++;
+ super.processDecodes(context);
+ }
+ };;
+ childChildInvoked = 0;
+ childChild.setId("childChild");
+ child.getChildren().add(childChild);
+ childChildFacet = new UIInput(){
+ public void processDecodes(FacesContext context) {
+ childChildFacetInvoked++;
+ super.processDecodes(context);
+ }
+ };;
+ childChildFacetInvoked = 0;
+ childChildFacet.setId("childChildFacet");
+ childChild.getFacets().put("facet", childChildFacet);
+ enclosedRepeater = new UIRepeat();
+ renderKit.addRenderer(child.getFamily(), child.getRendererType(), new
MockUIInputRenderer(){
+ public void decode(FacesContext context, UIComponent component) {
+ super.decode(context, component);
+ UIInput input = (UIInput) component;
+ String submittedValie =
enclosedRepeater.getRowKey()+":"+repeater.getRowKey();
+ input.setSubmittedValue(submittedValie);
+ System.out.println("decode component
"+component.getClientId(facesContext)+" with value "+submittedValie);
+ }
+ });
+ renderKit.addRenderer(repeater.getFamily(), repeater.getRendererType(), new
RepeatRenderer());
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ repeater = null;
+ child = null;
+ childChild = null;
+ childChildFacet = null;
+ facetChild = null;
+ enclosedRepeater = null;
+ }
+
+
+ private void createDataTree(){
+ enclosedRepeater.setId("data");
+ repeater.setId("adaptor");
+ repeater.setVar("row");
+ ArrayList value = new ArrayList(2);
+ value.add("first");
+ value.add("second");
+ enclosedRepeater.setValue(value);
+ enclosedRepeater.setVar("var");
+ UIColumn column = new UIColumn();
+ enclosedRepeater.getChildren().add(column);
+ column.getChildren().add(repeater);
+ facesContext.getViewRoot().getChildren().add(enclosedRepeater);
+ }
+
+ private void printChildMap(Map childrenState){
+ System.out.println("{");
+ for (Iterator iter = childrenState.keySet().iterator(); iter.hasNext();) {
+ Object key = iter.next();
+ System.out.println(" "+key+" : "+childrenState.get(key));
+ }
+ System.out.println("}");
+ }
+ /**
+ * Test method for {@link
javax.faces.component.UIData#processDecodes(javax.faces.context.FacesContext)}.
+ */
+ public void testProcessDecodesFacesContext() {
+ createDataTree();
+ repeater.setValue(new MockDataModel());
+// enclosedRepeater.setValue(new MockDataModel());
+ enclosedRepeater.processDecodes(facesContext);
+ enclosedRepeater.setRowIndex(1);
+ repeater.setRowIndex(1);
+ System.out.println("Saved child state for external repeater ");
+ printChildMap(enclosedRepeater.getChildState(facesContext));
+ System.out.println("Saved child state" );
+ printChildMap(repeater.getChildState(facesContext));
+ assertEquals("1:1", child.getSubmittedValue());
+ }
+
+ /**
+ * Test method for {@link
javax.faces.component.UIData#processUpdates(javax.faces.context.FacesContext)}.
+ */
+ public void testProcessUpdatesFacesContext() {
+ createDataTree();
+ repeater.setValue(new MockDataModel());
+// enclosedRepeater.setValue(new MockDataModel());
+ enclosedRepeater.processDecodes(facesContext);
+ enclosedRepeater.processValidators(facesContext);
+ enclosedRepeater.processUpdates(facesContext);
+ enclosedRepeater.setRowIndex(1);
+ repeater.setRowIndex(1);
+ assertEquals("1:1", child.getValue());
+ enclosedRepeater.setRowIndex(0);
+ repeater.setRowIndex(2);
+ assertEquals("0:2", child.getValue());
+ }
+
+ /**
+ * Test method for {@link
javax.faces.component.UIData#processUpdates(javax.faces.context.FacesContext)}.
+ */
+ public void testProcessValidatorsFacesContext() {
+ createDataTree();
+ repeater.setValue(new MockDataModel());
+// enclosedRepeater.setValue(new MockDataModel());
+ enclosedRepeater.processDecodes(facesContext);
+ enclosedRepeater.processValidators(facesContext);
+ enclosedRepeater.setRowIndex(1);
+ repeater.setRowIndex(1);
+ assertEquals("1:1", child.getLocalValue());
+ enclosedRepeater.setRowIndex(0);
+ repeater.setRowIndex(2);
+ assertEquals("0:2", child.getLocalValue());
+ }
+
+ public void testSetRowIndex() throws Exception {
+ createDataTree();
+ repeater.setValue(new MockDataModel());
+ enclosedRepeater.setRowIndex(1);
+ repeater.setRowIndex(1);
+ child.setValue("1:1");
+ repeater.setRowIndex(-1);
+ enclosedRepeater.setRowIndex(-1);
+ // -----------------------------
+ enclosedRepeater.setRowIndex(0);
+ repeater.setRowIndex(2);
+ child.setValue("0:2");
+ // -----------------------------
+ repeater.setRowIndex(-1);
+ enclosedRepeater.setRowIndex(-1);
+ System.out.println("Saved child state for external repeater ");
+ printChildMap(enclosedRepeater.getChildState(facesContext));
+ System.out.println("Saved child state" );
+ printChildMap(repeater.getChildState(facesContext));
+ // -----------------------------
+ enclosedRepeater.setRowIndex(1);
+ repeater.setRowIndex(1);
+ assertEquals("1:1", child.getValue());
+ repeater.setRowIndex(-1);
+ enclosedRepeater.setRowIndex(-1);
+ // -----------------------------
+ enclosedRepeater.setRowIndex(0);
+ repeater.setRowIndex(2);
+ assertEquals("0:2", child.getValue());
+
+ }
+}
Added: branches/refactor1/framework/test/src/test/java/org/ajax4jsf/codec/CodecTest.java
===================================================================
--- branches/refactor1/framework/test/src/test/java/org/ajax4jsf/codec/CodecTest.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/codec/CodecTest.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,88 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.codec;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.framework.util.base64.Codec;
+import org.ajax4jsf.tests.AbstractThreadedAjax4JsfTestCase;
+
+public class CodecTest extends AbstractThreadedAjax4JsfTestCase {
+ Codec c;
+
+ public CodecTest(String s) {
+ super(s);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+ String message = "";
+ try {
+ c = new Codec("anbshsquycwuudyft");
+ } catch (Exception e) {
+ message = "Cannot create Codec instance " + e.getMessage();
+ }
+ assertNotNull(message, c);
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testCodec() {
+ CodecTestRunnable[] runnables = new CodecTestRunnable[100];
+ for (int i = 0; i < runnables.length; i++) {
+ runnables[i] = new CodecTestRunnable(c, generateRandomString(), i);
+ }
+ runTestCaseRunnables(runnables);
+ }
+
+ private String generateRandomString() {
+ StringBuffer ss = new StringBuffer();
+ for (int i = 0; i < 50000; i++) {
+ char c = (char)(96 + Math.random() * 26);
+ ss.append(c);
+ }
+ return ss.toString();
+ }
+
+ class CodecTestRunnable extends TestCaseRunnable {
+ Codec c;
+ String s;
+ int id;
+
+ public CodecTestRunnable(Codec c, String s, int id) {
+ this.c = c;
+ this.s = s;
+ this.id = id;
+ }
+
+
+ public void runTestCase(FacesContext context) throws Throwable {
+ String s1 = c.encode(s);
+ String s2 = c.decode(s1);
+ assertEquals("Failure in thread " + id, s2, s);
+ }
+
+ }
+
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/codec/CodecTestSuite.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/codec/CodecTestSuite.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/codec/CodecTestSuite.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,36 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.codec;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class CodecTestSuite {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(
+ "Test for org.ajax4jsf.codec");
+ suite.addTestSuite(CodecTest.class);
+ return suite;
+ }
+
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/ajax/xmlfilter/AllTests.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/ajax/xmlfilter/AllTests.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/ajax/xmlfilter/AllTests.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,39 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.framework.ajax.xmlfilter;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(
+ "Test for org.ajax4jsf.framework.ajax.xmlfilter");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(CacheContentTest.class);
+ suite.addTestSuite(NekkoParserTest.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/ajax/xmlfilter/CacheContentTest.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/ajax/xmlfilter/CacheContentTest.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/ajax/xmlfilter/CacheContentTest.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,123 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.framework.ajax.xmlfilter;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.apache.shale.test.mock.MockPrintWriter;
+import org.apache.shale.test.mock.MockServletOutputStream;
+
+/**
+ * @author shura
+ *
+ */
+public class CacheContentTest extends AbstractAjax4JsfTestCase {
+
+ public CacheContentTest(String name) {
+ super(name);
+ // TODO Auto-generated constructor stub
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ // TODO Auto-generated method stub
+ super.setUp();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ // TODO Auto-generated method stub
+ super.tearDown();
+ }
+
+
+ /**
+ * Test method for {@link
org.ajax4jsf.framework.ajax.xmlfilter.CacheContent#getOutputStream(java.io.OutputStream)}.
+ * @throws IOException
+ */
+ public void testGetOutputStream() throws IOException {
+ CacheContent content = new CacheContent();
+ OutputStream outputStream = content.getOutputStream();
+ byte[] bytes = "Test".getBytes();
+ outputStream.write(bytes);
+ outputStream.flush();
+ outputStream.close();
+ ByteArrayOutputStream ser = new ByteArrayOutputStream(1024);
+ ObjectOutputStream objStream = new ObjectOutputStream(ser);
+ objStream.writeObject(content);
+ objStream.flush();
+ ByteArrayInputStream in = new ByteArrayInputStream(ser.toByteArray());
+ ObjectInputStream objInput = new ObjectInputStream(in);
+ try {
+ content = (CacheContent) objInput.readObject();
+ } catch (ClassNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ content.send(this.response);
+ MockServletOutputStream mockStream = (MockServletOutputStream)
response.getOutputStream();
+ byte[] bs = mockStream.content();
+ assertEquals("Test", new String(bs));
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.framework.ajax.xmlfilter.CacheContent#getWriter(java.io.Writer)}.
+ * @throws IOException
+ */
+ public void testGetWriter() throws IOException {
+ CacheContent content = new CacheContent();
+ PrintWriter outputStream = content.getWriter();
+ outputStream.write("Test");
+ outputStream.flush();
+ outputStream.close();
+ ByteArrayOutputStream ser = new ByteArrayOutputStream(1024);
+ ObjectOutputStream objStream = new ObjectOutputStream(ser);
+ objStream.writeObject(content);
+ objStream.flush();
+ ByteArrayInputStream in = new ByteArrayInputStream(ser.toByteArray());
+ ObjectInputStream objInput = new ObjectInputStream(in);
+ try {
+ content = (CacheContent) objInput.readObject();
+ } catch (ClassNotFoundException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ content.send(this.response);
+ MockPrintWriter writer = (MockPrintWriter) response.getWriter();
+ char[] cs = writer.content();
+ assertEquals("Test", new String(cs));
+ }
+
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/ajax/xmlfilter/NekkoParserTest.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/ajax/xmlfilter/NekkoParserTest.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/ajax/xmlfilter/NekkoParserTest.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,91 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.framework.ajax.xmlfilter;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import junit.framework.TestCase;
+
+import org.ajax4jsf.framework.ajax.xmlfilter.nekko.NekkoParser;
+
+public class NekkoParserTest extends TestCase {
+
+ private NekkoParser parser;
+
+ protected void setUp() throws Exception {
+ parser = new NekkoParser();
+ parser.setInputEncoding("UTF-8");
+ parser.setOutputEncoding("UTF-8");
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ parser = null;
+ super.tearDown();
+ }
+
+ /*
+ * Test method for
'org.ajax4jsf.framework.ajax.xmlfilter.NekkoParser.parseHtml(Reader, Writer)'
+ */
+ public void testParseHtmlReaderWriter() {
+ String html =
"<html><body><table><tr><td>xxx</td></tr></table></body></html>";
+ ParseString(html);
+ }
+
+ public void testParseHtmlReaderWriter1() {
+ String html =
"<html><body><table><tr><td>xxx</td></tr><tr><td>xxx</td></tr></table></body></html>";
+ ParseString(html);
+ }
+ public void testParseHtmlReaderWriter2() {
+ String html =
"<html><body><table><tbody><tr><td>xxx</td></tr><tr><td>xxx</td></tr></tbody></table></body></html>";
+ ParseString(html);
+ }
+ public void testParseHtmlReaderWriter3() {
+ String html =
"<html><body><table><thead><tr><td>xxx</td></tr></thead><tr><td>xxx</td></tr></table></body></html>";
+ ParseString(html);
+ }
+ public void testParseHtmlReaderWriter4() {
+ String html =
"<html><body><table><span><tr><td>xxx</td></tr><tr><td>xxx</td></tr></span></table></body></html>";
+ ParseString(html);
+ }
+ /**
+ * @param html
+ */
+ private String ParseString(String html) {
+ Reader in = new StringReader(html);
+ StringWriter out = new StringWriter();
+ try {
+ parser.parseHtml(in,out);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ assertTrue("Io error in parser ",false);
+ }
+ String toString = out.toString();
+ System.out.println(toString);
+ return toString;
+ }
+
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/renderer/BeforeRendererListenerTestCase.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/renderer/BeforeRendererListenerTestCase.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/renderer/BeforeRendererListenerTestCase.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,95 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.framework.renderer;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+
+import org.ajax4jsf.framework.ajax.AjaxContext;
+import org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter;
+import org.ajax4jsf.framework.ajax.xmlfilter.FilterServletResponseWrapper;
+import org.ajax4jsf.renderkit.html.CommandButtonRenderer;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+/**
+ * @author asmirnov(a)exadel.com (latest modification by $Author: ishabalov $)
+ * @version $Revision: 1.1.2.4 $ $Date: 2007/02/20 20:58:09 $
+ *
+ */
+public class BeforeRendererListenerTestCase extends AbstractAjax4JsfTestCase {
+
+ /**
+ * @param name
+ */
+ public BeforeRendererListenerTestCase(String name) {
+ super(name);
+ // TODO Auto-generated constructor stub
+ }
+
+ /*
+ * @see VcpJsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ FilterServletResponseWrapper responseWrapper = new
FilterServletResponseWrapper(response);
+ request.setAttribute(BaseFilter.RESPONSE_WRAPPER_ATTRIBUTE, responseWrapper );
+ }
+
+ /*
+ * @see VcpJsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /*
+ * Test method for
'org.ajax4jsf.framework.renderer.BeforeRenderListener.afterPhase(PhaseEvent)'
+ */
+ public void testAfterPhase() throws Exception {
+ PhaseListener listener = new AjaxPhaseListener();
+ PhaseEvent event = new PhaseEvent(facesContext,PhaseId.RENDER_RESPONSE,lifecycle);
+ UIComponent ajaxButton = createComponent("org.ajax4jsf.ajax.AjaxButton",
"org.ajax4jsf.ajax.html.HtmlAjaxCommandButton",
"org.ajax4jsf.ajax.AjaxButton", CommandButtonRenderer.class, null);
+ facesContext.getViewRoot().getChildren().add(ajaxButton);
+ AjaxContext.getCurrentInstance(facesContext).setAjaxRequest(true);
+ // TODO Must be used different StateManager !
+// listener.afterPhase(event);
+// assertNotNull(externalContext.getRequestMap().get(AjaxPhaseListener.VIEW_STATE_SAVED_PARAM));
+// assertNull(externalContext.getRequestMap().get(AjaxContext.STYLES_PARAMETER));
+ }
+
+ /*
+ * Test method for
'org.ajax4jsf.framework.renderer.BeforeRenderListener.beforePhase(PhaseEvent)'
+ */
+ public void testBeforePhase() {
+
+ }
+
+ /*
+ * Test method for
'org.ajax4jsf.framework.renderer.BeforeRenderListener.isValueReference(String)'
+ */
+ public void testIsValueReference() {
+
+ }
+
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/renderer/ChameleonRenderKitImplTestCase.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/renderer/ChameleonRenderKitImplTestCase.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/renderer/ChameleonRenderKitImplTestCase.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,76 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.framework.renderer;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+/**
+ * @author asmirnov(a)exadel.com (latest modification by $Author: ishabalov $)
+ * @version $Revision: 1.1.2.2 $ $Date: 2007/02/20 20:58:09 $
+ *
+ */
+public class ChameleonRenderKitImplTestCase extends AbstractAjax4JsfTestCase {
+
+ /**
+ * @param name
+ */
+ public ChameleonRenderKitImplTestCase(String name) {
+ super(name);
+ // TODO Auto-generated constructor stub
+ }
+
+ /*
+ * @see VcpJsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /*
+ * @see VcpJsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /*
+ * Test method for
'org.ajax4jsf.framework.renderer.ChameleonRenderKitImpl.addRenderer(String, String,
Renderer)'
+ */
+ public void testAddRendererStringStringRenderer() {
+
+ }
+
+ /*
+ * Test method for
'org.ajax4jsf.framework.renderer.ChameleonRenderKitImpl.getRenderer(String,
String)'
+ */
+ public void testGetRendererStringString() {
+
+ }
+
+ /*
+ * Test method for
'org.ajax4jsf.framework.renderer.ChameleonRenderKitImpl.getDefaultRenderKit()'
+ */
+ public void testGetDefaultRenderKit() {
+
+ }
+
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/renderer/RenderTests.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/renderer/RenderTests.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/renderer/RenderTests.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,44 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.framework.renderer;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author asmirnov(a)exadel.com (latest modification by $Author: ishabalov $)
+ * @version $Revision: 1.1.2.2 $ $Date: 2007/02/20 20:58:10 $
+ *
+ */
+public class RenderTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(
+ "Test for org.ajax4jsf.framework.renderer");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(ChameleonRenderKitImplTestCase.class);
+ suite.addTestSuite(BeforeRendererListenerTestCase.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/AllResourcesTests.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/AllResourcesTests.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/AllResourcesTests.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,45 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.framework.resource;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author shura (latest modification by $Author: ishabalov $)
+ * @version $Revision: 1.1.2.2 $ $Date: 2007/02/20 20:58:10 $
+ *
+ */
+public class AllResourcesTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(
+ "Test for org.ajax4jsf.framework.resource");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(ResourceServiceThreadsTestCase.class);
+ suite.addTestSuite(InternetResourceServiceTestCase.class);
+ suite.addTestSuite(CSSTemplateTestCase.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/CSSTemplateTestCase.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/CSSTemplateTestCase.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/CSSTemplateTestCase.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,185 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.framework.resource;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import org.ajax4jsf.framework.renderer.compiler.TemplateContext;
+import org.ajax4jsf.framework.skin.SkinFactory;
+import org.ajax4jsf.framework.util.config.WebXml;
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.apache.shale.test.mock.MockPrintWriter;
+
+/**
+ * @author shura (latest modification by $Author: ishabalov $)
+ * @version $Revision: 1.1.2.4 $ $Date: 2007/02/20 20:58:10 $
+ *
+ */
+public class CSSTemplateTestCase extends AbstractAjax4JsfTestCase {
+
+ private static boolean methodCalled=false;
+
+ private static boolean methodParamOk=false;
+
+ /**
+ * Constructor for CSSTemplateTestCase.
+ * @param name
+ */
+ public CSSTemplateTestCase(String name) {
+ super(name);
+ }
+
+ /*
+ * @see VcpJsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ CSSTemplateTestCase.methodCalled=false;
+ CSSTemplateTestCase.methodParamOk=false;
+ }
+
+ /*
+ * @see VcpJsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testCallWithContext() throws Exception {
+ String templatePath = "org/ajax4jsf/framework/resource/call.xml";
+ TemplateCSSResource resource = new TemplateCSSResource(templatePath);
+ ResourceContext context = new FacesResourceContext(facesContext);
+ try {
+ resource.send(context);
+ } catch (IOException e) {
+ assertTrue("error send style",false);
+ }
+ assertTrue(methodCalled);
+ }
+
+ public static void contextCallWithParam(TemplateContext context,String param) {
+ methodCalled = true;
+ methodParamOk = "Test".equals(param);
+ }
+
+ public void testCallWithContextAndParam() throws Exception {
+ String templatePath = "org/ajax4jsf/framework/resource/callWithParam.xml";
+ TemplateCSSResource resource = new TemplateCSSResource(templatePath);
+ ResourceContext context = new FacesResourceContext(facesContext);
+ try {
+ resource.send(context);
+ } catch (IOException e) {
+ assertTrue("error send style",false);
+ }
+ assertTrue(methodCalled);
+ }
+
+ public static void contextCall(TemplateContext context) {
+ methodCalled = true;
+ }
+ /*
+ * Test method for
'org.ajax4jsf.framework.resource.TemplateCSSResource.send(ResourceContext)'
+ */
+ public void testSend() throws IOException {
+ String templatePath = "org/ajax4jsf/framework/resource/styles.xml";
+ TemplateCSSResource resource = new TemplateCSSResource(templatePath);
+ ResourceContext context = new FacesResourceContext(facesContext);
+ try {
+ resource.send(context);
+ } catch (IOException e) {
+ assertTrue("error send style",false);
+ }
+ MockPrintWriter printWriter = (MockPrintWriter) response.getWriter();
+ String content = String.valueOf(printWriter.content());
+ System.out.println(content);
+ }
+
+ /*
+ * Test method for
'org.ajax4jsf.framework.resource.TemplateCSSResource.TemplateCSSResource(String)'
+ */
+ public void testTemplateCSSResource() throws IOException {
+ String templatePath = "org/ajax4jsf/framework/resource/styles.xml";
+ TemplateCSSResource resource = new TemplateCSSResource(templatePath);
+ assertEquals(templatePath,resource.getKey());
+ InternetResource resource2 =
InternetResourceBuilder.getInstance().createResource(this,resource.getKey());
+ ResourceContext ctx = new FacesResourceContext(this.facesContext);
+ InputStream stream = resource.getResourceAsStream(ctx);
+ byte[] resourceContent = new byte[8196];
+ int length = stream.read(resourceContent);
+ InputStream stream2 = resource2.getResourceAsStream(ctx);
+ byte[] resource2Content = new byte[8196];
+ int length2 = stream2.read(resource2Content);
+ assertEquals(length, length2);
+
+ }
+
+ /*
+ * Test method for
'org.ajax4jsf.framework.resource.InternetResourceBase.isCacheable()'
+ */
+ public void testIsCacheable() {
+
+ }
+
+ /*
+ * Test method for
'org.ajax4jsf.framework.resource.InternetResourceBase.getContentType()'
+ */
+ public void testGetContentType() {
+
+ String templatePath = "org/ajax4jsf/framework/resource/styles.xml";
+ TemplateCSSResource resource = new TemplateCSSResource(templatePath);
+ assertEquals("text/css",resource.getContentType(null));
+}
+
+ /*
+ * Test method for
'org.ajax4jsf.framework.resource.InternetResourceBase.getUri(FacesContext,
Object)'
+ */
+ public void testGetUri() {
+ String templatePath = "org/ajax4jsf/framework/resource/styles.xml";
+ TemplateCSSResource resource = new TemplateCSSResource(templatePath);
+// System.out.println(resource.getUri(facesContext,null));
+ String expextedUri =
request.getContextPath()+"/"+WebXml.RESOURCE_URI_PREFIX+resource.getKey();
+// System.out.println(expextedUri);
+ assertTrue(resource.getUri(facesContext,null).startsWith(expextedUri));
+ }
+
+ /*
+ * Test method for
'org.ajax4jsf.framework.resource.InternetResourceBase.getResourceAsStream(ResourceContext)'
+ */
+ public void testGetResourceAsStream() {
+
+ }
+
+ /*
+ * Test method for
'org.ajax4jsf.framework.resource.InternetResourceBase.sendHeaders(ResourceContext)'
+ */
+ public void testSendHeaders() {
+ String templatePath = "org/ajax4jsf/framework/resource/styles.xml";
+ TemplateCSSResource resource = new TemplateCSSResource(templatePath);
+ ResourceContext context = new FacesResourceContext(facesContext);
+ resource.sendHeaders(context);
+ String header = response.getContentType();
+ assertNotNull(header);
+ assertTrue(header.startsWith("text/css"));
+ }
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/InternetResourceServiceTestCase.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/InternetResourceServiceTestCase.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/InternetResourceServiceTestCase.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,160 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.framework.resource;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.apache.shale.test.mock.MockServletOutputStream;
+
+import com.gargoylesoftware.htmlunit.Page;
+
+/**
+ * @author shura
+ *
+ */
+public class InternetResourceServiceTestCase extends AbstractAjax4JsfTestCase {
+
+ /**
+ * @param name
+ */
+ public InternetResourceServiceTestCase(String name) {
+ super(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#setUp()
+ */
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /* (non-Javadoc)
+ * @see org.ajax4jsf.tests.AbstractAjax4JsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ super.tearDown();
+ InternetResourceBuilder.setInstance(null);
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.framework.resource.InternetResourceService#init(javax.servlet.FilterConfig)}.
+ * @throws Exception
+ */
+ public void testInit() throws Exception {
+ InternetResourceService service = new InternetResourceService();
+ MockFilterConfig mockFilterConfig = new MockFilterConfig(servletContext);
+ mockFilterConfig.setInitParameter(InternetResourceService.ENABLE_CACHING_PARAMETER,
"true");
+ service.init(mockFilterConfig);
+ assertSame(servletContext, service.getServletContext());
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.framework.resource.InternetResourceService#serviceResource(java.lang.String,
javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)}.
+ * @throws IOException
+ * @throws Exception
+ */
+ public void testServiceResource() throws Exception, IOException {
+ InternetResourceService service = new InternetResourceService();
+ MockFilterConfig mockFilterConfig = new MockFilterConfig(servletContext);
+ mockFilterConfig.setInitParameter(InternetResourceService.ENABLE_CACHING_PARAMETER,
"true");
+ service.init(mockFilterConfig);
+ InternetResourceBuilder builder = InternetResourceBuilder.getInstance();
+ InternetResource resource = builder.createResource(this, "test.js");
+ MockResourceRequest resourceRequest = new MockResourceRequest(request);
+ String key = resource.getKey();
+ service.serviceResource(key,resourceRequest,response);
+ byte[] content = ((MockServletOutputStream)response.getOutputStream()).content();
+ String strContent = new String(content);
+ assertEquals(strContent, "\nfunction Test(){};");
+ response.setOutputStream(null);
+ response.setWriter(null);
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.framework.resource.InternetResourceService#serviceResource(java.lang.String,
javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)}.
+ * @throws IOException
+ * @throws Exception
+ */
+ public void testCachedServiceResource() throws Exception, IOException {
+ InternetResourceService service = new InternetResourceService();
+ MockFilterConfig mockFilterConfig = new MockFilterConfig(servletContext);
+ mockFilterConfig.setInitParameter(InternetResourceService.ENABLE_CACHING_PARAMETER,
"true");
+ service.init(mockFilterConfig);
+ InternetResourceBuilder builder = InternetResourceBuilder.getInstance();
+ InternetResource resource = builder.createResource(this,
MockCacheableResource.class.getName());
+ MockResourceRequest resourceRequest = new MockResourceRequest(request);
+ String key = resource.getKey();
+ for(int i=1;i<=10;i++){
+ service.serviceResource(key,resourceRequest,response);
+ byte[] content = ((MockServletOutputStream)response.getOutputStream()).content();
+ String strContent = new String(content);
+ assertEquals(strContent, "test");
+ assertEquals(((MockCacheableResource) resource).getCounter(), 1);
+ response.setOutputStream(null);
+ response.setWriter(null);
+ }
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.framework.resource.InternetResourceService#serviceResource(java.lang.String,
javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)}.
+ * @throws IOException
+ * @throws Exception
+ */
+ public void testCachedServiceExpiration() throws Exception, IOException {
+ InternetResourceService service = new InternetResourceService();
+ MockFilterConfig mockFilterConfig = new MockFilterConfig(servletContext);
+ mockFilterConfig.setInitParameter(InternetResourceService.ENABLE_CACHING_PARAMETER,
"true");
+ service.init(mockFilterConfig);
+ InternetResourceBuilder builder = InternetResourceBuilder.getInstance();
+ InternetResource resource = builder.createResource(this,
MockCacheableResource.class.getName());
+ MockResourceRequest resourceRequest = new MockResourceRequest(request);
+ String key = resource.getKey();
+ for(int j=1;j<=10;j++){
+ for(int i=1;i<=10;i++){
+ request.setPathElements(request.getContextPath(), request.getServletPath(),
request.getPathInfo(), String.valueOf(i));
+ service.serviceResource(key,resourceRequest,response);
+ byte[] content = ((MockServletOutputStream)response.getOutputStream()).content();
+ String strContent = new String(content);
+ assertEquals(strContent, "test");
+ response.setOutputStream(null);
+ response.setWriter(null);
+ }
+ }
+ int counter = ((MockCacheableResource) resource).getCounter();
+ assertTrue("Resource was generated "+counter+" times", counter<=
10);
+ }
+
+ public void testSendResource() {
+// fail("Not yet implemented");
+ }
+
+ /**
+ * Test method for {@link
org.ajax4jsf.framework.resource.InternetResourceService#getProperties(java.lang.String)}.
+ */
+ public void testGetProperties() {
+// fail("Not yet implemented");
+ }
+
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/MockCacheableResource.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/MockCacheableResource.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/MockCacheableResource.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,59 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.framework.resource;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+/**
+ * @author shura
+ *
+ */
+public class MockCacheableResource extends InternetResourceBase {
+
+ private int counter = 0;
+
+ public int getCounter() {
+ return counter;
+ }
+
+ /**
+ *
+ */
+ public MockCacheableResource() {
+ super();
+ setRenderer(new LogfileRenderer());
+ setCacheable(true);
+ }
+
+ public InputStream getResourceAsStream(ResourceContext context) {
+ counter++;
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return new ByteArrayInputStream("test".getBytes());
+ }
+
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/MockFilterConfig.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/MockFilterConfig.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/MockFilterConfig.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,98 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.framework.resource;
+
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletContext;
+
+/**
+ * @author shura
+ *
+ */
+public class MockFilterConfig implements FilterConfig {
+
+ private ServletContext servletContext;
+
+ private Map initParameters = new HashMap();
+
+ /**
+ * @param servletContext
+ */
+ public MockFilterConfig(ServletContext servletContext) {
+ super();
+ this.servletContext = servletContext;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.FilterConfig#getFilterName()
+ */
+ public String getFilterName() {
+ // TODO Auto-generated method stub
+ return "A4J";
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.FilterConfig#getInitParameter(java.lang.String)
+ */
+ public String getInitParameter(String arg0) {
+ // TODO Auto-generated method stub
+ return (String) initParameters.get(arg0);
+ }
+
+ public void setInitParameter(String name, String value) {
+ initParameters.put(name, value);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.FilterConfig#getInitParameterNames()
+ */
+ public Enumeration getInitParameterNames() {
+ final Iterator parametersIterator = initParameters.keySet().iterator();
+ return new Enumeration(){
+
+ public boolean hasMoreElements() {
+ // TODO Auto-generated method stub
+ return parametersIterator.hasNext();
+ }
+
+ public Object nextElement() {
+ // TODO Auto-generated method stub
+ return parametersIterator.next();
+ }
+
+ };
+ }
+
+ /* (non-Javadoc)
+ * @see javax.servlet.FilterConfig#getServletContext()
+ */
+ public ServletContext getServletContext() {
+ // TODO Auto-generated method stub
+ return servletContext;
+ }
+
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/MockResourceRequest.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/MockResourceRequest.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/MockResourceRequest.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,62 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.framework.resource;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.security.Principal;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.http.HttpSession;
+
+import org.apache.shale.test.mock.MockHttpServletRequest;
+
+/**
+ * @author shura
+ *
+ */
+public class MockResourceRequest extends HttpServletRequestWrapper {
+
+ private String method;
+
+ public MockResourceRequest(HttpServletRequest mockRequest) {
+ super(mockRequest);
+ method = "GET";
+ }
+
+ public String getMethod() {
+ return method;
+ }
+
+ public void setMethod(String method) {
+ this.method = method;
+ }
+
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/ParametersEncodingTestCase.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/ParametersEncodingTestCase.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/ParametersEncodingTestCase.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,47 @@
+package org.ajax4jsf.framework.resource;
+
+import java.util.Arrays;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+public class ParametersEncodingTestCase extends AbstractAjax4JsfTestCase {
+
+ private ResourceBuilderImpl builder;
+
+ private byte[] data = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
+
+ public ParametersEncodingTestCase(String arg0) {
+ super(arg0);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+ builder = new ResourceBuilderImpl();
+ }
+
+ public void tearDown() throws Exception {
+ builder = null;
+ super.tearDown();
+ }
+
+ public final void testEncrypt() {
+ byte[] bs = builder.encrypt(data);
+ byte[] bs2 = builder.decrypt(bs);
+ assertTrue(Arrays.equals(data, bs2));
+ }
+
+ public final void testDecryptLeak() {
+ byte[] bs = {};
+ for (int i = 0; i < 10000; i++) {
+ bs = builder.encrypt(data);
+
+ }
+ byte[] bs2={};
+ for (int i = 0; i < 10000; i++) {
+ bs2 = builder.decrypt(bs);
+
+ }
+ assertTrue(Arrays.equals(data, bs2));
+ }
+
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/ResourceServiceThreadsTestCase.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/ResourceServiceThreadsTestCase.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/resource/ResourceServiceThreadsTestCase.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,110 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.framework.resource;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.framework.skin.SkinThreadsTestCase.SkinTestRunnable;
+import org.ajax4jsf.tests.AbstractThreadedAjax4JsfTestCase;
+import org.ajax4jsf.tests.AbstractThreadedAjax4JsfTestCase.TestCaseRunnable;
+import org.apache.shale.test.mock.MockHttpServletRequest;
+import org.apache.shale.test.mock.MockHttpServletResponse;
+import org.apache.shale.test.mock.MockServletOutputStream;
+
+/**
+ * @author shura
+ *
+ */
+public class ResourceServiceThreadsTestCase extends AbstractThreadedAjax4JsfTestCase {
+
+ /**
+ * @param s
+ */
+ public ResourceServiceThreadsTestCase(String s) {
+ super(s);
+ // TODO Auto-generated constructor stub
+ }
+
+ InternetResourceService service;
+ String key;
+ InternetResource resource;
+
+ public void setUp() throws Exception {
+ super.setUp();
+ service = new InternetResourceService();
+ MockFilterConfig mockFilterConfig = new MockFilterConfig(servletContext);
+ mockFilterConfig.setInitParameter(InternetResourceService.ENABLE_CACHING_PARAMETER,
"true");
+ service.init(mockFilterConfig);
+ InternetResourceBuilder builder = InternetResourceBuilder.getInstance();
+ resource = builder.createResource(this, MockCacheableResource.class.getName());
+ key = resource.getKey();
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+ InternetResourceBuilder.setInstance(null);
+ resource = null;
+ service = null;
+ key=null;
+ }
+
+ public class ResourceRunner extends TestCaseRunnable {
+
+ private String data;
+
+
+ /**
+ * @param data
+ */
+ public ResourceRunner(String data) {
+ super();
+ this.data = data;
+ }
+
+
+ public void runTestCase(FacesContext context) throws Throwable {
+ MockHttpServletResponse response = new MockHttpServletResponse();
+ MockHttpServletRequest req = new MockHttpServletRequest(session);
+ req.setServletContext(servletContext);
+ req.setPathElements(request.getContextPath(), request.getServletPath(),
request.getPathInfo(), data);
+ MockResourceRequest resourceRequest = new MockResourceRequest(req);
+ service.serviceResource(key,resourceRequest,response);
+ byte[] content = ((MockServletOutputStream)response.getOutputStream()).content();
+ String strContent = new String(content);
+ assertEquals(strContent, "test");
+
+ }
+
+ }
+
+ public void testTreadServiceResource() {
+ TestCaseRunnable[] runnables = new TestCaseRunnable[1000];
+ for (int i = 0; i < runnables.length; i++) {
+ runnables[i] = new ResourceRunner(String.valueOf(i%10));
+
+ }
+ this.runTestCaseRunnables(runnables);
+ int counter = ((MockCacheableResource) resource).getCounter();
+ assertTrue("Resource was generated "+counter+" times", counter<=
10);
+
+ }
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/skin/Bean.java
===================================================================
--- branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/skin/Bean.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/skin/Bean.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,27 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.framework.skin;
+
+public class Bean {
+ public String getName(){return "bindedtest";}
+ public String getBean(){return "binded.string";}
+}
\ No newline at end of file
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/skin/SkinTestCase.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/skin/SkinTestCase.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/skin/SkinTestCase.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,326 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.framework.skin;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.faces.FacesException;
+import javax.faces.FactoryFinder;
+import javax.faces.application.Application;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+
+import junit.framework.TestCase;
+
+import org.easymock.MockControl;
+import org.easymock.classextension.MockClassControl;
+
+/**
+ * Test for Skin/skin factory methods.
+ * @author asmirnov(a)exadel.com (latest modification by $Author: alexsmirnov $)
+ * @version $Revision: 1.1.2.1 $ $Date: 2007/01/10 14:28:13 $
+ *
+ */
+public class SkinTestCase extends TestCase {
+ private MockControl contextControl;
+ private FacesContext mockContext;
+
+ private MockControl externalContextControl;
+ private ExternalContext mockExternalContext;
+
+ private TestApplicationFactory appFactory;
+
+ private MockControl bindingControl;
+ private ValueBinding mockBinding;
+ private MockControl bindingSkinControl;
+ private ValueBinding mockSkinBinding;
+
+ public SkinTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ contextControl = MockClassControl.createControl(FacesContext.class);
+ mockContext = (FacesContext) contextControl.getMock();
+ externalContextControl = MockClassControl.createControl(ExternalContext.class);
+ mockExternalContext = (ExternalContext) externalContextControl.getMock();
+ bindingControl = MockClassControl.createNiceControl(ValueBinding.class);
+ mockBinding = (ValueBinding) bindingControl.getMock();
+ bindingSkinControl = MockClassControl.createNiceControl(ValueBinding.class);
+ mockSkinBinding = (ValueBinding) bindingSkinControl.getMock();
+ FactoryFinder.releaseFactories();
+ FactoryFinder.setFactory(FactoryFinder.APPLICATION_FACTORY,
TestApplicationFactory.class.getName());
+ appFactory = (TestApplicationFactory)
FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ FactoryFinder.releaseFactories();
+ SkinFactory.reset();
+ super.tearDown();
+ }
+
+ /*
+ * Test method for 'org.ajax4jsf.framework.skin.SkinFactory.getInstance()'
+ */
+ public void testGetInstance() {
+ SkinFactory factory = SkinFactory.getInstance();
+ SkinFactory factory1 = SkinFactory.getInstance();
+ assertSame(factory,factory1);
+ }
+
+ /*
+ * Test method for
'org.ajax4jsf.framework.skin.SkinFactory.getSkin(FacesContext)'
+ */
+ public void testGetSkin() {
+ SkinFactory factory = SkinFactory.getInstance();
+ // setup context mock
+ mockContext.getExternalContext();
+ contextControl.setReturnValue(mockExternalContext);
+ contextControl.replay();
+ // setup External context mock
+ mockExternalContext.getInitParameter(SkinFactory.SKIN_PARAMETER);
+ externalContextControl.setReturnValue("test");
+ externalContextControl.replay();
+ // setup Application mock
+ Application app = appFactory.getApplication();
+ app.createValueBinding("#{test.bean}");
+ appFactory.getApplicationControl().setReturnValue(mockBinding);
+ appFactory.getApplicationControl().replay();
+ // setup Value binding mock.
+ mockBinding.getValue(mockContext);
+ bindingControl.setReturnValue("test.value");
+ mockBinding.getValue(mockContext);
+ bindingControl.setReturnValue("test.value1");
+ bindingControl.setDefaultReturnValue("test.value");
+ bindingControl.replay();
+ // test call
+ Skin skin = factory.getSkin(mockContext);
+ // calls control
+ contextControl.verify();
+ externalContextControl.verify();
+ appFactory.getApplicationControl().verify();
+ assertNotNull("Null skin!",skin);
+ // test properties
+ assertEquals("string",skin.getParameter(mockContext,"string.property"));
+ assertEquals("base.string",skin.getParameter(mockContext,"base.property"));
+ assertEquals("test.value",skin.getParameter(mockContext,"bind.property"));
+// assertEquals("HTML_BASIC",skin.getRenderKitId(mockContext));
+ }
+
+ /*
+ * Test method for
'org.ajax4jsf.framework.skin.SkinFactory.getSkin(FacesContext)'
+ */
+ public void testSkinReferences() {
+ SkinFactory factory = SkinFactory.getInstance();
+ // setup context mock
+ mockContext.getExternalContext();
+ contextControl.setReturnValue(mockExternalContext);
+ contextControl.replay();
+ // setup External context mock
+ mockExternalContext.getInitParameter(SkinFactory.SKIN_PARAMETER);
+ externalContextControl.setReturnValue("test");
+ externalContextControl.replay();
+ // setup Application mock
+ Application app = appFactory.getApplication();
+ app.createValueBinding("#{test.bean}");
+ appFactory.getApplicationControl().setReturnValue(mockBinding);
+ appFactory.getApplicationControl().replay();
+ // setup Value binding mock.
+ mockBinding.getValue(mockContext);
+ bindingControl.setReturnValue("test.value");
+ mockBinding.getValue(mockContext);
+ bindingControl.setReturnValue("test.value1");
+ bindingControl.setDefaultReturnValue("test.value");
+ bindingControl.replay();
+ // test call
+ Skin skin = factory.getSkin(mockContext);
+ // calls control
+ contextControl.verify();
+ externalContextControl.verify();
+ appFactory.getApplicationControl().verify();
+ assertNotNull("Null skin!",skin);
+ assertEquals("default",skin.getParameter(mockContext,"c"));
+ assertEquals("yyy",skin.getParameter(mockContext,"y"));
+ }
+
+ /*
+ * Test method for
'org.ajax4jsf.framework.skin.SkinFactory.getSkin(FacesContext)'
+ */
+ public void testCyclicSkinReferences() {
+ SkinFactory factory = SkinFactory.getInstance();
+ // setup context mock
+ mockContext.getExternalContext();
+ contextControl.setReturnValue(mockExternalContext);
+ contextControl.replay();
+ // setup External context mock
+ mockExternalContext.getInitParameter(SkinFactory.SKIN_PARAMETER);
+ externalContextControl.setReturnValue("cyclic");
+ externalContextControl.replay();
+ // test call
+ try {
+ Skin skin = factory.getSkin(mockContext);
+ } catch(FacesException e){
+ return;
+ }
+ assertTrue(false);
+ }
+
+ /*
+ * Test method for
'org.ajax4jsf.framework.skin.SkinFactory.getSkin(FacesContext)'
+ */
+ public void testBadSkinReferences() {
+ SkinFactory factory = SkinFactory.getInstance();
+ // setup context mock
+ mockContext.getExternalContext();
+ contextControl.setReturnValue(mockExternalContext);
+ contextControl.replay();
+ // setup External context mock
+ mockExternalContext.getInitParameter(SkinFactory.SKIN_PARAMETER);
+ externalContextControl.setReturnValue("noref");
+ externalContextControl.replay();
+ // test call
+ try {
+ Skin skin = factory.getSkin(mockContext);
+ } catch(FacesException e){
+ return;
+ }
+ assertTrue(false);
+ }
+ /*
+ * Test method for
'org.ajax4jsf.framework.skin.SkinFactory.getSkin(FacesContext)'
+ */
+ public void testGetBindedSkin() {
+ SkinFactory factory = SkinFactory.getInstance();
+ // setup context mock
+ mockContext.getExternalContext();
+ contextControl.setReturnValue(mockExternalContext);
+ mockContext.getApplication();
+ contextControl.setReturnValue(appFactory.getApplication());
+ contextControl.replay();
+ // setup External context mock
+ mockExternalContext.getInitParameter(SkinFactory.SKIN_PARAMETER);
+ externalContextControl.setReturnValue("#{test.skin}");
+ externalContextControl.replay();
+ // setup Application mock
+ Application app = appFactory.getApplication();
+ app.createValueBinding("#{test.skin}");
+ appFactory.getApplicationControl().setReturnValue(mockSkinBinding);
+ app.createValueBinding("#{test.bean}");
+ appFactory.getApplicationControl().setReturnValue(mockBinding);
+ appFactory.getApplicationControl().replay();
+ // setup Value binding mock.
+ mockBinding.getValue(mockContext);
+ bindingControl.setReturnValue("binded.test.value");
+ bindingControl.replay();
+ // skin EL binding.
+ mockSkinBinding.getValue(mockContext);
+ bindingSkinControl.setDefaultReturnValue("bindedtest");
+ bindingSkinControl.replay();
+ // test call
+ Skin skin = factory.getSkin(mockContext);
+ assertNotNull("Null skin!",skin);
+ // test properties
+ assertEquals("bindedstring",skin.getParameter(mockContext,"string.property"));
+// assertEquals("base.string",skin.getParameter(mockContext,"base.property"));
+ assertEquals("binded.test.value",skin.getParameter(mockContext,"bind.property"));
+ assertEquals("TEST",skin.getRenderKitId(mockContext));
+
+
+ // calls control
+// contextControl.verify();
+// externalContextControl.verify();
+// appFactory.getApplicationControl().verify();
+// bindingControl.verify();
+// bindingSkinControl.verify();
+}
+
+ public void testSkinHash() {
+ SkinFactory factory = SkinFactory.getInstance();
+ // setup context mock
+ mockContext.getExternalContext();
+ contextControl.setDefaultReturnValue(mockExternalContext);
+ mockContext.getApplication();
+ contextControl.setReturnValue(appFactory.getApplication());
+ contextControl.replay();
+ // setup External context mock
+ mockExternalContext.getInitParameter(SkinFactory.SKIN_PARAMETER);
+ externalContextControl.setReturnValue("#{test.skin}");
+ Map params = new HashMap();
+ mockExternalContext.getRequestMap();
+ externalContextControl.setDefaultReturnValue(params);
+ externalContextControl.replay();
+ // setup Application mock
+ Application app = appFactory.getApplication();
+ app.createValueBinding("#{test.skin}");
+ appFactory.getApplicationControl().setReturnValue(mockSkinBinding);
+ app.createValueBinding("#{test.bean}");
+ appFactory.getApplicationControl().setReturnValue(mockBinding);
+ appFactory.getApplicationControl().replay();
+ // setup Value binding mock.
+ mockBinding.getValue(mockContext);
+ bindingControl.setDefaultReturnValue("binded.test.value");
+ bindingControl.replay();
+ // skin EL binding.
+ mockSkinBinding.getValue(mockContext);
+ bindingSkinControl.setDefaultReturnValue("bindedtest");
+ bindingSkinControl.replay();
+ // test call
+ Skin skin = factory.getSkin(mockContext);
+ assertNotNull("Null skin!",skin);
+ // test properties
+ int hash = skin.hashCode(mockContext);
+ assertTrue(params.containsKey(SkinImpl.REQUEST_HASH_CODE_PARAMETER));
+ assertEquals(hash,skin.hashCode(mockContext));
+ params.clear();
+ assertEquals(hash,skin.hashCode(mockContext));
+ // setup Value binding mock for different value - hash must differ.
+ params.clear();
+ bindingControl.reset();
+ mockBinding.getValue(mockContext);
+ bindingControl.setDefaultReturnValue("other.test.value");
+ bindingControl.replay();
+ assertFalse( hash==skin.hashCode(mockContext) );
+
+ }
+ /*
+ * Test method for
'org.ajax4jsf.framework.skin.SkinFactory.getDefaultProperties()'
+ */
+ public void testGetDefaultProperties() {
+ SkinFactoryImpl factory = (SkinFactoryImpl) SkinFactory.getInstance();
+ Properties defaultProps = factory.getDefaultSkinProperties();
+// assertEquals("HTML_BASIC",defaultProps.getProperty("render.kit"));
+ // Second default config
+ assertEquals("default",defaultProps.getProperty("a"));
+ }
+
+ /*
+ * Test method for
'org.ajax4jsf.framework.skin.SkinFactory.getSkinName(FacesContext)'
+ */
+ public void testGetSkinName() {
+
+ }
+
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/skin/SkinTests.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/skin/SkinTests.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/skin/SkinTests.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,39 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.framework.skin;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class SkinTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(
+ "Test for org.ajax4jsf.framework.skin");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(SkinThreadsTestCase.class);
+ suite.addTestSuite(SkinTestCase.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/skin/SkinThreadsTestCase.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/skin/SkinThreadsTestCase.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/skin/SkinThreadsTestCase.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,110 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.framework.skin;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.tests.AbstractThreadedAjax4JsfTestCase;
+
+/**
+ * @author asmirnov(a)exadel.com (latest modification by $Author: ishabalov $)
+ * @version $Revision: 1.1.2.2 $ $Date: 2007/02/20 20:58:11 $
+ *
+ */
+public class SkinThreadsTestCase extends AbstractThreadedAjax4JsfTestCase {
+
+ /**
+ * @param s
+ */
+ public SkinThreadsTestCase(String s) {
+ super(s);
+ // TODO Auto-generated constructor stub
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.exadel.vcp.tests.VcpJsfTestCase#setUp()
+ */
+public void setUp() throws Exception {
+ // TODO Auto-generated method stub
+ super.setUp();
+ servletContext.setAttribute("skin", new Bean());
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.exadel.vcp.tests.VcpJsfTestCase#tearDown()
+ */
+ public void tearDown() throws Exception {
+ // TODO Auto-generated method stub
+ super.tearDown();
+ }
+
+
+ public class SkinTestRunnable extends TestCaseRunnable {
+
+
+ /**
+ *
+ */
+ public SkinTestRunnable() {
+ // TODO Auto-generated constructor stub
+ }
+
+ /* (non-Javadoc)
+ * @see
com.exadel.vcp.tests.ThreadedVcpJsfTestCase.TestCaseRunnable#runTestCase(javax.faces.context.FacesContext)
+ */
+ public void runTestCase(FacesContext context) throws Throwable {
+ context.getExternalContext().getRequestMap().put("test", new Bean());
+ Skin skin = SkinFactory.getInstance().getSkin(context);
+ assertNotNull(skin);
+ assertEquals("TEST", skin.getRenderKitId(context));
+ assertEquals("binded.string", skin.getParameter(context,
"bind.property"));
+ assertEquals("bindedstring", skin.getParameter(context,
"string.property"));
+ assertEquals("10", skin.getParameter(context, "int.property"));
+ assertNull(skin.getParameter(context, "notexist"));
+ }
+
+ }
+
+ /**
+ * Test skin factory for thread-safe.
+ */
+ public void testThreadsafe() {
+ TestCaseRunnable[] runnables = new TestCaseRunnable[20];
+ for (int i = 0; i < runnables.length; i++) {
+ runnables[i] = new SkinTestRunnable();
+
+ }
+ this.runTestCaseRunnables(runnables);
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.exadel.vcp.tests.VcpJsfTestCase#getSkinName()
+ */
+ protected String getSkinName() {
+ // TODO Auto-generated method stub
+ return "#{skin.name}";
+ }
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/skin/TestApplicationFactory.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/skin/TestApplicationFactory.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/skin/TestApplicationFactory.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,115 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.framework.skin;
+
+
+
+import javax.faces.application.Application;
+
+import javax.faces.application.ApplicationFactory;
+
+
+
+import org.easymock.MockControl;
+
+import org.easymock.classextension.MockClassControl;
+
+
+
+/**
+
+ * @author asmirnov(a)exadel.com (latest modification by $Author: ishabalov $)
+
+ * @version $Revision: 1.1.2.2 $ $Date: 2007/02/20 20:58:11 $
+
+ *
+
+ */
+
+public class TestApplicationFactory extends ApplicationFactory {
+
+
+
+ private MockControl applicationControl;
+
+ private Application mockApplication;
+
+
+
+ public TestApplicationFactory(){
+
+ applicationControl = MockClassControl.createControl(Application.class);
+
+ mockApplication = (Application) applicationControl.getMock();
+
+ }
+
+
+
+ /* (non-Javadoc)
+
+ * @see javax.faces.application.ApplicationFactory#getApplication()
+
+ */
+
+ public Application getApplication() {
+
+ // TODO Auto-generated method stub
+
+ return mockApplication;
+
+ }
+
+
+
+ /* (non-Javadoc)
+
+ * @see
javax.faces.application.ApplicationFactory#setApplication(javax.faces.application.Application)
+
+ */
+
+ public void setApplication(Application arg0) {
+
+ // TODO Auto-generated method stub
+
+
+
+ }
+
+
+
+ /**
+
+ * @return Returns the applicationControl.
+
+ */
+
+ public MockControl getApplicationControl() {
+
+ return applicationControl;
+
+ }
+
+
+
+}
+
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/util/config/AllTests.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/util/config/AllTests.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/util/config/AllTests.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,38 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.framework.util.config;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(
+ "Test for org.ajax4jsf.framework.util.config");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(WebXmlTest.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+}
Added:
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/util/config/WebXmlTest.java
===================================================================
---
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/util/config/WebXmlTest.java
(rev 0)
+++
branches/refactor1/framework/test/src/test/java/org/ajax4jsf/framework/util/config/WebXmlTest.java 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,120 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.framework.util.config;
+
+import java.io.InputStream;
+
+import javax.servlet.ServletException;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+import org.apache.shale.test.mock.MockServletContext;
+
+public class WebXmlTest extends AbstractAjax4JsfTestCase {
+
+ MockServletContext context;
+
+ public WebXmlTest(String arg0) {
+ super(arg0);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+ context = new MockServletContext(){
+
+ /* (non-Javadoc)
+ * @see
org.apache.shale.test.mock.MockServletContext#getResourceAsStream(java.lang.String)
+ */
+ public InputStream getResourceAsStream(String uri) {
+ if(uri.equals(WebXml.WEB_XML)){
+ return this.getClass().getResourceAsStream("/WEB-INF/complex-web.xml");
+ } else {
+ return super.getResourceAsStream(uri);
+ }
+ }
+
+ };
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ /*
+ * Test method for 'org.ajax4jsf.framework.util.config.WebXml.reset()'
+ */
+ public void testReset() {
+
+ }
+
+ /*
+ * Test method for 'org.ajax4jsf.framework.util.config.WebXml.init(ServletContext,
String)'
+ */
+ public void testInit() throws ServletException {
+ WebXml webXml = new WebXml();
+ webXml.init(context,"ajax4jsf");
+ assertFalse(webXml.isPrefixMapping());
+ assertNull(webXml.getFacesFilterPrefix());
+ assertNotNull(webXml.getFacesFilterSuffix());
+ assertEquals(".jsf",webXml.getFacesFilterSuffix());
+ }
+
+ /*
+ * Test method for 'org.ajax4jsf.framework.util.config.WebXml.getInstance()'
+ */
+ public void testGetInstance() {
+
+ }
+
+ /*
+ * Test method for
'org.ajax4jsf.framework.util.config.WebXml.getFacesResourceURL(FacesContext,
String)'
+ */
+ public void testGetFacesResourceURL() throws ServletException {
+ WebXml webXml = new WebXml();
+ webXml.init(context,"ajax4jsf");
+ String resourceURL = webXml.getFacesResourceURL(facesContext,"foo.Bar");
+ System.out.println(resourceURL);
+ assertEquals("/testContext/"+WebXml.RESOURCE_URI_PREFIX+"foo.Bar.jsf",resourceURL);
+
+ }
+
+ /*
+ * Test method for
'org.ajax4jsf.framework.util.config.WebXml.getFacesResourceKey(HttpServletRequest)'
+ */
+ public void testGetFacesResourceKey() {
+
+ }
+
+ /*
+ * Test method for
'org.ajax4jsf.framework.util.config.WebXml.isFacesRequest(HttpServletRequest)'
+ */
+ public void testIsFacesRequest() {
+
+ }
+
+ /*
+ * Test method for
'org.ajax4jsf.framework.util.config.WebXml.setFilterName(String)'
+ */
+ public void testSetFilterName() {
+
+ }
+
+}
Added:
branches/refactor1/framework/test/src/test/resources/META-INF/skins/DEFAULT.skin.properties
===================================================================
---
branches/refactor1/framework/test/src/test/resources/META-INF/skins/DEFAULT.skin.properties
(rev 0)
+++
branches/refactor1/framework/test/src/test/resources/META-INF/skins/DEFAULT.skin.properties 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,11 @@
+customFormColor=#F5F0E7
+a=default
+
+b=&a
+
+c=&b
+
+x=xxx
+
+y=&x
+
Added:
branches/refactor1/framework/test/src/test/resources/META-INF/skins/cyclic.skin.properties
===================================================================
---
branches/refactor1/framework/test/src/test/resources/META-INF/skins/cyclic.skin.properties
(rev 0)
+++
branches/refactor1/framework/test/src/test/resources/META-INF/skins/cyclic.skin.properties 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,4 @@
+base.property=base.string
+
+x=&x
+
Added:
branches/refactor1/framework/test/src/test/resources/META-INF/skins/noref.skin.properties
===================================================================
---
branches/refactor1/framework/test/src/test/resources/META-INF/skins/noref.skin.properties
(rev 0)
+++
branches/refactor1/framework/test/src/test/resources/META-INF/skins/noref.skin.properties 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,4 @@
+base.property=base.string
+
+x=&z
+
Added:
branches/refactor1/framework/test/src/test/resources/META-INF/skins/style.skin.properties
===================================================================
---
branches/refactor1/framework/test/src/test/resources/META-INF/skins/style.skin.properties
(rev 0)
+++
branches/refactor1/framework/test/src/test/resources/META-INF/skins/style.skin.properties 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,3 @@
+generalStyleSheet=resource\://skin/style.xcss
+intermediateTextColor=&customFormColor
+generalTextColor=&intermediateTextColor
\ No newline at end of file
Added:
branches/refactor1/framework/test/src/test/resources/META-INF/skins/test.skin.properties
===================================================================
---
branches/refactor1/framework/test/src/test/resources/META-INF/skins/test.skin.properties
(rev 0)
+++
branches/refactor1/framework/test/src/test/resources/META-INF/skins/test.skin.properties 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,4 @@
+base.property=base.string
+
+x=yyy
+
Added: branches/refactor1/framework/test/src/test/resources/WEB-INF/complex-web.xml
===================================================================
--- branches/refactor1/framework/test/src/test/resources/WEB-INF/complex-web.xml
(rev 0)
+++
branches/refactor1/framework/test/src/test/resources/WEB-INF/complex-web.xml 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,328 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+
+ <display-name>Flex Enterprise Services</display-name>
+ <description>Flex Enterprise Services Application</description>
+
+ <context-param>
+ <param-name>flex.class.path</param-name>
+ <param-value>/WEB-INF/flex/hotfixes,/WEB-INF/flex/jars</param-value>
+ </context-param>
+
+
+ <context-param>
+ <param-name>javax.faces.CONFIG_FILES</param-name>
+ <param-value>/WEB-INF/faces-config.xml</param-value>
+ <description>Comma separated list of URIs of (additional) faces config files.
+ (e.g. /WEB-INF/my-config.xml)
+ See JSF 1.0 PRD2, 10.3.2</description>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>client</param-value>
+ <description>State saving method: "client" or "server" (=
default)
+ See JSF Specification 2.5.2</description>
+ </context-param>
+ <context-param>
+ <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
+ <param-value>true</param-value>
+ <description>This parameter tells MyFaces if javascript code should be allowed
in the
+ rendered HTML output.
+ If javascript is allowed, command_link anchors will have javascript code
+ that submits the corresponding form.
+ If javascript is not allowed, the state saving info and nested parameters
+ will be added as url parameters.
+ Default: "true"</description>
+ </context-param>
+ <context-param>
+ <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
+ <param-value>true</param-value>
+ <description>If true, rendered HTML code will be formatted, so that it is
"human readable".
+ i.e. additional line separators and whitespace will be written, that do not
+ influence the HTML code.
+ Default: "true"</description>
+ </context-param>
+ <context-param>
+ <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
+ <param-value>false</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
+ <param-value>true</param-value>
+ <description>If true, a javascript function will be rendered that is able to
restore the
+ former vertical scroll on every request. Convenient feature if you have
pages
+ with long lists and you do not want the browser page to always jump to the
top
+ if you trigger a link or button action that stays on the same page.
+ Default: "false"</description>
+ </context-param>
+ <context-param>
+ <param-name>tiles-definitions</param-name>
+ <param-value>/WEB-INF/tiles.xml</param-value>
+ </context-param>
+ <context-param>
+<param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
+<param-value>org.apache.myfaces.application.jsp.JspTilesViewHandlerImpl</param-value>
+</context-param>
+
+
+ <filter>
+ <filter-name>extensionsFilter</filter-name>
+
<filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
+ <init-param>
+ <param-name>uploadMaxFileSize</param-name>
+ <param-value>10m</param-value>
+ <description>Set the size limit for uploaded files.
+ Format: 10 - 10 bytes
+ 10k - 10 KB
+ 10m - 10 MB
+ 1g - 1 GB</description>
+ </init-param>
+ <init-param>
+ <param-name>uploadThresholdSize</param-name>
+ <param-value>1k</param-value>
+ <description>Set the threshold size - files
+ below this limit are stored in memory, files above
+ this limit are stored on disk.
+
+ Format: 10 - 10 bytes
+ 10k - 10 KB
+ 10m - 10 MB
+ 1g - 1 GB
+ </description>
+ </init-param>
+ </filter>
+ <!-- Shale Application Controller Filter -->
+ <filter>
+ <filter-name>shale</filter-name>
+ <filter-class>
+ org.apache.shale.faces.ShaleApplicationFilter
+ </filter-class>
+ </filter>
+ <filter>
+ <filter-name>security</filter-name>
+ <filter-class>
+ com.pfizer.eNCA.filter.SecurityFilter
+ </filter-class>
+ </filter>
+ <filter>
+ <filter-name>ajax4jsf</filter-name>
+ <filter-class>org.ajax4jsf.Filter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>ajax4jsf</filter-name>
+ <servlet-name>Faces Servlet</servlet-name>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>shale</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>extensionsFilter</filter-name>
+ <url-pattern>*.jsf</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>extensionsFilter</filter-name>
+ <url-pattern>/faces/*</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>security</filter-name>
+ <url-pattern>/jsp/*</url-pattern>
+ </filter-mapping>
+
+ <listener>
+
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
+ </listener>
+ <!-- Commons Chain Configuration Listener -->
+ <listener>
+
<listener-class>org.apache.commons.chain.web.ChainListener</listener-class>
+ </listener>
+ <listener>
+ <listener-class>com.pfizer.eNCA.util.SessionListener</listener-class>
+ </listener>
+
+ <!-- MessageBroker Servlet -->
+ <servlet>
+ <servlet-name>MessageBrokerServlet</servlet-name>
+ <display-name>MessageBrokerServlet</display-name>
+ <servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>
+ <init-param>
+ <param-name>services.configuration.file</param-name>
+
<param-value>/WEB-INF/flex/flex-enterprise-services.xml</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet>
+ <servlet-name>FlexMxmlServlet</servlet-name>
+ <display-name>MXML Processor</display-name>
+ <description>Servlet wrapper for the Mxml Compiler</description>
+ <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class>
+ <init-param>
+ <param-name>servlet.class</param-name>
+ <param-value>flex2.server.j2ee.MxmlServlet</param-value>
+ </init-param>
+ <init-param>
+ <param-name>webtier.configuration.file</param-name>
+ <param-value>/WEB-INF/flex/flex-webtier-config.xml</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet>
+ <servlet-name>FlexSwfServlet</servlet-name>
+ <display-name>SWF Retriever</display-name>
+ <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class>
+ <init-param>
+ <param-name>servlet.class</param-name>
+ <param-value>flex2.server.j2ee.SwfServlet</param-value>
+ </init-param>
+ <!-- SwfServlet must be initialized after MxmlServlet -->
+ <load-on-startup>2</load-on-startup>
+ </servlet>
+
+ <servlet>
+ <servlet-name>FlexInternalServlet</servlet-name>
+ <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class>
+ <init-param>
+ <param-name>servlet.class</param-name>
+
<param-value>flex.server.j2ee.filemanager.FileManagerServlet</param-value>
+ </init-param>
+ <load-on-startup>10</load-on-startup>
+ </servlet>
+
+
+
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet>
+ <servlet-name>updateRequest</servlet-name>
+ <servlet-class>com.pfizer.eNCA.servlets.AJAXServlet</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>treeRequest</servlet-name>
+
<servlet-class>com.pfizer.eNCA.servlets.TreeStateServlet</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>renderExcel</servlet-name>
+ <servlet-class>com.pfizer.eNCA.servlets.RenderExcel</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>renderSPlus</servlet-name>
+ <servlet-class>com.pfizer.eNCA.servlets.RenderSPlus</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>pkFile</servlet-name>
+
<servlet-class>com.pfizer.eNCA.servlets.PKFileReaderServlet</servlet-class>
+ <init-param>
+ <param-name>requiredSessionObject</param-name>
+ <param-value>loggedInUser</param-value>
+ <description>Require Session Object for Security</description>
+ </init-param>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>MessageBrokerServlet</servlet-name>
+ <url-pattern>/messagebroker/*</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>FlexMxmlServlet</servlet-name>
+ <url-pattern>*.mxml</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>FlexSwfServlet</servlet-name>
+ <url-pattern>*.swf</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>FlexInternalServlet</servlet-name>
+ <url-pattern>/flex-internal/*</url-pattern>
+ </servlet-mapping>
+
+
+ <servlet-mapping>
+ <servlet-name>renderExcel</servlet-name>
+ <url-pattern>renderexcel.csv</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>renderSPlus</servlet-name>
+ <url-pattern>rendersplus.sdd</url-pattern>
+ </servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>updateRequest</servlet-name>
+ <url-pattern>/updateRequest/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>treeRequest</servlet-name>
+ <url-pattern>/treeRequest/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>pkFile</servlet-name>
+ <url-pattern>/pk/*</url-pattern>
+ </servlet-mapping>
+ <mime-mapping>
+ <extension>doc</extension>
+ <mime-type>application/msword</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>xls</extension>
+ <mime-type>application/vnd.ms-excel</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>ppt</extension>
+ <mime-type>application/vnd.ms-powerpoint</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>swf</extension>
+ <mime-type>application/x-shockwave-flash</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>pdf</extension>
+ <mime-type>application/pdf</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>inc</extension>
+ <mime-type>text/html</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>zip</extension>
+ <mime-type>application/zip</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>exe</extension>
+ <mime-type>application/octet-stream</mime-type>
+ </mime-mapping>
+ <mime-mapping>
+ <extension>csv</extension>
+ <mime-type>application/x-csv</mime-type>
+ </mime-mapping>
+ <welcome-file-list>
+ <welcome-file>/jsp/index.jsp</welcome-file>
+ </welcome-file-list>
+ <taglib>
+ <
taglib-uri>http://struts.apache.org/tags-tiles</taglib-uri>
+ <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
+ </taglib>
+
+ <security-constraint>
+ <display-name>Restrict access to JSP pages</display-name>
+ <web-resource-collection>
+ <web-resource-name>Restrict access to JSP pages</web-resource-name>
+ <url-pattern>/jsp/*.jsp</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <description>With no roles defined, no access granted</description>
+ </auth-constraint>
+ </security-constraint>
+</web-app>
+
Added: branches/refactor1/framework/test/src/test/resources/WEB-INF/web.xml
===================================================================
--- branches/refactor1/framework/test/src/test/resources/WEB-INF/web.xml
(rev 0)
+++ branches/refactor1/framework/test/src/test/resources/WEB-INF/web.xml 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+ <display-name>testcase</display-name>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.CONFIG_FILES</param-name>
+ <param-value>/WEB-INF/faces-config.xml</param-value>
+ </context-param>
+
+ <filter>
+ <description>Convert HTML to XML</description>
+ <display-name>Filter</display-name>
+ <filter-name>A4J</filter-name>
+ <filter-class>org.ajax4jsf.Filter</filter-class>
+ <init-param>
+ <param-name>publicid</param-name>
+ <param-value>-//W3C//DTD XHTML 1.0 Transitional//EN</param-value>
+ </init-param>
+ <init-param>
+ <param-name>systemid</param-name>
+
<
param-value>http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd<...
+ </init-param>
+ <init-param>
+ <param-name>namespace</param-name>
+ <
param-value>http://www.w3.org/1999/xhtml</param-value>
+ </init-param>
+ <init-param>
+ <param-name>forceparser</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ <init-param>
+ <param-name>rewriteid</param-name>
+ <param-value>false</param-value>
+ </init-param>
+ <init-param>
+ <param-name>mime-type</param-name>
+ <param-value>text/xml</param-value>
+ </init-param>
+ <init-param>
+ <param-name>log4j-init-file</param-name>
+ <param-value>WEB-INF/log4j.xml</param-value>
+ </init-param>
+ <init-param>
+ <param-name>enable-cache</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ </filter>
+ <filter-mapping>
+ <filter-name>A4J</filter-name>
+ <url-pattern>*.jsf</url-pattern>
+ </filter-mapping>
+ <filter-mapping>
+ <filter-name>A4J</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+ <listener>
+ <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
+ </listener>
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+</web-app>
Added: branches/refactor1/framework/test/src/test/resources/bindedtest.skin.properties
===================================================================
--- branches/refactor1/framework/test/src/test/resources/bindedtest.skin.properties
(rev 0)
+++
branches/refactor1/framework/test/src/test/resources/bindedtest.skin.properties 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,4 @@
+render.kit=TEST
+string.property=bindedstring
+int.property=10
+bind.property=\#{test.bean}
Added: branches/refactor1/framework/test/src/test/resources/log4j.xml
===================================================================
--- branches/refactor1/framework/test/src/test/resources/log4j.xml
(rev 0)
+++ branches/refactor1/framework/test/src/test/resources/log4j.xml 2007-06-28 21:59:51 UTC
(rev 1395)
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Copyright 1999-2004 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+
http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE log4j:configuration SYSTEM
"file:///eclipse/dtdcache/log4j.dtd">
+
+<log4j:configuration
xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+ <!-- This is a sample configuration for log4j.
+ It simply just logs everything into a single
+ log file.
+ Note, that you can use properties for value substitution.
+ -->
+ <appender name="DEFAULT"
class="org.apache.log4j.ConsoleAppender">
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%t %-5p %c{2} -
%m:%n"/>
+ </layout>
+ </appender>
+
+<!--
+ <appender name="FACES"
class="org.apache.log4j.ConsoleAppender">
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%t %-5p %c{2} -
%m:%n"/>
+ </layout>
+ </appender>
+
+ <appender name="CHAMELEON"
class="org.apache.log4j.ConsoleAppender">
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%t %-5p %c{2} -
%m:%n"/>
+ </layout>
+ </appender>
+ -->
+ <category name="com.sun.faces">
+ <priority value="INFO" />
+ <appender-ref ref="DEFAULT"/>
+ </category>
+
+ <category name="org.apache.myfaces">
+ <priority value="INFO" />
+ <appender-ref ref="DEFAULT"/>
+ </category>
+
+ <category name="javax.faces">
+ <priority value="INFO" />
+ <appender-ref ref="DEFAULT"/>
+ </category>
+
+ <category name="faces">
+ <priority value="INFO" />
+ <appender-ref ref="DEFAULT"/>
+ </category>
+
+ <category name="com.exadel.vcp">
+ <priority value="INFO" />
+ <appender-ref ref="DEFAULT"/>
+ </category>
+
+
+ <category name="org.ajax4jsf">
+ <priority value="INFO" />
+ <appender-ref ref="DEFAULT"/>
+ </category>
+
+ <!--
+ <root>
+ <priority value ="info" />
+ <appender-ref ref="DEFAULT" />
+ </root>
+ -->
+</log4j:configuration>
Added:
branches/refactor1/framework/test/src/test/resources/org/ajax4jsf/framework/resource/call.xml
===================================================================
---
branches/refactor1/framework/test/src/test/resources/org/ajax4jsf/framework/resource/call.xml
(rev 0)
+++
branches/refactor1/framework/test/src/test/resources/org/ajax4jsf/framework/resource/call.xml 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:template
xmlns:f='http://jsf.exadel.com/template'
+
xmlns:u='http://jsf.exadel.com/template/util'
+
xmlns="http://www.w3.org/1999/xhtml" >
+ <u:selector name=".exadel_debug_console">
+ <f:call
name="org.ajax4jsf.framework.resource.CSSTemplateTestCase.contextCall" />
+ <u:style name="margin" value="0px"/>
+ <u:style name="font-size"
skin="preferableDataSizeFont"></u:style>
+ </u:selector>
+</f:template>
\ No newline at end of file
Added:
branches/refactor1/framework/test/src/test/resources/org/ajax4jsf/framework/resource/callWithParam.xml
===================================================================
---
branches/refactor1/framework/test/src/test/resources/org/ajax4jsf/framework/resource/callWithParam.xml
(rev 0)
+++
branches/refactor1/framework/test/src/test/resources/org/ajax4jsf/framework/resource/callWithParam.xml 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:template
xmlns:f='http://jsf.exadel.com/template'
+
xmlns:u='http://jsf.exadel.com/template/util'
+
xmlns="http://www.w3.org/1999/xhtml" >
+ <u:selector name=".exadel_debug_console">
+ <f:call
name="org.ajax4jsf.framework.resource.CSSTemplateTestCase.contextCallWithParam"
>
+ <f:parameter value="Test" />
+ </f:call>
+ <u:style name="margin" value="0px"/>
+ <u:style name="font-size"
skin="preferableDataSizeFont"></u:style>
+ </u:selector>
+</f:template>
\ No newline at end of file
Added:
branches/refactor1/framework/test/src/test/resources/org/ajax4jsf/framework/resource/styles.xml
===================================================================
---
branches/refactor1/framework/test/src/test/resources/org/ajax4jsf/framework/resource/styles.xml
(rev 0)
+++
branches/refactor1/framework/test/src/test/resources/org/ajax4jsf/framework/resource/styles.xml 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:template
xmlns:f='http://jsf.exadel.com/template'
+
xmlns:u='http://jsf.exadel.com/template/util'
+
xmlns="http://www.w3.org/1999/xhtml" >
+ <u:selector name=".exadel_debug_console">
+ <u:style name="position" value="fixed"/>
+ <u:style name="z-index" value="80"/>
+ <u:style name="width" value="99%"/>
+ <u:style name="height" context="height"/>
+ <u:style name="left" value="10px"/>
+ <u:style name="bottom" value="30px"/>
+ </u:selector>
+ <u:selector name=".exadel_debug_console_minimized">
+ <u:style name="position" value="fixed"/>
+ <u:style name="z-index" value="80"/>
+ <u:style name="width" value="40px"/>
+ <u:style name="height" value="40px"/>
+ <u:style name="left" value="10px"/>
+ <u:style name="bottom" value="0"/>
+ </u:selector>
+ <u:selector name=".exadel_debug_console_inner">
+ <u:style name="width" value="auto"/>
+ <u:style name="height" value="auto"/>
+ <u:style name="border">
+ <f:verbatim value="1px solid "/>
+ <f:verbatim skin="overAllBackground"/>
+ </u:style>
+ <u:style name="background-color"
skin="generalBackgroundColor"/>
+ <u:style name="margin" value="10px"/>
+ <u:style name="margin-bottom" value="20px"/>
+ </u:selector>
+ <u:selector name=".exadel_debug_console_header, .exadel_debug_console_header
a">
+ <u:style name="background-color"
skin="headerBackgroundColor"/>
+ <u:style name="margin" value="1px"/>
+ <u:style name="text-align" value="center"/>
+ <u:style name="vertical-align" value="middle"/>
+ <u:style name="color" skin="headTextColor"/>
+ <u:style name="text-decoration" value="none"/>
+ </u:selector>
+ <u:selector name=".exadel_debug_console_header TD,
TD.exadel_debug_console_header">
+ <u:style name="vertical-align" value="middle"/>
+ <u:style name="font-family" skin="headerFamilyFont"/>
+ <u:style name="font-size" skin="headerSizeFont"/>
+ <u:style name="font-weight"
skin="preferableHeaderWeightFont"/>
+ <u:style name="white-space" value="nowrap"/>
+ <u:style name="padding" value="4px"/>
+ </u:selector>
+ <u:selector name=".exadel_debug_console_toolbar TD">
+ <u:style name="vertical-align" value="middle"/>
+ <u:style name="font-family" skin="tabFamilyFont"/>
+ <u:style name="font-size" skin="tabSizeFont"/>
+ <u:style name="white-space" value="nowrap"/>
+ <u:style name="padding" value="4px"/>
+ <u:style name="text-align" value="center"/>
+ </u:selector>
+ <u:selector name=".exadel_debug_console_toolbar a">
+ <u:style name="text-decoration" value="none"/>
+ </u:selector>
+ <u:selector name=".exadel_debug_console_output">
+ <u:style name="height" context="panelHeight"/>
+ <!--u:style name="bottom" value="40px"/-->
+ <!--u:style name="width" value="auto"/-->
+ <u:style name="margin" value="4px"/>
+ <u:style name="padding" value="4px"/>
+ <u:style name="overflow" value="auto"/>
+ <u:style name="border-right" value=" 1px solid
"><f:verbatim skin="tableBorderColor"/></u:style>
+ <u:style name="border-top" value=" 1px solid "><f:verbatim
skin="generalTextColor"/></u:style>
+ <u:style name="border-left" value=" 1px solid
"><f:verbatim skin="generalTextColor"/></u:style>
+ <u:style name="border-bottom" value=" 1px solid
"><f:verbatim skin="tableBorderColor"/></u:style>
+ <u:style name="color" skin="controlTextColor"/>
+ <u:style name="font-weight" value=" normal"/>
+ <u:style name="font-size" skin="preferableDataSizeFont"/>
+ <u:style name="font-family"
skin="preferableDataFamilyFont"/>
+ <u:style name="background-color"
skin="tableBackgroundColor"/>
+ <!--u:style name="background-repeat" value=" repeat-x"/-->
+ <!--u:style name="background-image" ><f:resource
f:key="com.exadel.vcp.skins.defaultskin.ControlGradient"/></u:style-->
+ </u:selector>
+ <u:selector name=".exadel_debug_console_inactive_tab">
+ <u:style name="color" skin="generalLinkColor"/>
+ </u:selector>
+ <u:selector name=".exadel_debug_console_active_tab">
+ <u:style name="color" skin="generalTextColor"/>
+ <u:style name="font-weight" value="bold"/>
+ </u:selector>
+ <u:selector name=".exadel_debug_console_shadow_corner,
.exadel_debug_console_shadow_h, .exadel_debug_console_shadow_v">
+ <u:style name="background-color" value="#000000"/>
+ <u:style name="line-height" value="0px"/>
+ </u:selector>
+ <u:selector name=".exadel_debug_console_tree">
+ <u:style name="font-family"
skin="preferableDataFamilyFont"></u:style>
+ </u:selector>
+ <u:selector name="li.exadel_debug_console_tree,
pre.exadel_debug_console_tree">
+ <u:style name="padding" value="0px"/>
+ <u:style name="margin" value="0px"/>
+ <u:style name="font-size"
skin="preferableDataSizeFont"></u:style>
+ </u:selector>
+</f:template>
\ No newline at end of file
Added:
branches/refactor1/framework/test/src/test/resources/org/ajax4jsf/framework/resource/test.js
===================================================================
---
branches/refactor1/framework/test/src/test/resources/org/ajax4jsf/framework/resource/test.js
(rev 0)
+++
branches/refactor1/framework/test/src/test/resources/org/ajax4jsf/framework/resource/test.js 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1 @@
+function Test(){};
Added: branches/refactor1/framework/test/src/test/resources/oscache.properties
===================================================================
--- branches/refactor1/framework/test/src/test/resources/oscache.properties
(rev 0)
+++ branches/refactor1/framework/test/src/test/resources/oscache.properties 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,2 @@
+cache.memory true
+cache.capacity 15
\ No newline at end of file
Added: branches/refactor1/framework/test/src/test/resources/placeholder.txt
===================================================================
--- branches/refactor1/framework/test/src/test/resources/placeholder.txt
(rev 0)
+++ branches/refactor1/framework/test/src/test/resources/placeholder.txt 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1 @@
+Test Cases for framework
\ No newline at end of file
Added: branches/refactor1/framework/test/src/test/resources/test.skin.properties
===================================================================
--- branches/refactor1/framework/test/src/test/resources/test.skin.properties
(rev 0)
+++ branches/refactor1/framework/test/src/test/resources/test.skin.properties 2007-06-28
21:59:51 UTC (rev 1395)
@@ -0,0 +1,6 @@
+string.property=string
+
+int.property=10
+
+bind.property=\#{test.bean}
+
Added: branches/refactor1/framework/test/src/test/resources/test.web.root
===================================================================
Modified: branches/refactor1/pom.xml
===================================================================
--- branches/refactor1/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -34,11 +34,78 @@
<url>${snapshotRepository}</url>
</snapshotRepository>
</distributionManagement>
- <scm>
- <
connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/trunk</...
- <
developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/trun...
- <
url>http://anonsvn.jboss.org/repos/richfaces/trunk</url>
- </scm>
+ <issueManagement>
+ <system>JIRA</system>
+ <
url>http://jira.jboss.org/jira/browse/RF</url>
+ </issueManagement>
+ <ciManagement>
+ <system>cruisecontrol</system>
+ </ciManagement>
+ <developers>
+ <developer>
+ <id>alexsmirnov</id>
+ <name>Alexander Smirnov</name>
+ <email>alexsmirnov(a)exadel.com</email>
+ <organization>Exadel Inc.</organization>
+ <organizationUrl>http://www.exadel.com</organizationUrl>
+ <roles>
+ <role>architect</role>
+ <role>developer</role>
+ </roles>
+ <timezone>-3</timezone>
+ </developer>
+ <developer>
+ <id>ishabalov</id>
+ <name>Igor Shabalov</name>
+ <email>ishabalov(a)exadel.com</email>
+ <organization>Exadel Inc.</organization>
+ <organizationUrl>http://www.exadel.com</organizationUrl>
+ <roles>
+ <role>architect</role>
+ <role>developer</role>
+ </roles>
+ <timezone>+8</timezone>
+ </developer>
+ <developer>
+ <id>sergeysmirnov</id>
+ <name>Sergey Smirnov</name>
+ <email>sergeysmirnov(a)exadel.com</email>
+ <organization>Exadel Inc.</organization>
+ <organizationUrl>http://www.exadel.com</organizationUrl>
+ <roles>
+ <role>architect</role>
+ <role>developer</role>
+ </roles>
+ <timezone>+8</timezone>
+ </developer>
+ <developer>
+ <id>nbelayevsky</id>
+ <name>Nik Belyaevsky</name>
+ <email>nbelayevsky(a)exadel.com</email>
+ <organization>Exadel Inc.</organization>
+ <organizationUrl>http://www.exadel.com</organizationUrl>
+ <roles>
+ <role>architect</role>
+ <role>developer</role>
+ </roles>
+ <timezone>-2</timezone>
+ </developer>
+ </developers>
+ <licenses>
+ <license>
+ <name>LGPL 2.1</name>
+ <
url>http://www.gnu.org/licenses/lgpl.html</url>
+ <distribution>repo</distribution>
+ <comments>
+ GNU LESSER GENERAL PUBLIC LICENSE Version 2.1
+ </comments>
+ </license>
+ </licenses>
+ <scm>
+ <
connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/trunk</...
+ <
developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/trun...
+ <
url>http://anonsvn.jboss.org/repos/richfaces/trunk</url>
+ </scm>
<profiles>
<profile>
<id>sandbox</id>
Modified: branches/refactor1/ui/assembly/pom.xml
===================================================================
--- branches/refactor1/ui/assembly/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/ui/assembly/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -5,7 +5,7 @@
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>richfaces</artifactId>
<name>RichFaces JSF components library</name>
<packaging>jar</packaging>
Modified: branches/refactor1/ui/common/pom.xml
===================================================================
--- branches/refactor1/ui/common/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/ui/common/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -5,7 +5,7 @@
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>common</artifactId>
<name>common classes</name>
<build>
Modified: branches/refactor1/ui/dataFilterSlider/pom.xml
===================================================================
--- branches/refactor1/ui/dataFilterSlider/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/ui/dataFilterSlider/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -5,7 +5,7 @@
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>dataFilterSlider</artifactId>
<name>Data Filter Slider</name>
<build>
@@ -61,7 +61,7 @@
</pluginRepositories>
<dependencies>
<dependency>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>common</artifactId>
<version>${project.parent.version}</version>
</dependency>
Modified: branches/refactor1/ui/dataTable/pom.xml
===================================================================
--- branches/refactor1/ui/dataTable/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/ui/dataTable/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -5,7 +5,7 @@
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>dataTable</artifactId>
<name>Extended data table and lists</name>
<build>
Modified: branches/refactor1/ui/datascroller/pom.xml
===================================================================
--- branches/refactor1/ui/datascroller/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/ui/datascroller/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -5,7 +5,7 @@
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>datascroller</artifactId>
<name>Data Scroller</name>
<build>
@@ -42,7 +42,7 @@
</build>
<dependencies>
<dependency>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
Modified: branches/refactor1/ui/drag-drop/pom.xml
===================================================================
--- branches/refactor1/ui/drag-drop/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/ui/drag-drop/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -5,7 +5,7 @@
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>drag-drop</artifactId>
<name>Drag and Drop</name>
<build>
@@ -42,7 +42,7 @@
</build>
<dependencies>
<dependency>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
Modified: branches/refactor1/ui/dropdown-menu/pom.xml
===================================================================
--- branches/refactor1/ui/dropdown-menu/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/ui/dropdown-menu/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -5,7 +5,7 @@
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>dropdown-menu</artifactId>
<name>Drop down menu</name>
<build>
@@ -42,12 +42,12 @@
</build>
<dependencies>
<dependency>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>menu-components</artifactId>
<version>${project.version}</version>
</dependency>
Modified: branches/refactor1/ui/gmap/pom.xml
===================================================================
--- branches/refactor1/ui/gmap/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/ui/gmap/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -5,7 +5,7 @@
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>gmap</artifactId>
<name>Google map</name>
<build>
Modified: branches/refactor1/ui/inputnumber-slider/pom.xml
===================================================================
--- branches/refactor1/ui/inputnumber-slider/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/ui/inputnumber-slider/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -5,7 +5,7 @@
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>inputnumber-slider</artifactId>
<name>Input number slider</name>
<build>
@@ -42,7 +42,7 @@
</build>
<dependencies>
<dependency>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
Modified: branches/refactor1/ui/inputnumber-spinner/pom.xml
===================================================================
--- branches/refactor1/ui/inputnumber-spinner/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/ui/inputnumber-spinner/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -5,7 +5,7 @@
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>inputnumber-spinner</artifactId>
<name>Input number spinner</name>
<build>
@@ -43,7 +43,7 @@
</build>
<dependencies>
<dependency>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
Modified: branches/refactor1/ui/menu-components/pom.xml
===================================================================
--- branches/refactor1/ui/menu-components/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/ui/menu-components/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -5,7 +5,7 @@
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>menu-components</artifactId>
<name>Menu components</name>
<build>
@@ -42,7 +42,7 @@
</build>
<dependencies>
<dependency>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
Modified: branches/refactor1/ui/modal-panel/pom.xml
===================================================================
--- branches/refactor1/ui/modal-panel/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/ui/modal-panel/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -5,7 +5,7 @@
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>modal-panel</artifactId>
<name>Modal panel</name>
<build>
@@ -42,7 +42,7 @@
</build>
<dependencies>
<dependency>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
Modified: branches/refactor1/ui/paint2D/pom.xml
===================================================================
--- branches/refactor1/ui/paint2D/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/ui/paint2D/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -5,7 +5,7 @@
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>paint2D</artifactId>
<name>Paint java 2D</name>
<build>
Modified: branches/refactor1/ui/panel/pom.xml
===================================================================
--- branches/refactor1/ui/panel/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/ui/panel/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -5,7 +5,7 @@
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>panel</artifactId>
<name>Panel</name>
<build>
@@ -43,7 +43,7 @@
</build>
<dependencies>
<dependency>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
Modified: branches/refactor1/ui/panelbar/pom.xml
===================================================================
--- branches/refactor1/ui/panelbar/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/ui/panelbar/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -5,7 +5,7 @@
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>panelbar</artifactId>
<name>Panel Bar</name>
<build>
@@ -42,7 +42,7 @@
</build>
<dependencies>
<dependency>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
Modified: branches/refactor1/ui/pom.xml
===================================================================
--- branches/refactor1/ui/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/ui/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -1,87 +1,18 @@
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>root</artifactId>
+ <groupId>org.richfaces</groupId>
+ <version>3.1.0-SNAPSHOT</version>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.richfaces</groupId>
<artifactId>ui</artifactId>
<packaging>pom</packaging>
<name>RichFaces Components</name>
- <version>3.1.0-SNAPSHOT</version>
- <url>http://richfaces.ajax4jsf.org</url>
<properties>
<maven.test.failure.ignore>true</maven.test.failure.ignore>
<!-- -->
</properties>
- <issueManagement>
- <system>JIRA</system>
- <
url>http://jira.jboss.org/jira/browse/RF</url>
- </issueManagement>
- <ciManagement>
- <system>cruisecontrol</system>
- </ciManagement>
- <developers>
- <developer>
- <id>alexsmirnov</id>
- <name>Alexander Smirnov</name>
- <email>alexsmirnov(a)exadel.com</email>
- <organization>Exadel Inc.</organization>
- <organizationUrl>http://www.exadel.com</organizationUrl>
- <roles>
- <role>architect</role>
- <role>developer</role>
- </roles>
- <timezone>-3</timezone>
- </developer>
- <developer>
- <id>ishabalov</id>
- <name>Igor Shabalov</name>
- <email>ishabalov(a)exadel.com</email>
- <organization>Exadel Inc.</organization>
- <organizationUrl>http://www.exadel.com</organizationUrl>
- <roles>
- <role>architect</role>
- <role>developer</role>
- </roles>
- <timezone>+8</timezone>
- </developer>
- <developer>
- <id>sergeysmirnov</id>
- <name>Sergey Smirnov</name>
- <email>sergeysmirnov(a)exadel.com</email>
- <organization>Exadel Inc.</organization>
- <organizationUrl>http://www.exadel.com</organizationUrl>
- <roles>
- <role>architect</role>
- <role>developer</role>
- </roles>
- <timezone>+8</timezone>
- </developer>
- <developer>
- <id>nbelayevsky</id>
- <name>Nik Belyaevsky</name>
- <email>nbelayevsky(a)exadel.com</email>
- <organization>Exadel Inc.</organization>
- <organizationUrl>http://www.exadel.com</organizationUrl>
- <roles>
- <role>architect</role>
- <role>developer</role>
- </roles>
- <timezone>-2</timezone>
- </developer>
- </developers>
- <licenses>
- <license>
- <name>LGPL 2.1</name>
- <
url>http://www.gnu.org/licenses/lgpl.html</url>
- <distribution>repo</distribution>
- <comments>
- GNU LESSER GENERAL PUBLIC LICENSE Version 2.1
- </comments>
- </license>
- </licenses>
- <scm>
- <
connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/trunk/rich...
- <
developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/trun...
- <
url>http://anonsvn.jboss.org/repos/richfaces/trunk/richfaces/</url>
- </scm>
<build>
<plugins>
<plugin>
@@ -231,14 +162,14 @@
<version>3.0</version>
</dependency>
<dependency>
- <groupId>org.richfaces</groupId>
- <artifactId>ajax4jsf</artifactId>
- <version>3.1.0-SNAPSHOT</version>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>impl</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.framework</groupId>
<artifactId>test</artifactId>
- <version>3.1.0-SNAPSHOT</version>
+ <version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
Modified: branches/refactor1/ui/separator/pom.xml
===================================================================
--- branches/refactor1/ui/separator/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/ui/separator/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -5,7 +5,7 @@
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>separator</artifactId>
<name>Separator components</name>
<build>
@@ -44,7 +44,7 @@
</build>
<dependencies>
<dependency>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
Modified: branches/refactor1/ui/simpleTogglePanel/pom.xml
===================================================================
--- branches/refactor1/ui/simpleTogglePanel/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/ui/simpleTogglePanel/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -5,7 +5,7 @@
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>simpleTogglePanel</artifactId>
<name>Toggle panel</name>
<build>
@@ -42,7 +42,7 @@
</build>
<dependencies>
<dependency>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
Modified: branches/refactor1/ui/spacer/pom.xml
===================================================================
--- branches/refactor1/ui/spacer/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/ui/spacer/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -5,7 +5,7 @@
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>spacer</artifactId>
<name>Spacer</name>
<build>
Modified: branches/refactor1/ui/suggestionbox/pom.xml
===================================================================
--- branches/refactor1/ui/suggestionbox/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/ui/suggestionbox/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -5,7 +5,7 @@
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>suggestionbox</artifactId>
<name>Suggestion box</name>
<build>
@@ -42,7 +42,7 @@
</build>
<dependencies>
<dependency>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
Modified: branches/refactor1/ui/tabPanel/pom.xml
===================================================================
--- branches/refactor1/ui/tabPanel/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/ui/tabPanel/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -5,7 +5,7 @@
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>tabPanel</artifactId>
<name>Tab panel</name>
<build>
@@ -42,7 +42,7 @@
</build>
<dependencies>
<dependency>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
Modified: branches/refactor1/ui/togglePanel/pom.xml
===================================================================
--- branches/refactor1/ui/togglePanel/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/ui/togglePanel/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -5,7 +5,7 @@
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>togglePanel</artifactId>
<name>Toggle panel</name>
<build>
@@ -42,7 +42,7 @@
</build>
<dependencies>
<dependency>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
Modified: branches/refactor1/ui/toolBar/pom.xml
===================================================================
--- branches/refactor1/ui/toolBar/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/ui/toolBar/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -5,7 +5,7 @@
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>toolBar</artifactId>
<name>Tool bar</name>
<build>
@@ -42,7 +42,7 @@
</build>
<dependencies>
<dependency>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
Modified: branches/refactor1/ui/tree/pom.xml
===================================================================
--- branches/refactor1/ui/tree/pom.xml 2007-06-28 21:40:32 UTC (rev 1394)
+++ branches/refactor1/ui/tree/pom.xml 2007-06-28 21:59:51 UTC (rev 1395)
@@ -5,7 +5,7 @@
<version>3.1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>tree</artifactId>
<name>Tree control</name>
<build>
@@ -42,12 +42,12 @@
</build>
<dependencies>
<dependency>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.richfaces</groupId>
+ <groupId>org.richfaces.ui</groupId>
<artifactId>drag-drop</artifactId>
<version>${project.version}</version>
</dependency>