JBoss Rich Faces SVN: r12368 - in trunk/sandbox/cdk/maven-resource-dependency-plugin: src/main/java/org/richfaces/cdk/rd and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-01-22 09:26:55 -0500 (Thu, 22 Jan 2009)
New Revision: 12368
Added:
trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/generator/
trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/generator/ResourceAssembler.java
trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/generator/ResourcesGenerator.java
trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/generator/ScriptAssembler.java
trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/generator/StyleAssembler.java
trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo/ResourceDependencyMojo.java
Removed:
trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo/CreateScriptMojo.java
trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo/CreateStyleMojo.java
Modified:
trunk/sandbox/cdk/maven-resource-dependency-plugin/pom.xml
trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/utils/PluginUtils.java
Log:
Modified: trunk/sandbox/cdk/maven-resource-dependency-plugin/pom.xml
===================================================================
--- trunk/sandbox/cdk/maven-resource-dependency-plugin/pom.xml 2009-01-22 14:13:07 UTC (rev 12367)
+++ trunk/sandbox/cdk/maven-resource-dependency-plugin/pom.xml 2009-01-22 14:26:55 UTC (rev 12368)
@@ -1,108 +1,122 @@
<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>cdk</artifactId>
- <groupId>org.richfaces.sandbox</groupId>
- <version>3.3.1-SNAPSHOT</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>cdk</artifactId>
+ <groupId>org.richfaces.sandbox</groupId>
+ <version>3.3.1-SNAPSHOT</version>
+ </parent>
- <groupId>org.richfaces.cdk.sandbox</groupId>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces.cdk.sandbox</groupId>
+
<artifactId>maven-resource-dependency-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>3.3.1-SNAPSHOT</version>
<name>maven-resource-dependency-plugin</name>
-
+
<dependencies>
-
+
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-project</artifactId>
- <version>2.0.4</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-plugin-testing-harness</artifactId>
- <version>1.0-beta-1</version>
- <scope>test</scope>
- </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-plugin-testing-harness</artifactId>
+ <version>1.0-beta-1</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
- </dependency>
- <dependency>
- <groupId>commons-vfs</groupId>
- <artifactId>commons-vfs</artifactId>
- <version>1.0</version>
- </dependency>
+ </dependency>
+ <dependency>
+ <groupId>commons-vfs</groupId>
+ <artifactId>commons-vfs</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-net</groupId>
+ <artifactId>commons-net</artifactId>
+ <version>1.4.1</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.1</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>jdom</groupId>
+ <artifactId>jdom</artifactId>
+ <version>1.0</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>2.0.2</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>com.jcraft</groupId>
+ <artifactId>jsch</artifactId>
+ <version>0.1.23</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ <version>1.0.b2</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>oro</groupId>
+ <artifactId>oro</artifactId>
+ <version>2.0.8</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>commons-digester</groupId>
+ <artifactId>commons-digester</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ <version>1.8.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>generator</artifactId>
+ <version>3.3.1-SNAPSHOT</version>
+ </dependency>
<dependency>
- <groupId>commons-net</groupId>
- <artifactId>commons-net</artifactId>
- <version>1.4.1</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>3.1</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>jdom</groupId>
- <artifactId>jdom</artifactId>
- <version>1.0</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>2.0.2</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>com.jcraft</groupId>
- <artifactId>jsch</artifactId>
- <version>0.1.23</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- <version>1.0.b2</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>oro</groupId>
- <artifactId>oro</artifactId>
- <version>2.0.8</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>commons-digester</groupId>
- <artifactId>commons-digester</artifactId>
- <version>2.0</version>
- </dependency>
- <dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- <version>1.8.0</version>
- </dependency>
-
-
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-velocity</artifactId>
+ <version>1.1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <version>3.3.1-SNAPSHOT</version>
+ </dependency>
+
</dependencies>
</project>
Added: trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/generator/ResourceAssembler.java
===================================================================
--- trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/generator/ResourceAssembler.java (rev 0)
+++ trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/generator/ResourceAssembler.java 2009-01-22 14:26:55 UTC (rev 12368)
@@ -0,0 +1,15 @@
+package org.richfaces.cdk.rd.generator;
+
+import java.io.File;
+import java.net.URL;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+public interface ResourceAssembler {
+
+ public void assembly(URL resource);
+
+ public void writeToFile(File file);
+}
Added: trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/generator/ResourcesGenerator.java
===================================================================
--- trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/generator/ResourcesGenerator.java (rev 0)
+++ trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/generator/ResourcesGenerator.java 2009-01-22 14:26:55 UTC (rev 12368)
@@ -0,0 +1,139 @@
+package org.richfaces.cdk.rd.generator;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.plugin.logging.SystemStreamLog;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+public class ResourcesGenerator {
+
+ private File assemblyFile;
+
+ private Log log = new SystemStreamLog();
+
+ private Collection<String> resources;
+
+ private List <String> includesBefore;
+
+ private List <String> includesAfter;
+
+ private ResourceAssembler assembler;
+
+
+ public void doAssembly() {
+ if(resources != null) {
+ if(includesBefore != null && !includesBefore.isEmpty()) {
+ iterate(includesBefore);
+ }
+
+ if(resources != null && !resources.isEmpty()) {
+ iterate(resources);
+ }
+
+ if(includesAfter != null && !includesAfter.isEmpty()) {
+ iterate(includesAfter);
+ }
+ }
+ }
+
+ private void iterate(Collection<String> resources) {
+ for (String resourceName: resources) {
+ URL resource = getResourceURL(resourceName);
+ if(resource != null) {
+ if (assembler != null) {
+ assembler.assembly(resource);
+ }
+ }
+ }
+ }
+
+ private URL getResourceURL(String resourceName) {
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ URL resource = classLoader.getResource(resourceName);
+
+ try {
+ if(resource == null) {
+ //resolve framework script path
+ Class clazz = classLoader.loadClass(resourceName);
+ Object obj = clazz.newInstance();
+ Method method = clazz.getMethod("getPath", new Class [0]);
+ String path = (String) method.invoke(obj, new Object[0]);
+ resource = classLoader.getResource(path);
+ }
+ } catch (Exception e) {
+ log.error("Error process: " + resourceName + "\n" + e.getMessage(), e);
+ }
+ return resource;
+ }
+
+ public void writeToFile() {
+ if(assemblyFile != null) {
+ if(assemblyFile.exists()) {
+ assemblyFile.delete();
+ try {
+ assemblyFile.createNewFile();
+ } catch (IOException e) {
+ log.error("Error create assembly File: " + assemblyFile.getAbsolutePath(),e);
+ }
+ }
+ assembler.writeToFile(assemblyFile);
+ }
+ }
+
+ public File getAssemblyFile() {
+ return assemblyFile;
+ }
+
+
+ public void setAssemblyFile(File assemblyFile) {
+ this.assemblyFile = assemblyFile;
+ }
+
+ public Collection<String> getResources() {
+ return resources;
+ }
+
+
+ public void setResources(Collection<String> resources) {
+ this.resources = resources;
+ }
+
+
+ public List<String> getIncludesBefore() {
+ return includesBefore;
+ }
+
+
+ public void setIncludesBefore(List<String> includesBefore) {
+ this.includesBefore = includesBefore;
+ }
+
+
+ public List<String> getIncludesAfter() {
+ return includesAfter;
+ }
+
+
+ public void setIncludesAfter(List<String> includesAfter) {
+ this.includesAfter = includesAfter;
+ }
+
+
+ public ResourceAssembler getAssembler() {
+ return assembler;
+ }
+
+
+ public void setAssembler(ResourceAssembler assembler) {
+ this.assembler = assembler;
+ }
+}
Added: trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/generator/ScriptAssembler.java
===================================================================
--- trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/generator/ScriptAssembler.java (rev 0)
+++ trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/generator/ScriptAssembler.java 2009-01-22 14:26:55 UTC (rev 12368)
@@ -0,0 +1,69 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.cdk.rd.generator;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.URL;
+
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.plugin.logging.SystemStreamLog;
+import org.codehaus.plexus.util.IOUtil;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+public class ScriptAssembler implements ResourceAssembler {
+
+ Log log = new SystemStreamLog();
+
+ private StringBuilder builder;
+
+ public void assembly(URL resource) {
+ log.info("process resource : " + resource.getFile());
+ if (builder == null) {
+ builder = new StringBuilder();
+ }
+ try {
+ builder.append(IOUtil.toString(resource.openStream()));
+ } catch (IOException e) {
+ log.error("Error read resource: " + resource.getFile());
+ }
+ }
+
+ public void writeToFile(File file) {
+ if(builder.length() > 0) {
+ try {
+ FileWriter fileWriter = new FileWriter(file);
+ try {
+ IOUtil.copy(builder.toString(), fileWriter);
+ } finally {
+ fileWriter.close();
+ }
+ } catch (IOException e) {
+ log.error("Error write file: " + file.getAbsolutePath(),e);
+ }
+ }
+ }
+}
Added: trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/generator/StyleAssembler.java
===================================================================
--- trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/generator/StyleAssembler.java (rev 0)
+++ trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/generator/StyleAssembler.java 2009-01-22 14:26:55 UTC (rev 12368)
@@ -0,0 +1,88 @@
+package org.richfaces.cdk.rd.generator;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.ajax4jsf.builder.config.ParsingException;
+import org.ajax4jsf.builder.xml.XMLBody;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.plugin.logging.SystemStreamLog;
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.app.VelocityEngine;
+import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.velocity.VelocityComponent;
+
+
+/**
+ * @author Anton Belevich
+ *
+ */
+
+public class StyleAssembler implements ResourceAssembler {
+
+
+ private Log log = new SystemStreamLog();
+
+ private VelocityComponent velocityComponent;
+
+ private StringBuilder builder = new StringBuilder();
+
+ public void assembly(URL resource) {
+
+ String file = resource.getFile();
+ log.info("process resource: " + file);
+
+ try {
+ InputStream resourceInputStream = resource.openStream();
+ if(file.endsWith(".xcss")) {
+ XMLBody xmlBody = new XMLBody();
+ try {
+ xmlBody.loadXML(resourceInputStream,true);
+ builder.append(xmlBody.getContent());
+ } catch (ParsingException e) {
+ log.error("Error processing xcss: " + e.getMessage(), e);
+ } finally {
+ resourceInputStream.close();
+ }
+ } else {
+ builder.append(IOUtil.toString(resourceInputStream));
+ }
+
+ } catch (IOException e) {
+ log.error("Error load xcss file " + resource.getFile() + " : " + e.getMessage(), e);
+ }
+ }
+
+ public VelocityComponent getVelocityComponent() {
+ return velocityComponent;
+ }
+
+ public void setVelocityComponent(VelocityComponent velocityComponent) {
+ this.velocityComponent = velocityComponent;
+ }
+
+ public void writeToFile(File file) {
+ try {
+ if(builder.length() > 0) {
+ VelocityContext context = new VelocityContext();
+ context.put("content", builder);
+ VelocityEngine engine = velocityComponent.getEngine();
+ FileWriter fileWriter = new FileWriter(file);
+ try {
+ Template velocityTemplate = engine.getTemplate("templates12/xcss.vm");
+ velocityTemplate.merge(context, fileWriter);
+ fileWriter.flush();
+ } finally {
+ fileWriter.close();
+ }
+ }
+ } catch (Exception e) {
+ log.error("Error write file: " + file.getAbsolutePath(),e);
+ }
+ }
+
+}
Deleted: trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo/CreateScriptMojo.java
===================================================================
--- trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo/CreateScriptMojo.java 2009-01-22 14:13:07 UTC (rev 12367)
+++ trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo/CreateScriptMojo.java 2009-01-22 14:26:55 UTC (rev 12368)
@@ -1,348 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk.rd.mojo;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import org.apache.commons.digester.Digester;
-import org.apache.commons.vfs.FileObject;
-import org.apache.commons.vfs.FileSystemException;
-import org.apache.commons.vfs.FileSystemManager;
-import org.apache.commons.vfs.VFS;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.MavenProjectBuilder;
-import org.apache.maven.project.artifact.MavenMetadataSource;
-import org.codehaus.classworlds.ClassRealm;
-import org.codehaus.classworlds.ClassWorld;
-import org.codehaus.plexus.util.DirectoryScanner;
-import org.richfaces.cdk.rd.Components;
-import org.richfaces.cdk.rd.handler.ComponentsHandler;
-import org.richfaces.cdk.rd.utils.PluginUtils;
-
-/**
- * @author Anton Belevich
- *
- * @goal assemblyScripts
- * @phase process-resources
- *
- */
-public class CreateScriptMojo extends AbstractMojo {
-
- /** Top maven project.
- *
- * @parameter expression="${project}"
- * @readonly
- */
- protected MavenProject project;
-
- /**
- *
- * @component
- */
- protected MavenProjectBuilder builder;
-
- /**
- * Used to look up Artifacts in the remote repository.
- *
- * @component
- */
- private org.apache.maven.artifact.factory.ArtifactFactory factory;
-
- /**
- * Used to look up Artifacts in the remote repository.
- *
- * @component
- */
- private org.apache.maven.artifact.resolver.ArtifactResolver resolver;
-
- /**
- * The local repository.
- *
- * @parameter expression="${localRepository}"
- */
- private ArtifactRepository localRepository;
-
- /**
- * outputScriptDirectory
- * @parameter expression = "${basedir}/src/main/webapp"
- */
- private File outputScriptDirectory ;
-
- /**
- * scriptPackName
- * @parameter expression="custom-dependencies";
- */
- private String scriptPackName;
-
- /**
- * webSourceDirectory
- * @parameter expression="${basedir}/src/main/webapp" ;
- */
- private File webSourceDirectory;
-
-
- /**
- * namespaces
- * @parameter
- *
- */
- private List namespaces;
-
- /**
- * beforeIncludes
- * @parameter
- */
- private List beforeIncludes;
-
- /**
- * afterIncludes
- * @parameter
- */
- private List afterIncludes;
-
- /**
- *
- * @component
- */
- private ArtifactMetadataSource metadataSource;
-
-
-
- public void execute() throws MojoExecutionException {
- try {
-
- Set <Artifact> artifacts = resolveDependenciesArtifacts();
- Digester defaultDigester = getDigester();
-
- Map <String, Components> components = new HashMap<String, Components>();
- for (Artifact artifact : artifacts) {
- FileObject jar = resolveArtifact(artifact);
- FileObject [] configs = PluginUtils.resolveConfigsFromJar(jar, PluginUtils.DEFAULT_CONFIG_PATTERNS);
- components.putAll(PluginUtils.processConfigs(configs, defaultDigester));
- }
-
- ComponentsHandler handler = findComponents(webSourceDirectory, components, PluginUtils.DEFAULT_PROCESS_INCLUDES, new String[0]);
- Set <String> result = handler.getScripts();
- mergeScripts(result,outputScriptDirectory, beforeIncludes, afterIncludes);
-
- } catch (Exception e) {
- throw new MojoExecutionException(e.getMessage(),e);
- }
-
- }
-
- public Digester getDigester() {
- return PluginUtils.createDefaultDigester();
- }
-
- public ComponentsHandler findComponents (File webSourceDir, Map <String, Components> components, String [] includes, String [] excludes) {
-
- DirectoryScanner scanner = new DirectoryScanner();
- scanner.setBasedir(webSourceDir);
- scanner.setIncludes(includes);
- scanner.setExcludes(excludes);
- scanner.addDefaultExcludes();
- scanner.scan();
- String [] collectedFiles = scanner.getIncludedFiles();
-
- ComponentsHandler handler = new ComponentsHandler();
- handler.setComponents(components);
-
- try {
-
- SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
- saxParserFactory.setNamespaceAware(true);
- SAXParser saxParser = saxParserFactory.newSAXParser();
-
- for(String processFile : collectedFiles) {
- File file = new File(webSourceDir,processFile);
- if(file.exists()) {
- getLog().info("process file: " + file.getName());
- try {
- saxParser.parse(file, handler);
- } catch (Exception e) {
- getLog().error("Error process file: " + file.getAbsolutePath() + "\n" + e.getMessage(), e);
- }
- }
- }
-
- } catch (Exception e) {
- getLog().error(e);
- }
-
- return handler;
- }
-
- protected Set <Artifact> resolveDependenciesArtifacts() {
- ArtifactResolutionResult result = null;
- try {
- List <Dependency> dependencies = project.getDependencies();
- Set <Artifact> artifacts = MavenMetadataSource.createArtifacts(factory, dependencies, null, null, project);
- artifacts.add(project.getArtifact());
-
- result = resolver.resolveTransitively(artifacts, project.getArtifact(), Collections.EMPTY_LIST, localRepository, metadataSource);
- } catch (Exception e) {
- getLog().error(e);
- }
- return result.getArtifacts();
- }
-
-
- protected FileObject resolveArtifact(Artifact artifact) {
- FileObject jarFileObjects = null;
- if(artifact != null) {
- try {
- resolver.resolve(artifact, Collections.EMPTY_LIST, localRepository);
- getLog().info("artifact " + artifact.getFile().getAbsolutePath() + " is resolved");
- } catch (ArtifactResolutionException e) {
- getLog().error("Error with resolve artifact " + artifact.getFile().getAbsolutePath() + "\n" + e.getMessage(), e);
- } catch (ArtifactNotFoundException e) {
- getLog().error("Not found artifact " + artifact.getFile().getAbsolutePath() + "\n" + e.getMessage(), e);
- }
-
- File file = artifact.getFile();
- try {
- FileSystemManager manager = VFS.getManager();
- jarFileObjects = manager.resolveFile("jar://" + file.getAbsolutePath());
- } catch (FileSystemException e) {
- getLog().error("Error during processing file: " + file.getAbsolutePath()+ "\n" + e.getMessage(), e);
- }
- }
- return jarFileObjects;
- }
-
-
- protected void mergeScripts(Set <String> scripts, File outputScriptDirectory, List <String> beforeIncludes, List <String> afterIncludes) {
-
- File assemblyScriptFile = new File(outputScriptDirectory, scriptPackName + ".js");
-
- try {
- if(assemblyScriptFile.exists()) {
- assemblyScriptFile.delete();
- }
- getLog().info("Create assembly file: " + assemblyScriptFile.getAbsolutePath());
- assemblyScriptFile.createNewFile();
-
- } catch (IOException e) {
- getLog().error("Error create file: " + assemblyScriptFile.getAbsolutePath() + "\n" + e.getMessage(), e);
- }
-
- try {
-
- Set <Artifact> artifacts = resolveDependenciesArtifacts();
-
- //save current ContextClassloader
- ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
-
- //create a new classloading space
- ClassWorld world = new ClassWorld();
-
- //use the existing ContextClassLoader in a realm of the classloading space
- ClassRealm realm = world.newRealm("org.richfaces.cdk", Thread.currentThread().getContextClassLoader());
-
- //create another realm for the app jars
- ClassRealm childRealm = realm.createChildRealm("jar");
- for(Artifact jar : artifacts ) {
- childRealm.addConstituent(jar.getFile().toURL());
- }
-
- // add project classes, scripts etc ...
- List compileClasspathElements = project.getCompileClasspathElements();
- for (Object path: compileClasspathElements) {
- childRealm.addConstituent(new File((String)path).toURI().toURL());
- }
-
- //make the child realm the ContextClassLoader
- Thread.currentThread().setContextClassLoader(childRealm.getClassLoader());
-
- if(beforeIncludes != null) {
- merge(assemblyScriptFile, beforeIncludes);
- }
-
- merge(assemblyScriptFile, scripts);
-
- if(afterIncludes != null) {
- merge(assemblyScriptFile, afterIncludes);
- }
-
- //restore old ContextClassLoader
- Thread.currentThread().setContextClassLoader(oldClassLoader);
-
- } catch (Exception e) {
- getLog().error(e);
- }
-
- }
-
- public void merge(File assembly, Collection <String> resources) {
- for(String script: resources) {
- URL resource = getResourceURL(script);
- if(resource != null) {
- getLog().info("merge file: " + resource.getFile() + " in to " + assembly.getAbsolutePath());
- try {
- PluginUtils.mergeFiles(assembly, resource);
- } catch (Exception e) {
- getLog().error("Error during merge: " + resource.getFile() + "\n" + e.getMessage(), e);
- }
- }
- }
- }
-
- protected URL getResourceURL(String resourceName) {
- URL resource = Thread.currentThread().getContextClassLoader().getResource(resourceName);
- try {
- if(resource == null) {
- //resolve framework script path
- Class clazz = Thread.currentThread().getContextClassLoader().loadClass(resourceName);
- Object obj = clazz.newInstance();
- Method method = clazz.getMethod("getPath", new Class [0]);
- String path = (String) method.invoke(obj, new Object[0]);
- resource = Thread.currentThread().getContextClassLoader().getResource(path);
- }
- } catch (Exception e) {
- getLog().error("Error process: " + resourceName + "\n" + e.getMessage(), e);
- }
-
- return resource;
- }
-}
Deleted: trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo/CreateStyleMojo.java
===================================================================
--- trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo/CreateStyleMojo.java 2009-01-22 14:13:07 UTC (rev 12367)
+++ trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo/CreateStyleMojo.java 2009-01-22 14:26:55 UTC (rev 12368)
@@ -1,64 +0,0 @@
-/**
- * License Agreement.
- *
- * Rich Faces - Natural Ajax for Java Server Faces (JSF)
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces.cdk.rd.mojo;
-
-import java.io.File;
-
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-
-/**
- * @author Anton Belevich
- * @goal assemblyStyles
- * @phase process-resources
- */
-public class CreateStyleMojo extends AbstractMojo {
-
- /**
- * outputStyleDirectory
- * @parameter
- */
- private File outputStyleDirectory;
-
- /**
- * stylePackName
- * @parameter;
- */
- private String stylePackName;
-
- /**
- * webSourceDirectory
- * @parameter expression="${basedir}/src/main/webapp" ;
- */
- private File webSourceDirectory;
-
- /**
- * loadOrder
- * @parameter;
- */
- private String loadOrder;
-
- public void execute() throws MojoExecutionException{
- System.out.println("CreateStyleMojo.execute()");
- }
-
-}
Added: trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo/ResourceDependencyMojo.java
===================================================================
--- trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo/ResourceDependencyMojo.java (rev 0)
+++ trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo/ResourceDependencyMojo.java 2009-01-22 14:26:55 UTC (rev 12368)
@@ -0,0 +1,331 @@
+package org.richfaces.cdk.rd.mojo;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.ajax4jsf.builder.mojo.Library;
+import org.ajax4jsf.builder.xml.XMLBodyMerge;
+import org.apache.commons.digester.Digester;
+import org.apache.commons.vfs.FileObject;
+import org.apache.commons.vfs.FileSystemException;
+import org.apache.commons.vfs.FileSystemManager;
+import org.apache.commons.vfs.VFS;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.artifact.MavenMetadataSource;
+import org.codehaus.classworlds.ClassRealm;
+import org.codehaus.classworlds.ClassWorld;
+import org.codehaus.plexus.util.DirectoryScanner;
+import org.codehaus.plexus.velocity.VelocityComponent;
+import org.richfaces.cdk.rd.Components;
+import org.richfaces.cdk.rd.generator.ResourceAssembler;
+import org.richfaces.cdk.rd.generator.ResourcesGenerator;
+import org.richfaces.cdk.rd.generator.ScriptAssembler;
+import org.richfaces.cdk.rd.generator.StyleAssembler;
+import org.richfaces.cdk.rd.handler.ComponentsHandler;
+import org.richfaces.cdk.rd.utils.PluginUtils;
+
+/**
+ * @author Anton Belevich
+ * @goal assemblyResources
+ * @phase process-resources
+
+ */
+public class ResourceDependencyMojo extends AbstractMojo {
+
+ /**
+ * Top maven project.
+ *
+ * @parameter expression="${project}"
+ * @readonly
+ */
+ MavenProject project;
+
+
+ /**
+ * Used to look up Artifacts in the remote repository.
+ *
+ * @component
+ */
+ private org.apache.maven.artifact.factory.ArtifactFactory factory;
+
+
+ /**
+ * Used to look up Artifacts in the remote repository.
+ *
+ * @component
+ */
+ private org.apache.maven.artifact.resolver.ArtifactResolver resolver;
+
+
+ /**
+ * The local repository.
+ *
+ * @parameter expression="${localRepository}"
+ */
+ private ArtifactRepository localRepository;
+
+
+ /**
+ * webSourceDirectory
+ * @parameter expression="${basedir}/src/main/webapp"
+ */
+ private File webSourceDirectory;
+
+ /**
+ *
+ * @component
+ */
+ private ArtifactMetadataSource metadataSource;
+
+
+ /**
+ * outputScriptDirectory
+ * @parameter expression = "${basedir}/src/main/webapp"
+ */
+ private File outputScriptDirectory ;
+
+ /**
+ *
+ * scriptPackName
+ * @parameter expression="custom-dependencies"
+ */
+ private String scriptPackName;
+
+ /**
+ * outputStyleDirectory
+ * @parameter expression = "${basedir}/src/main/webapp"
+ */
+ private File outputStyleDirectory;
+
+ /**
+ * stylePackName
+ * @parameter expression="custom-dependencies"
+ */
+ private String stylePackName;
+
+
+ /**
+ * beforeIncludes
+ * @parameter
+ */
+ private List beforeScriptIncludes;
+
+ /**
+ * afterIncludes
+ * @parameter
+ */
+ private List afterScriptIncludes;
+
+ /**
+ * beforeIncludes
+ * @parameter
+ */
+ private List beforeStylesIncludes;
+
+ /**
+ * afterIncludes
+ * @parameter
+ */
+ private List afterStylesIncludes;
+
+ /**
+ *
+ * @parameter
+ */
+ protected Library library;
+
+ /**
+ * @component
+ */
+ protected VelocityComponent velocity;
+
+
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ try {
+ Set <Artifact> artifacts = resolveDependenciesArtifacts();
+ Digester defaultDigester = getDigester();
+
+ Map <String, Components> components = new HashMap<String, Components>();
+ for (Artifact artifact : artifacts) {
+ FileObject jar = resolveArtifact(artifact);
+ FileObject [] configs = PluginUtils.resolveConfigsFromJar(jar, PluginUtils.DEFAULT_CONFIG_PATTERNS);
+ components.putAll(PluginUtils.processConfigs(configs, defaultDigester));
+ }
+ ComponentsHandler handler = findComponents(webSourceDirectory, components, PluginUtils.DEFAULT_PROCESS_INCLUDES, new String[0]);
+ ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
+ ClassLoader contextClassLoader = createClassLoader();
+ Thread.currentThread().setContextClassLoader(contextClassLoader);
+
+ if(contextClassLoader != null) {
+
+ Set <String> scripts = handler.getScripts();
+ if(!scripts.isEmpty()) {
+ File assemblyFile = new File(outputScriptDirectory, scriptPackName + ".js");
+ ScriptAssembler scriptAssembler = new ScriptAssembler();
+ mergeResources(assemblyFile, scriptAssembler, beforeScriptIncludes, afterScriptIncludes, scripts);
+ }
+
+ Set <String> styles = handler.getStyles();
+ if(!styles.isEmpty()) {
+ XMLBodyMerge xmlBodyMerge = new XMLBodyMerge(null);
+ File assemblyFile = new File(outputStyleDirectory, stylePackName + ".xcss");
+ StyleAssembler styleAssembler = new StyleAssembler();
+ styleAssembler.setVelocityComponent(velocity);
+ mergeResources(assemblyFile, styleAssembler, beforeStylesIncludes, afterStylesIncludes, styles);
+ }
+ }
+ Thread.currentThread().setContextClassLoader(oldClassLoader);
+
+ } catch (Exception e) {
+ throw new MojoExecutionException(e.getMessage(),e);
+ }
+ }
+
+ public void mergeResources(File assembly, ResourceAssembler assembler, List <String> beforeIncludes, List <String> afterIncludes, Collection<String> resources) {
+ ResourcesGenerator styleGenerator = new ResourcesGenerator();
+ styleGenerator.setAssembler(assembler);
+ styleGenerator.setIncludesAfter(afterIncludes);
+ styleGenerator.setIncludesBefore(beforeIncludes);
+ styleGenerator.setResources(resources);
+ styleGenerator.setAssemblyFile(assembly);
+ styleGenerator.doAssembly();
+ styleGenerator.writeToFile();
+ }
+
+ protected Set <Artifact> resolveDependenciesArtifacts() {
+ ArtifactResolutionResult result = null;
+ try {
+ List <Dependency> dependencies = project.getDependencies();
+ Set <Artifact> artifacts = MavenMetadataSource.createArtifacts(factory, dependencies, null, null, project);
+ artifacts.add(project.getArtifact());
+
+ result = resolver.resolveTransitively(artifacts, project.getArtifact(), Collections.EMPTY_LIST, localRepository, metadataSource);
+ } catch (Exception e) {
+ getLog().error(e);
+ }
+ return result.getArtifacts();
+ }
+
+
+ public ComponentsHandler findComponents (File webSourceDir, Map <String, Components> components, String [] includes, String [] excludes) {
+
+ DirectoryScanner scanner = new DirectoryScanner();
+ scanner.setBasedir(webSourceDir);
+ scanner.setIncludes(includes);
+ scanner.setExcludes(excludes);
+ scanner.addDefaultExcludes();
+ scanner.scan();
+ String [] collectedFiles = scanner.getIncludedFiles();
+
+ ComponentsHandler handler = new ComponentsHandler();
+ handler.setComponents(components);
+
+ try {
+
+ SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
+ saxParserFactory.setNamespaceAware(true);
+ SAXParser saxParser = saxParserFactory.newSAXParser();
+
+ for(String processFile : collectedFiles) {
+ File file = new File(webSourceDir,processFile);
+ if(file.exists()) {
+ getLog().info("process file: " + file.getName());
+ try {
+ saxParser.parse(file, handler);
+ } catch (Exception e) {
+ getLog().error("Error process file: " + file.getAbsolutePath() + "\n" + e.getMessage(), e);
+ }
+ }
+ }
+
+ } catch (Exception e) {
+ getLog().error(e);
+ }
+
+ return handler;
+ }
+
+ protected FileObject resolveArtifact(Artifact artifact) {
+ FileObject jarFileObjects = null;
+ if(artifact != null) {
+ try {
+ resolver.resolve(artifact, Collections.EMPTY_LIST, localRepository);
+ getLog().info("artifact " + artifact.getFile().getAbsolutePath() + " is resolved");
+ } catch (ArtifactResolutionException e) {
+ getLog().error("Error with resolve artifact " + artifact.getFile().getAbsolutePath() + "\n" + e.getMessage(), e);
+ } catch (ArtifactNotFoundException e) {
+ getLog().error("Not found artifact " + artifact.getFile().getAbsolutePath() + "\n" + e.getMessage(), e);
+ }
+
+ File file = artifact.getFile();
+ try {
+ FileSystemManager manager = VFS.getManager();
+ jarFileObjects = manager.resolveFile("jar://" + file.getAbsolutePath());
+ } catch (FileSystemException e) {
+ getLog().error("Error during processing file: " + file.getAbsolutePath()+ "\n" + e.getMessage(), e);
+ }
+ }
+ return jarFileObjects;
+ }
+
+ public Digester getDigester() {
+ // default digester for *.component-dependencies.xml
+ return PluginUtils.createDefaultDigester();
+ }
+
+ protected ClassLoader createClassLoader() {
+
+ ClassLoader classLoader = null;
+ try {
+
+ Set <Artifact> artifacts = resolveDependenciesArtifacts();
+
+ //create a new classloading space
+ ClassWorld world = new ClassWorld();
+
+ //use the existing ContextClassLoader in a realm of the classloading space
+ ClassRealm realm = world.newRealm("org.richfaces.cdk", Thread.currentThread().getContextClassLoader());
+
+ //create another realm for the app jars
+ ClassRealm childRealm = realm.createChildRealm("jar");
+ for(Artifact jar : artifacts ) {
+ childRealm.addConstituent(jar.getFile().toURL());
+ }
+
+ // add project classes, scripts etc ...
+ List compileClasspathElements = project.getCompileClasspathElements();
+ for (Object path: compileClasspathElements) {
+ try {
+ childRealm.addConstituent(new File((String)path).toURI().toURL());
+ } catch (Exception e) {
+ getLog().error(e);
+ }
+ }
+
+ //make the child realm the ContextClassLoader
+ classLoader = childRealm.getClassLoader();
+
+ } catch (Exception e) {
+ getLog().error(e);
+ }
+ return classLoader;
+ }
+}
Modified: trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/utils/PluginUtils.java
===================================================================
--- trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/utils/PluginUtils.java 2009-01-22 14:13:07 UTC (rev 12367)
+++ trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/utils/PluginUtils.java 2009-01-22 14:26:55 UTC (rev 12368)
@@ -1,15 +1,11 @@
package org.richfaces.cdk.rd.utils;
-import java.io.File;
-import java.io.FileOutputStream;
import java.io.InputStream;
-import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.digester.Digester;
import org.apache.commons.vfs.FileObject;
-import org.codehaus.plexus.util.IOUtil;
import org.richfaces.cdk.rd.Component;
import org.richfaces.cdk.rd.Components;
import org.richfaces.cdk.rd.JarResourceScanner;
@@ -21,24 +17,6 @@
public static String [] DEFAULT_PROCESS_INCLUDES = new String [] {"**/*.xhtml"};
-
- public static void mergeFiles(File dest, URL resource) throws Exception{
- FileOutputStream out = new FileOutputStream(dest, true);
- try {
- InputStream in = resource.openStream();
- try {
- IOUtil.copy(in, out);
- out.write('\n');
- } finally {
- IOUtil.close(in);
- in = null;
- }
- } finally {
- IOUtil.close(out);
- out = null;
- }
- }
-
public static FileObject [] resolveConfigsFromJar(FileObject jarFileObject, String [] patterns) throws Exception {
FileObject [] result = new FileObject[0];
JarResourceScanner jarScanner = new JarResourceScanner();
@@ -76,7 +54,7 @@
digester.addObjectCreate("components/component", Component.class);
digester.addCallMethod("components/component/name", "setComponentName",0);
digester.addCallMethod("components/component/scripts/script", "addScript",0);
- digester.addCallMethod("components/component/styles/styles", "addStyle",0);
+ digester.addCallMethod("components/component/styles/style", "addStyle",0);
digester.addSetNext("components/component", "addComponent");
return digester;
}
16 years, 11 months
JBoss Rich Faces SVN: r12367 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/pages/tabPanel and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2009-01-22 09:13:07 -0500 (Thu, 22 Jan 2009)
New Revision: 12367
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tabPanel/invisibleTabChildrenProcessingTest.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/RichPanelTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TabPanelTest.java
Log:
https://jira.jboss.org/jira/browse/RF-5558
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/RichPanelTestBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/RichPanelTestBean.java 2009-01-22 10:45:54 UTC (rev 12366)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/RichPanelTestBean.java 2009-01-22 14:13:07 UTC (rev 12367)
@@ -78,6 +78,12 @@
reset();
}
+ public void resetAndSelectTab() {
+ String tab = getSelectedTab();
+ reset();
+ setSelectedTab(tab);
+ }
+
/**
* Gets value of switchType field.
*
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tabPanel/invisibleTabChildrenProcessingTest.xhtml
===================================================================
(Binary files differ)
Property changes on: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tabPanel/invisibleTabChildrenProcessingTest.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TabPanelTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TabPanelTest.java 2009-01-22 10:45:54 UTC (rev 12366)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TabPanelTest.java 2009-01-22 14:13:07 UTC (rev 12367)
@@ -54,7 +54,9 @@
private final static String TAB_FACET_TEST_URL = "pages/tabPanel/tabFacetTest.xhtml";
private final static String DISABLED_TAB_URL = "pages/tabPanel/testDisabledTab.xhtml";
-
+
+ private final static String INVISIBLE_TAB_TEST_URL = "pages/tabPanel/invisibleTabChildrenProcessingTest.xhtml";
+
private final static String IMMEDIATE_TAB_URL = "pages/tabPanel/immediateTabTest.xhtml";
private final static String SERVER_AWARE_MODE_URL = "pages/tabPanel/testTabServerMode.xhtml";
@@ -70,12 +72,11 @@
params.put("parameter2", "value2");
params.put("parameter3", "value3");
}
-
- static final Map<String, String> TAB_PANEL_STYLES = new HashMap<String, String>();
- static {
- TAB_PANEL_STYLES.put("font-size", "16px");
- }
+ static final Map<String, String> TAB_PANEL_STYLES = new HashMap<String, String>();
+ static {
+ TAB_PANEL_STYLES.put("font-size", "16px");
+ }
@Test
public void testRichTabPanelComponent(Template template) {
@@ -466,6 +467,47 @@
autoTester.testRendered();
}
+ @Test
+ public void testChildrenComponentsAreNotProcessedForServerAwareModesAndInvisibleTabs(Template template) {
+ renderPage(INVISIBLE_TAB_TEST_URL, template, RESET_METHOD);
+ writeStatus("Check children components aren't processed for server-aware modes and invisible tabs");
+ String parentId = getParentId();
+ String selectedTabInputId = parentId + CONTROLS_FORM_ID + "selected";
+ String resetApplyButtonId = parentId + CONTROLS_FORM_ID + "reset_apply";
+ String submitButtonId = parentId + FORM_ID + "submit";
+ String _inputsId = parentId + FORM_ID + "_inputs";
+
+ writeStatus("Check all invisible server-aware tabs are not processed. The others are processed.");
+
+ clickCommandAndWait(submitButtonId);
+ String _inputs = selenium.getText(_inputsId);
+
+ Assert.assertTrue(_inputs.contains("1"), "Visible server-aware tabs (tab1) must be processed");
+ Assert.assertFalse(_inputs.contains("2"), "invisible server-aware tabs (tab2) must not be processed");
+ Assert.assertTrue(_inputs.contains("3"), "Non-server-aware tabs (tab3,tab4) have to be processed anyway");
+ Assert.assertTrue(_inputs.contains("4"), "Non-server-aware tabs (tab3,tab4) have to be processed anyway");
+
+ setValueById(selectedTabInputId, "tab2");
+ clickCommandAndWait(resetApplyButtonId);
+ clickCommandAndWait(submitButtonId);
+ _inputs = selenium.getText(_inputsId);
+
+ Assert.assertFalse(_inputs.contains("1"), "invisible server-aware tabs (tab1) must not be processed");
+ Assert.assertTrue(_inputs.contains("2"), "Visible server-aware tabs (tab2) must be processed");
+ Assert.assertTrue(_inputs.contains("3"), "Non-server-aware tabs (tab3,tab4) have to be processed anyway");
+ Assert.assertTrue(_inputs.contains("4"), "Non-server-aware tabs (tab3,tab4) have to be processed anyway");
+
+ setValueById(selectedTabInputId, "tab3");
+ clickCommandAndWait(resetApplyButtonId);
+ clickCommandAndWait(submitButtonId);
+ _inputs = selenium.getText(_inputsId);
+
+ Assert.assertFalse(_inputs.contains("1"), "invisible server-aware tabs (tab1) must not be processed");
+ Assert.assertFalse(_inputs.contains("2"), "invisible server-aware tabs (tab2) must not be processed");
+ Assert.assertTrue(_inputs.contains("3"), "Non-server-aware tabs (tab3,tab4) have to be processed anyway");
+ Assert.assertTrue(_inputs.contains("4"), "Non-server-aware tabs (tab3,tab4) have to be processed anyway");
+ }
+
private void testListener(String parentId) {
String linkId = parentId + FORM_ID + "tab2_lbl";
16 years, 11 months
JBoss Rich Faces SVN: r12366 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/pages/dropDownMenu and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2009-01-22 05:45:54 -0500 (Thu, 22 Jan 2009)
New Revision: 12366
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DropDownMenuTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dropDownMenu/dropDownMenuAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dropDownMenu/dropDownMenuTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DropDownMenuTest.java
Log:
RF-5807, RF-5808
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DropDownMenuTestBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DropDownMenuTestBean.java 2009-01-22 10:15:36 UTC (rev 12365)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DropDownMenuTestBean.java 2009-01-22 10:45:54 UTC (rev 12366)
@@ -95,6 +95,20 @@
public void setImmediate(boolean immediate) {
this.immediate = immediate;
}
+
+ /**
+ * @return the input
+ */
+ public String getInput() {
+ return "Text";
+ }
+
+ /**
+ * @param input the input to set
+ */
+ public void setInput(String input) {
+
+ }
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dropDownMenu/dropDownMenuAutoTest.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dropDownMenu/dropDownMenuAutoTest.xhtml 2009-01-22 10:15:36 UTC (rev 12365)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dropDownMenu/dropDownMenuAutoTest.xhtml 2009-01-22 10:45:54 UTC (rev 12366)
@@ -14,10 +14,13 @@
>
<rich:menuItem id="new"
submitMode="ajax"
- immediate="#{autoTestBean.immediate}"
+ immediate="#{autoTestBean.immediate}"
+ ajaxSingle="#{autoTestBean.ajaxSingle}"
value="New"
action="#{ddmenuBean.doNew}"
- actionListener="#{autoTestBean.actionListener}"/>
+ actionListener="#{autoTestBean.actionListener}">
+ <h:inputText id="inputRequired" value="#{ddmenuBean.input}" style="display: none" required="true"></h:inputText>
+ </rich:menuItem>
<f:param name="parameter1" value="value1" />
</rich:dropDownMenu>
</ui:define>
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dropDownMenu/dropDownMenuTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DropDownMenuTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DropDownMenuTest.java 2009-01-22 10:15:36 UTC (rev 12365)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DropDownMenuTest.java 2009-01-22 10:45:54 UTC (rev 12366)
@@ -20,6 +20,7 @@
*/
package org.richfaces.testng;
+import org.ajax4jsf.autotest.bean.AutoTestBean;
import org.ajax4jsf.template.Template;
import org.richfaces.AutoTester;
import org.richfaces.SeleniumTestBase;
@@ -66,12 +67,35 @@
clickCommandAndWait(submitId);
AssertNotPresent(messageId, "Validation message should be displayed for external component in case of dropdown menu immediate=true");
}
+
+ @Test
+ public void testAjaxSingle(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, RESET_METHOD);
+
+ autoTester.testAjaxSingle();
+ }
+
+ @Test
+ public void testAjaxSingleWithExternalValidationFailed(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, RESET_METHOD);
+
+ autoTester.testAjaxSingleWithInternalValidationFailed();
+ }
+
public String getTestUrl() {
return "pages/dropDownMenu/dropDownMenuTest.xhtml";
}
@Override
+ public void setInternalValidationFailed() {
+ String inputId = getAutoTester(this).getClientId("inputRequired");
+ setValueById(inputId, "");
+ }
+
+ @Override
public String getAutoTestUrl() {
return "pages/dropDownMenu/dropDownMenuAutoTest.xhtml";
}
16 years, 11 months
JBoss Rich Faces SVN: r12365 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces/testng and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2009-01-22 05:15:36 -0500 (Thu, 22 Jan 2009)
New Revision: 12365
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dropDownMenu/testImmediateWithExternalValidation.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dropDownMenu/dropDownMenuAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DropDownMenuTest.java
Log:
RF-5805
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dropDownMenu/dropDownMenuAutoTest.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dropDownMenu/dropDownMenuAutoTest.xhtml 2009-01-21 19:39:59 UTC (rev 12364)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dropDownMenu/dropDownMenuAutoTest.xhtml 2009-01-22 10:15:36 UTC (rev 12365)
@@ -9,16 +9,15 @@
<ui:composition template="#{templateBean.autoTestTemplate}">
<ui:define name="component">
<rich:dropDownMenu id="componentId"
- actionListener="#{autoTestBean.actionListener}"
- immediate="#{autoTestBean.immediate}"
- ajaxSingle="#{autoTestBean.ajaxSingle}"
- reRender="#{autoTestBean.reRender}"
- limitToList="#{autoTestBean.limitToList}"
- bypassUpdates="#{autoTestBean.bypassUpdate}"
rendered="#{autoTestBean.rendered}"
- oncomplete="#{autoTestBean.oncomplete}"
+ value="test"
>
- <rich:menuItem id="new" submitMode="ajax" value="New" action="#{ddmenuBean.doNew}" actionListener="#{autoTestBean.actionListener}"/>
+ <rich:menuItem id="new"
+ submitMode="ajax"
+ immediate="#{autoTestBean.immediate}"
+ value="New"
+ action="#{ddmenuBean.doNew}"
+ actionListener="#{autoTestBean.actionListener}"/>
<f:param name="parameter1" value="value1" />
</rich:dropDownMenu>
</ui:define>
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dropDownMenu/testImmediateWithExternalValidation.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dropDownMenu/testImmediateWithExternalValidation.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dropDownMenu/testImmediateWithExternalValidation.xhtml 2009-01-22 10:15:36 UTC (rev 12365)
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition template="#{templateBean.template}">
+ <ui:define name="component">
+ <h:form id="form">
+ <h:message id="ii_m" for="ii"></h:message>
+ <h:inputText id="ii" value="" required="true"></h:inputText>
+ <rich:dropDownMenu id="componentId"
+ value="test">
+ <rich:menuItem id="new"
+ immediate="#{ddmenuBean.immediate}"
+ submitMode="server"
+ value="New">
+ <h:inputText value="" required="true" style="display: none;"></h:inputText>
+ </rich:menuItem>
+ </rich:dropDownMenu>
+ <br/>
+ <h:commandButton value="submit"></h:commandButton>
+ </h:form>
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DropDownMenuTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DropDownMenuTest.java 2009-01-21 19:39:59 UTC (rev 12364)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DropDownMenuTest.java 2009-01-22 10:15:36 UTC (rev 12365)
@@ -30,6 +30,8 @@
static final String RESET_METHOD = "#{ddmenuBean.reset}";
static final String INIT_IMMEDIATE_METHOD = "#{ddmenuBean.initImmediateTest}";
+
+ static final String IMMEDIATE_WITH_EXTERNAL_VALIDATION_URL = "/pages/dropDownMenu/testImmediateWithExternalValidation.xhtml";
@Test
public void testDropDownMenuComponent(Template template) {
@@ -52,6 +54,18 @@
testDropDownComponent();
}
+
+ @Test
+ public void testImmediateWithExternalValidation(Template template) {
+ renderPage(IMMEDIATE_WITH_EXTERNAL_VALIDATION_URL, template, INIT_IMMEDIATE_METHOD);
+
+ String parentId = getParentId() + "form:";
+ String messageId = parentId + "ii_m";
+ String submitId = parentId + "new";
+
+ clickCommandAndWait(submitId);
+ AssertNotPresent(messageId, "Validation message should be displayed for external component in case of dropdown menu immediate=true");
+ }
public String getTestUrl() {
return "pages/dropDownMenu/dropDownMenuTest.xhtml";
16 years, 11 months
JBoss Rich Faces SVN: r12364 - in trunk/ui/tree/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-01-21 14:39:59 -0500 (Wed, 21 Jan 2009)
New Revision: 12364
Modified:
trunk/ui/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
trunk/ui/tree/src/main/templates/htmlTree.jspx
Log:
https://jira.jboss.org/jira/browse/RF-5835
Modified: trunk/ui/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2009-01-21 17:51:29 UTC (rev 12363)
+++ trunk/ui/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2009-01-21 19:39:59 UTC (rev 12364)
@@ -47,6 +47,7 @@
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.ComponentsVariableResolver;
import org.ajax4jsf.renderkit.RendererUtils;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.richfaces.component.UITree;
import org.richfaces.component.UITreeNode;
import org.richfaces.component.nsutils.NSUtils;
@@ -570,29 +571,45 @@
return buffer.toString();
}
+ public String writeScriptElement(FacesContext context, UITree tree, String code) throws IOException {
+ /*
+ <div id="#{clientId}:script" class="dr-tree-h-script">
+ <script type="text/javascript">
+ </script>
+ </div>
+ */
+
+ String scriptId = tree.getBaseClientId(context) + NamingContainer.SEPARATOR_CHAR + "script";
+ ResponseWriter responseWriter = context.getResponseWriter();
+ responseWriter.startElement(HTML.DIV_ELEM, tree);
+ responseWriter.writeAttribute(HTML.id_ATTRIBUTE, scriptId, null);
+ responseWriter.writeAttribute(HTML.class_ATTRIBUTE, "dr-tree-h-script", null);
+
+ responseWriter.startElement(HTML.SCRIPT_ELEM, tree);
+ responseWriter.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
+
+ if (code != null && code.length() != 0) {
+ responseWriter.writeText(code, null);
+ }
+
+ responseWriter.endElement(HTML.SCRIPT_ELEM);
+
+ responseWriter.endElement(HTML.DIV_ELEM);
+
+ return scriptId;
+ }
+
private void writeScript(FacesContext context, UITree tree, List encodedAreaIds,
Set renderedAreas) throws IOException {
- final ResponseWriter writer = context.getResponseWriter();
+
final String clientId = tree.getBaseClientId(context);
-
- String scriptId = clientId + NamingContainer.SEPARATOR_CHAR + "script";
- writer.startElement("div", tree);
- getUtils().writeAttribute(writer, "id", scriptId);
- writer.startElement("script", tree);
- getUtils().writeAttribute(writer, "type", "text/javascript");
-
StringBuffer sb = new StringBuffer("$(");
sb.append(ScriptUtils.toScript(clientId));
sb.append(").component.");
new JSFunction("refreshAfterAjax", encodedAreaIds, getSelectionValue(context, tree)).appendScript(sb);
- writer.writeText(sb, null);
- writer.endElement("script");
- writer.endElement("div");
-
- renderedAreas.add(scriptId);
-
+ renderedAreas.add(writeScriptElement(context, tree, sb.toString()));
}
public void encodeChildren(FacesContext context, UIComponent component)
Modified: trunk/ui/tree/src/main/templates/htmlTree.jspx
===================================================================
--- trunk/ui/tree/src/main/templates/htmlTree.jspx 2009-01-21 17:51:29 UTC (rev 12363)
+++ trunk/ui/tree/src/main/templates/htmlTree.jspx 2009-01-21 19:39:59 UTC (rev 12364)
@@ -65,9 +65,10 @@
#{this:getScriptContributions("tree", context, component)}
}());
</script>
- <div id="#{clientId}:script" class="dr-tree-h-script">
- <script type="text/javascript">
- </script>
+
+ <f:call name="writeScriptElement">
+ <f:parameter value=""/>
+ </f:call>
+
</div>
- </div>
</f:root>
16 years, 11 months
JBoss Rich Faces SVN: r12363 - trunk/sandbox/ui/colorPicker/src/main/resources/org/richfaces/ui/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2009-01-21 12:51:29 -0500 (Wed, 21 Jan 2009)
New Revision: 12363
Modified:
trunk/sandbox/ui/colorPicker/src/main/resources/org/richfaces/ui/renderkit/html/scripts/ui.colorpicker.js
Log:
colorPicker: ui bug were fixed
Modified: trunk/sandbox/ui/colorPicker/src/main/resources/org/richfaces/ui/renderkit/html/scripts/ui.colorpicker.js
===================================================================
--- trunk/sandbox/ui/colorPicker/src/main/resources/org/richfaces/ui/renderkit/html/scripts/ui.colorpicker.js 2009-01-21 15:05:33 UTC (rev 12362)
+++ trunk/sandbox/ui/colorPicker/src/main/resources/org/richfaces/ui/renderkit/html/scripts/ui.colorpicker.js 2009-01-21 17:51:29 UTC (rev 12363)
@@ -16,6 +16,10 @@
},
_init: function() {
+ this.patternHex=new RegExp();
+ this.patternDec=new RegExp();
+ this.patternHex.compile("[^0-9A-Fa-f]+");
+ this.patternDec.compile("[^0-9]+");
this.charMin = 65;
var o = this.options, self = this,
tpl = $(o.clientId.toString()+"-popup");
@@ -132,9 +136,10 @@
_setNewColor: function(hsb) {
this.newColor.css('backgroundColor', '#' + this._HSBToHex(hsb));
},
+
_keyDown: function(e) {
var pressedKey = e.charCode || e.keyCode || -1;
- if ((pressedKey > this.charMin && pressedKey <= 90) || pressedKey == 32) {
+ if ((pressedKey > this.charMin-1 && pressedKey <= 90) || pressedKey == 32) {
return false;
}
},
@@ -144,6 +149,16 @@
target = target || e.target;
if (target.parentNode.className.indexOf('-hex') > 0) {
+ if(this.patternHex.test(target.value)){
+ target.value = 0;
+ }
+ }else{
+ if(this.patternDec.test(target.value)){
+ target.value = 0;
+ }
+ }
+
+ if (target.parentNode.className.indexOf('-hex') > 0) {
col = this._HexToHSB(this.fields.eq(0).val());
@@ -172,7 +187,7 @@
this._fillHexFields(col);
this._fillHSBFields(col);
}
- this._setSelector(col);
+ this._setSelector(col);
this._setHue(col);
this._setNewColor(col);
this._trigger('change', e, { options: this.options, hsb: col, hex: this._HSBToHex(col), rgb: this._HSBToRGB(col) });
16 years, 11 months
JBoss Rich Faces SVN: r12362 - trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2009-01-21 10:05:33 -0500 (Wed, 21 Jan 2009)
New Revision: 12362
Modified:
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
Log:
https://jira.jboss.org/jira/browse/RF-5837
Modified: trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
===================================================================
--- trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2009-01-21 11:56:04 UTC (rev 12361)
+++ trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2009-01-21 15:05:33 UTC (rev 12362)
@@ -403,7 +403,9 @@
hh = parseInt(match[h],10); if (isNaN(hh)) return null;
if (a!=undefined)
{
- aa = match[a].toLowerCase();
+ aa = match[a];
+ if (!aa) return null;
+ aa = aa.toLowerCase();
if ((aa!='am' && aa!='pm') || hh<1 || hh>12) return null;
if (aa=='pm')
{
16 years, 11 months
JBoss Rich Faces SVN: r12361 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces/testng and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2009-01-21 06:56:04 -0500 (Wed, 21 Jan 2009)
New Revision: 12361
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenuItem/panelMenuItemAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuItemTest.java
Log:
https://jira.jboss.org/jira/browse/RF-5794
https://jira.jboss.org/jira/browse/RF-5797
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenuItem/panelMenuItemAutoTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuItemTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuItemTest.java 2009-01-21 10:10:53 UTC (rev 12360)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuItemTest.java 2009-01-21 11:56:04 UTC (rev 12361)
@@ -34,6 +34,22 @@
tester.testRequestParameters(params);
}
+ @Test
+ public void testBypassUpdatesAttribute(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Test component with bypassUpdates = true skips update model values phase");
+ tester.testBypassUpdate();
+ }
+
+ @Test
+ public void testOncomplete(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Test oncomplete attribute");
+ tester.testOncomplete();
+ }
+
@Override
public void sendAjax() {
clickAjaxCommandAndWait("icon" + getAutoTester(this).getClientId("") + "item");
16 years, 11 months
JBoss Rich Faces SVN: r12360 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/pages/dropDownMenu and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2009-01-21 05:10:53 -0500 (Wed, 21 Jan 2009)
New Revision: 12360
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dropDownMenu/dropDownMenuAutoTest.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DropDownMenuTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dropDownMenu/dropDownMenuTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DropDownMenuTest.java
Log:
RF-5805
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DropDownMenuTestBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DropDownMenuTestBean.java 2009-01-21 08:43:54 UTC (rev 12359)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/DropDownMenuTestBean.java 2009-01-21 10:10:53 UTC (rev 12360)
@@ -23,6 +23,8 @@
public class DropDownMenuTestBean {
private String actionName = "";
+
+ private boolean immediate;
/**
* Gets value of actionName field.
@@ -31,6 +33,16 @@
public String getActionName() {
return actionName;
}
+
+ public void reset() {
+ actionName = "";
+ immediate = false;
+ }
+
+ public void initImmediateTest() {
+ reset();
+ immediate = true;
+ }
/**
* Set a new value for actionName field.
@@ -70,4 +82,20 @@
return null;
}
+ /**
+ * @return the immediate
+ */
+ public boolean getImmediate() {
+ return immediate;
+ }
+
+ /**
+ * @param immediate the immediate to set
+ */
+ public void setImmediate(boolean immediate) {
+ this.immediate = immediate;
+ }
+
+
+
}
Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dropDownMenu/dropDownMenuAutoTest.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dropDownMenu/dropDownMenuAutoTest.xhtml (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dropDownMenu/dropDownMenuAutoTest.xhtml 2009-01-21 10:10:53 UTC (rev 12360)
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition template="#{templateBean.autoTestTemplate}">
+ <ui:define name="component">
+ <rich:dropDownMenu id="componentId"
+ actionListener="#{autoTestBean.actionListener}"
+ immediate="#{autoTestBean.immediate}"
+ ajaxSingle="#{autoTestBean.ajaxSingle}"
+ reRender="#{autoTestBean.reRender}"
+ limitToList="#{autoTestBean.limitToList}"
+ bypassUpdates="#{autoTestBean.bypassUpdate}"
+ rendered="#{autoTestBean.rendered}"
+ oncomplete="#{autoTestBean.oncomplete}"
+ >
+ <rich:menuItem id="new" submitMode="ajax" value="New" action="#{ddmenuBean.doNew}" actionListener="#{autoTestBean.actionListener}"/>
+ <f:param name="parameter1" value="value1" />
+ </rich:dropDownMenu>
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dropDownMenu/dropDownMenuTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DropDownMenuTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DropDownMenuTest.java 2009-01-21 08:43:54 UTC (rev 12359)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DropDownMenuTest.java 2009-01-21 10:10:53 UTC (rev 12360)
@@ -21,64 +21,99 @@
package org.richfaces.testng;
import org.ajax4jsf.template.Template;
+import org.richfaces.AutoTester;
import org.richfaces.SeleniumTestBase;
import org.testng.annotations.Test;
public class DropDownMenuTest extends SeleniumTestBase {
+
+ static final String RESET_METHOD = "#{ddmenuBean.reset}";
+
+ static final String INIT_IMMEDIATE_METHOD = "#{ddmenuBean.initImmediateTest}";
@Test
public void testDropDownMenuComponent(Template template) {
- renderPage(template);
+ renderPage(template, RESET_METHOD);
- String parentId = getParentId() + "_form:";
- String file = parentId + "file";
- String open = parentId + "open:anchor";
- String saveAs = parentId + "saveAs:anchor";
- String save = parentId + "save:anchor";
- String saveAll = parentId + "saveAll:anchor";
- String close = parentId + "close:anchor";
- String exit = parentId + "exit:anchor";
- String operation = parentId + "operation";
+ testDropDownComponent();
+ }
+
+ @Test
+ public void testWithExternalvalidationFailure(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, RESET_METHOD);
+
+ autoTester.testExtrenalValidationFailure();
+ }
+
+ @Test
+ public void testImmediate(Template template) {
+ renderPage(template, INIT_IMMEDIATE_METHOD);
+
+ testDropDownComponent();
+ }
- writeStatus("Check menu item in ajax mode");
+ public String getTestUrl() {
+ return "pages/dropDownMenu/dropDownMenuTest.xhtml";
+ }
+
+ @Override
+ public String getAutoTestUrl() {
+ return "pages/dropDownMenu/dropDownMenuAutoTest.xhtml";
+ }
+
+ @Override
+ public void sendAjax() {
+ String ajaxCommandId = getAutoTester(this).getClientId("new");
+ clickAjaxCommandAndWait(ajaxCommandId);
+ }
+
+
+ private void testDropDownComponent() {
+ String parentId = getParentId() + "_form:";
+ String file = parentId + "file";
+ String open = parentId + "open:anchor";
+ String saveAs = parentId + "saveAs:anchor";
+ String save = parentId + "save:anchor";
+ String saveAll = parentId + "saveAll:anchor";
+ String close = parentId + "close:anchor";
+ String exit = parentId + "exit:anchor";
+ String operation = parentId + "operation";
- selenium.mouseOver(file);
- selenium.mouseOver(saveAs);
- clickById(saveAll);
+ writeStatus("Check menu item in ajax mode");
- AssertTextEquals(operation, "Save All");
+ selenium.mouseOver(file);
+ selenium.mouseOver(saveAs);
+ clickAjaxCommandAndWait(saveAll);
- selenium.mouseOver(file);
- selenium.mouseOver(saveAs);
- clickById(save);
+ AssertTextEquals(operation, "Save All");
- AssertTextEquals(operation, "Save");
+ selenium.mouseOver(file);
+ selenium.mouseOver(saveAs);
+ clickAjaxCommandAndWait(save);
- writeStatus("Check the drop down menu closed");
+ AssertTextEquals(operation, "Save");
- AssertNotVisible(save);
- AssertNotVisible(saveAs);
+ writeStatus("Check the drop down menu closed");
- writeStatus("Check menu item in server mode");
+ AssertNotVisible(save);
+ AssertNotVisible(saveAs);
- selenium.mouseOver(file);
- clickCommandAndWait(close);
+ writeStatus("Check menu item in server mode");
- AssertTextEquals(operation, "Close");
+ selenium.mouseOver(file);
+ clickCommandAndWait(close);
- writeStatus("Check menu item in 'none' mode");
+ AssertTextEquals(operation, "Close");
- selenium.mouseOver(file);
- selenium.mouseOver(exit);
- clickById(exit);
+ writeStatus("Check menu item in 'none' mode");
- AssertTextEquals(operation, "Close");
- AssertNotVisible(exit);
+ selenium.mouseOver(file);
+ selenium.mouseOver(exit);
+ clickById(exit);
+ AssertTextEquals(operation, "Close");
+ AssertNotVisible(exit);
}
- public String getTestUrl() {
- return "pages/dropDownMenu/dropDownMenuTest.xhtml";
- }
-
}
16 years, 11 months
JBoss Rich Faces SVN: r12359 - Reports/3.3.0 and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: tkuprevich
Date: 2009-01-21 03:43:54 -0500 (Wed, 21 Jan 2009)
New Revision: 12359
Modified:
trunk/test-applications/qa/Test Reports/3.3.0/ComponentsAssignment3.3.0.GA.xls
Log:
Modified: trunk/test-applications/qa/Test Reports/3.3.0/ComponentsAssignment3.3.0.GA.xls
===================================================================
(Binary files differ)
16 years, 11 months