JBoss Rich Faces SVN: r12341 - in trunk/sandbox/samples/maven-rd-plugin-sample: src/main/webapp/WEB-INF and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-01-19 13:21:17 -0500 (Mon, 19 Jan 2009)
New Revision: 12341
Modified:
trunk/sandbox/samples/maven-rd-plugin-sample/pom.xml
trunk/sandbox/samples/maven-rd-plugin-sample/src/main/webapp/WEB-INF/web.xml
trunk/sandbox/samples/maven-rd-plugin-sample/src/main/webapp/pages/index.jsp
trunk/sandbox/samples/maven-rd-plugin-sample/src/main/webapp/pages/index.xhtml
trunk/sandbox/samples/maven-rd-plugin-sample/src/main/webapp/pages/oneMorePage.xhtml
Log:
Modified: trunk/sandbox/samples/maven-rd-plugin-sample/pom.xml
===================================================================
--- trunk/sandbox/samples/maven-rd-plugin-sample/pom.xml 2009-01-19 18:20:28 UTC (rev 12340)
+++ trunk/sandbox/samples/maven-rd-plugin-sample/pom.xml 2009-01-19 18:21:17 UTC (rev 12341)
@@ -28,8 +28,17 @@
<namespaces>
<namespace>http://richfaces.org/rich</namespace>
<namespace>http://richfaces.org/a4j</namespace>
- </namespaces>
- </configuration>
+ </namespaces>
+ <outputScriptDirectory>
+ ${basedir}/src/main/webapp/scripts
+ </outputScriptDirectory>
+ <beforeIncludes>
+ <beforeInclude>org/test/scripts/before.js</beforeInclude>
+ </beforeIncludes>
+ <afterIncludes>
+ <afterInclude>org/test/scripts/after.js</afterInclude>
+ </afterIncludes>
+ </configuration>
<executions>
<execution>
<phase>process-resources</phase>
Modified: trunk/sandbox/samples/maven-rd-plugin-sample/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/sandbox/samples/maven-rd-plugin-sample/src/main/webapp/WEB-INF/web.xml 2009-01-19 18:20:28 UTC (rev 12340)
+++ trunk/sandbox/samples/maven-rd-plugin-sample/src/main/webapp/WEB-INF/web.xml 2009-01-19 18:21:17 UTC (rev 12341)
@@ -15,6 +15,12 @@
<param-value>com.sun.facelets.FaceletViewHandler</param-value>
</context-param>
<context-param>
+ <param-name>org.richfaces.LoadScriptStrategy</param-name>
+ <param-value>NONE</param-value>
+</context-param>
+
+
+ <context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
Modified: trunk/sandbox/samples/maven-rd-plugin-sample/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/maven-rd-plugin-sample/src/main/webapp/pages/index.jsp 2009-01-19 18:20:28 UTC (rev 12340)
+++ trunk/sandbox/samples/maven-rd-plugin-sample/src/main/webapp/pages/index.jsp 2009-01-19 18:21:17 UTC (rev 12341)
@@ -1,8 +1,11 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<html>
- <head>
- <title></title>
+ <head>
+ <script src="/scripts/custom-dependencies.js" type="text/javascript">
+ </script>
+ </head>
+
</head>
<body>
<f:view>
Modified: trunk/sandbox/samples/maven-rd-plugin-sample/src/main/webapp/pages/index.xhtml
===================================================================
--- trunk/sandbox/samples/maven-rd-plugin-sample/src/main/webapp/pages/index.xhtml 2009-01-19 18:20:28 UTC (rev 12340)
+++ trunk/sandbox/samples/maven-rd-plugin-sample/src/main/webapp/pages/index.xhtml 2009-01-19 18:21:17 UTC (rev 12341)
@@ -7,7 +7,12 @@
xmlns:rich="http://richfaces.org/rich"
xmlns:c="http://java.sun.com/jsp/jstl/core"
>
+ <head>
+ <script src="scripts/custom-dependencies.js" type="text/javascript">
+ </script>
+ </head>
<f:view>
+
<h:form>
<rich:datascroller align="left" for="carList" maxPages="20"
page="#{dataTableScrollerBean.scrollerPage}" reRender="sc2" id="sc1" />
Modified: trunk/sandbox/samples/maven-rd-plugin-sample/src/main/webapp/pages/oneMorePage.xhtml
===================================================================
--- trunk/sandbox/samples/maven-rd-plugin-sample/src/main/webapp/pages/oneMorePage.xhtml 2009-01-19 18:20:28 UTC (rev 12340)
+++ trunk/sandbox/samples/maven-rd-plugin-sample/src/main/webapp/pages/oneMorePage.xhtml 2009-01-19 18:21:17 UTC (rev 12341)
@@ -7,6 +7,11 @@
xmlns:rich="http://richfaces.org/rich"
xmlns:c="http://java.sun.com/jstl/core"
>
+ <head>
+ <script src="../scripts/custom-dependencies.js" type="text/javascript">
+ </script>
+ </head>
+
<f:view>
<h:form>
<rich:toolBar id="toolBar" itemSeparator="line" height="28px">
17 years, 3 months
JBoss Rich Faces SVN: r12340 - in trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd: mojo and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-01-19 13:20:28 -0500 (Mon, 19 Jan 2009)
New Revision: 12340
Modified:
trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/handler/ComponentsHandler.java
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/utils/PluginUtils.java
Log:
Modified: trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/handler/ComponentsHandler.java
===================================================================
--- trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/handler/ComponentsHandler.java 2009-01-19 15:51:55 UTC (rev 12339)
+++ trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/handler/ComponentsHandler.java 2009-01-19 18:20:28 UTC (rev 12340)
@@ -1,7 +1,9 @@
package org.richfaces.cdk.rd.handler;
-import java.util.ArrayList;
+import java.util.LinkedHashSet;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
import org.richfaces.cdk.rd.Component;
import org.richfaces.cdk.rd.Components;
@@ -14,31 +16,22 @@
*/
public class ComponentsHandler extends DefaultHandler{
- private List <Components> components;
+ private Map <String,Components> components;
- private String tempString;
+ private Set <String> scripts = new LinkedHashSet<String>();
- private List <String> scripts = new ArrayList<String>();
-
- private List <String> styles = new ArrayList<String>();
-
+ private Set <String> styles = new LinkedHashSet<String>();
+
+
@Override
- public void characters(char[] ch, int start, int length) throws SAXException {
- tempString = new String(ch, start, length);
- }
-
- @Override
public void endElement(String uri, String localName, String name) throws SAXException {
- if(components != null) {
- for (Components library: components) {
- if(library.getNamespace().equals(uri)) {
- List <Component> components = library.getComponents();
- for(Component component : components ){
- if(localName.equals(component.getComponentName())) {
- collectScripts(component);
- collectStyles(component);
- }
- }
+ if(components != null && components.containsKey(uri)) {
+ Components library = components.get(uri);
+ List <Component> components = library.getComponents();
+ for(Component component : components ){
+ if(localName.equals(component.getComponentName())) {
+ collectScripts(component);
+ collectStyles(component);
}
}
}
@@ -46,33 +39,29 @@
private void collectStyles(Component component) {
for(String style : component.getStyles()) {
- if(!this.styles.contains(style)) {
- this.styles.add(style);
- }
+ this.styles.add(style);
}
}
private void collectScripts(Component component) {
for(String script : component.getScripts()) {
- if(!this.scripts.contains(script)) {
- this.scripts.add(script);
- }
+ this.scripts.add(script);
}
}
- public List <String> getStyles() {
+ public Set <String> getStyles() {
return this.styles;
}
- public List <String> getScripts() {
+ public Set <String> getScripts() {
return this.scripts;
}
- public List<Components> getComponents() {
+ public Map <String, Components> getComponents() {
return components;
}
- public void setComponents(List<Components> components) {
+ public void setComponents(Map <String, Components> components) {
this.components = components;
}
}
Modified: 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-19 15:51:55 UTC (rev 12339)
+++ trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo/CreateScriptMojo.java 2009-01-19 18:20:28 UTC (rev 12340)
@@ -22,14 +22,14 @@
package org.richfaces.cdk.rd.mojo;
import java.io.File;
-import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.lang.reflect.Method;
-import java.util.ArrayList;
+import java.net.URL;
+import java.util.Collection;
import java.util.Collections;
-import java.util.Iterator;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import javax.xml.parsers.SAXParser;
@@ -55,15 +55,10 @@
import org.codehaus.classworlds.ClassRealm;
import org.codehaus.classworlds.ClassWorld;
import org.codehaus.plexus.util.DirectoryScanner;
-import org.codehaus.plexus.util.IOUtil;
-import org.richfaces.cdk.rd.Component;
import org.richfaces.cdk.rd.Components;
-import org.richfaces.cdk.rd.JarResourceScanner;
import org.richfaces.cdk.rd.handler.ComponentsHandler;
import org.richfaces.cdk.rd.utils.PluginUtils;
-import com.sun.swing.internal.plaf.metal.resources.metal;
-
/**
* @author Anton Belevich
*
@@ -85,7 +80,6 @@
* @component
*/
protected MavenProjectBuilder builder;
-
/**
* Used to look up Artifacts in the remote repository.
@@ -126,6 +120,7 @@
*/
private File webSourceDirectory;
+
/**
* namespaces
* @parameter
@@ -134,11 +129,17 @@
private List namespaces;
/**
- * loadOrder
- * @parameter;
+ * beforeIncludes
+ * @parameter
*/
- private String loadOrder;
+ private List beforeIncludes;
+ /**
+ * afterIncludes
+ * @parameter
+ */
+ private List afterIncludes;
+
/**
*
* @component
@@ -150,27 +151,20 @@
public void execute() throws MojoExecutionException {
try {
- Artifact richfacesUI = createDependencyArtifact("richfaces-ui", project.getVersion(), "jar");
- Artifact richfacesImpl = createDependencyArtifact("richfaces-impl", project.getVersion(), "jar");
-
- List <FileObject> richfaces = new ArrayList<FileObject>();
- FileObject jarRichfacesUI = resolveArtifact(richfacesUI);
- richfaces.add(jarRichfacesUI);
- FileObject jarRichfacesImpl = resolveArtifact(richfacesImpl);
- richfaces.add(jarRichfacesImpl);
-
- FileObject [] configs = PluginUtils.resolveConfigsFromJar(jarRichfacesUI, PluginUtils.DEFAULT_CONFIG_PATTERNS);
+ Set <Artifact> artifacts = resolveDependenciesArtifacts();
Digester defaultDigester = getDigester();
- List <Components> components = PluginUtils.processConfigs(configs, defaultDigester);
+ 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]);
- List result = handler.getScripts();
-
- mergeScripts(result, richfaces, outputScriptDirectory);
- for (Iterator iterator = result.iterator(); iterator.hasNext();) {
- getLog().info("collect: " + iterator.next());
- }
-
+ Set <String> result = handler.getScripts();
+ mergeScripts(result,outputScriptDirectory, beforeIncludes, afterIncludes);
+
} catch (Exception e) {
throw new MojoExecutionException(e.getMessage(),e);
}
@@ -181,7 +175,7 @@
return PluginUtils.createDefaultDigester();
}
- public ComponentsHandler findComponents (File webSourceDir, List <Components> components, String [] includes, String [] excludes) {
+ public ComponentsHandler findComponents (File webSourceDir, Map <String, Components> components, String [] includes, String [] excludes) {
DirectoryScanner scanner = new DirectoryScanner();
scanner.setBasedir(webSourceDir);
@@ -207,7 +201,7 @@
try {
saxParser.parse(file, handler);
} catch (Exception e) {
- getLog().error("Error process file: " + file.getAbsolutePath(), e);
+ getLog().error("Error process file: " + file.getAbsolutePath() + "\n" + e.getMessage(), e);
}
}
}
@@ -218,32 +212,14 @@
return handler;
}
-
- protected Artifact createDependencyArtifact(String id, String version, String type) throws Exception{
-
- List <Dependency> dependencies = project.getDependencies();
- Artifact artifact = null;
- for(Dependency dependency : dependencies) {
- if(dependency.getArtifactId().equals(id) && dependency.getVersion().equals(version) && dependency.getType().equals(type)) {
- String groupId = dependency.getGroupId();
- String artifactId = dependency.getArtifactId();
- String artifactVersion = dependency.getVersion();
- String scope = dependency.getScope();
- String artifactType = dependency.getType();
- artifact = factory.createArtifact(groupId, artifactId, artifactVersion, scope, artifactType);
- break;
- }
- }
-
- return artifact;
- }
-
- protected Set <Artifact> createProjectDependenciesArtifacts() {
+ 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);
@@ -253,32 +229,30 @@
protected FileObject resolveArtifact(Artifact artifact) {
- FileObject jarFileObject = null;
-
+ 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, e);
+ getLog().error("Error with resolve artifact " + artifact.getFile().getAbsolutePath() + "\n" + e.getMessage(), e);
} catch (ArtifactNotFoundException e) {
- getLog().error("Not found artifact " + artifact, e);
+ getLog().error("Not found artifact " + artifact.getFile().getAbsolutePath() + "\n" + e.getMessage(), e);
}
File file = artifact.getFile();
try {
FileSystemManager manager = VFS.getManager();
- jarFileObject = manager.resolveFile("jar://" + file.getAbsolutePath());
+ jarFileObjects = manager.resolveFile("jar://" + file.getAbsolutePath());
} catch (FileSystemException e) {
- getLog().error("Error during processing file: " + file.getAbsolutePath(), e);
- }
-
+ getLog().error("Error during processing file: " + file.getAbsolutePath()+ "\n" + e.getMessage(), e);
+ }
}
- return jarFileObject;
+ return jarFileObjects;
}
- protected void mergeScripts(List <String> scripts, List <FileObject> jarFileObjects, File outputScriptDirectory) {
+ protected void mergeScripts(Set <String> scripts, File outputScriptDirectory, List <String> beforeIncludes, List <String> afterIncludes) {
File assemblyScriptFile = new File(outputScriptDirectory, scriptPackName + ".js");
@@ -290,52 +264,85 @@
assemblyScriptFile.createNewFile();
} catch (IOException e) {
- getLog().error("Error create file: " + assemblyScriptFile.getAbsolutePath(), 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);
- for(String script: scripts) {
- try {
- if(script.endsWith(".js")) {
- getLog().info("merge file: " + script + " in to " + assemblyScriptFile.getAbsolutePath());
- PluginUtils.mergeFiles(assemblyScriptFile, jarFileObjects, script);
- } else {
-
- Set <Artifact> artifacts = createProjectDependenciesArtifacts();
+ } catch (Exception e) {
+ getLog().error(e);
+ }
- //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 jars = realm.createChildRealm("jar");
- for(Artifact jar : artifacts ) {
- jars.addConstituent(jar.getFile().toURL());
- }
-
- //make the child realm the ContextClassLoader
- Thread.currentThread().setContextClassLoader(jars.getClassLoader());
-
- //resolve framework script path
- Class clazz = Thread.currentThread().getContextClassLoader().loadClass(script);
- Object obj = clazz.newInstance();
- Method method = clazz.getMethod("getPath", new Class [0]);
- String path = (String) method.invoke(obj, new Object[0]);
-
- // restore old ContextClassLoader
- Thread.currentThread().setContextClassLoader(oldClassLoader);
-
- getLog().info("merge file: " + path + " in to " + assemblyScriptFile.getAbsolutePath());
- PluginUtils.mergeFiles(assemblyScriptFile, jarFileObjects, path);
- }
- } 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;
+ }
}
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-19 15:51:55 UTC (rev 12339)
+++ trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/utils/PluginUtils.java 2009-01-19 18:20:28 UTC (rev 12340)
@@ -3,8 +3,9 @@
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.commons.digester.Digester;
import org.apache.commons.vfs.FileObject;
@@ -21,30 +22,21 @@
- public static void mergeFiles(File dest, List <FileObject> jarFileObjects, String scriptPath) throws Exception{
-
- for(FileObject sourceFileObjects : jarFileObjects){
-
- FileOutputStream out = new FileOutputStream(dest, true);
+ public static void mergeFiles(File dest, URL resource) throws Exception{
+ FileOutputStream out = new FileOutputStream(dest, true);
+ try {
+ InputStream in = resource.openStream();
try {
- FileObject scriptFileObject = sourceFileObjects.resolveFile(scriptPath);
- if(scriptFileObject.exists()) {
- InputStream in = scriptFileObject.getContent().getInputStream();
- try {
- IOUtil.copy(in, out);
- if (true) {
- out.write('\n');
- }
- } finally {
- IOUtil.close(in);
- in = null;
- }
- }
+ IOUtil.copy(in, out);
+ out.write('\n');
} finally {
- IOUtil.close(out);
- out = null;
+ IOUtil.close(in);
+ in = null;
}
- }
+ } finally {
+ IOUtil.close(out);
+ out = null;
+ }
}
public static FileObject [] resolveConfigsFromJar(FileObject jarFileObject, String [] patterns) throws Exception {
@@ -58,15 +50,15 @@
return result;
}
- public static List <Components> processConfigs(FileObject [] configs, Digester digester) throws Exception{
+ public static Map <String,Components> processConfigs(FileObject [] configs, Digester digester) throws Exception{
- List collector = new ArrayList<Components>();
+ Map <String, Components>collector = new HashMap <String, Components>();
for (FileObject config: configs) {
InputStream configInputStream = null;
try {
configInputStream = config.getContent().getInputStream();
- collector.add(digester.parse(configInputStream));
-
+ Components components = (Components)digester.parse(configInputStream);
+ collector.put(components.getNamespace(), components);
} finally {
if(configInputStream != null) {
configInputStream.close();
17 years, 3 months
JBoss Rich Faces SVN: r12339 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2009-01-19 10:51:55 -0500 (Mon, 19 Jan 2009)
New Revision: 12339
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tabPanel/tabPanelAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TabPanelTest.java
Log:
RF-5567
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tabPanel/tabPanelAutoTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2009-01-19 15:40:20 UTC (rev 12338)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2009-01-19 15:51:55 UTC (rev 12339)
@@ -1279,7 +1279,7 @@
for (SeleniumEvent ev : eventsExpected) {
if (ev == SeleniumEvent.ONCLICK) {
- clickById(id);
+ selenium.click(id);
}else if (ev == SeleniumEvent.ONDBLCLICK) {
selenium.doubleClick(id);
} else if (ev == SeleniumEvent.ONMOUSEDOWN) {
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-19 15:40:20 UTC (rev 12338)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TabPanelTest.java 2009-01-19 15:51:55 UTC (rev 12339)
@@ -26,6 +26,7 @@
import org.ajax4jsf.autotest.bean.AutoTestBean;
import org.ajax4jsf.template.Template;
import org.richfaces.AutoTester;
+import org.richfaces.SeleniumEvent;
import org.richfaces.SeleniumTestBase;
import org.testng.Assert;
import org.testng.annotations.Test;
@@ -67,7 +68,13 @@
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");
+ }
+
@Test
public void testRichTabPanelComponent(Template template) {
renderPage(template, RESET_METHOD);
@@ -378,6 +385,41 @@
}
+
+ @Test
+ public void testStylesAndClassesStandardAttributes(Template template) {
+ AutoTester autoTester = getAutoTester(this);
+ autoTester.renderPage(template, RESET_METHOD);
+
+ String panelId = autoTester.getClientId(AutoTester.COMPONENT_ID);
+ String tab1Id = autoTester.getClientId("tab1");
+ String tab2Id = autoTester.getClientId("tab2");
+
+ autoTester.testStyleAndClasses(new String [] {"rich-tabpanel", "styleClass"}, TAB_PANEL_STYLES);
+ String title = selenium.getAttribute("//*[@id='" + panelId + "']/@title");
+ if (!"panelTitle".equals(title)) {
+ Assert.fail("Title attribute for tabPanel was not output to client");
+ }
+
+ autoTester.testHTMLEvents();
+
+ assertClassNames("//*[@id='" + panelId + "']/tbody/tr/td", new String [] { "dr-bottom-line", "rich-tab-bottom-line", "headerClass"}, "Header css classes are incoorect or headerClass attribute was not output to client", false);
+
+ assertClassNames("//*[@id='" + tab1Id + "_lbl']", new String [] {"dr-tbpnl-tb", "rich-tab-header", "dr-tbpnl-tb-act", "rich-tab-active", "tabClass", "activeTabClass"}, "Active Tab has incorrect css classes.", false);
+ assertClassNames("//*[@id='" + tab2Id + "_lbl']", new String [] {"dr-tbpnl-tb", "rich-tab-header", "dr-tbpnl-tb-inact", "rich-tab-inactive", "tabClass", "inactiveTabClass"}, "Inactive Tab has incorrect css classes.", false);
+
+ clickAjaxCommandAndWait(tab2Id + "_lbl");
+
+ String tab2ContentPath = "//*[@id='" + tab2Id + "']/table/tbody/tr/td";
+ assertStyleAttributeContains(tab2ContentPath, "font-weight: bold", "Style attribute was not output for tab");
+ assertClassNames(tab2ContentPath, new String [] {"dr-tbpnl-cntnt", "rich-tabpanel-content", "contentClass", "styleClass"}, "Tab css classes are incorrect", false);
+ assertEvents(tab2ContentPath, SeleniumEvent.STANDARD_HTML_EVENTS);
+
+ title = selenium.getAttribute(tab2ContentPath + "/@title");
+ if (!"title".equals(title)) {
+ Assert.fail("Title attribute for tab was not output to client");
+ }
+ }
private void testListener(String parentId) {
17 years, 3 months
JBoss Rich Faces SVN: r12338 - in trunk/docs: faq and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2009-01-19 10:40:20 -0500 (Mon, 19 Jan 2009)
New Revision: 12338
Added:
trunk/docs/common-resources/en/src/main/xslt/xhtml-single-faq.xsl
Modified:
trunk/docs/common-resources/en/src/main/xslt/xhtml-common.xsl
trunk/docs/faq/pom.xml
Log:
https://jira.jboss.org/jira/browse/RF-5437 - necessary xsl file was added
Modified: trunk/docs/common-resources/en/src/main/xslt/xhtml-common.xsl
===================================================================
--- trunk/docs/common-resources/en/src/main/xslt/xhtml-common.xsl 2009-01-19 15:38:50 UTC (rev 12337)
+++ trunk/docs/common-resources/en/src/main/xslt/xhtml-common.xsl 2009-01-19 15:40:20 UTC (rev 12338)
@@ -9,8 +9,10 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="date">
<xsl:import href="collapsing-navigation.xsl"/>
- <xsl:param name="generate.toc" select="'book toc'"/>
- <xsl:param name="toc.section.depth" select="5"/>
+ <!--xsl:param name="generate.toc" select="'book toc'"/-->
+ <xsl:param name="toc.section.depth" select="5"/>
+
+
<!--
From: xhtml/docbook.xsl
Reason: Remove inline style for draft mode
Added: trunk/docs/common-resources/en/src/main/xslt/xhtml-single-faq.xsl
===================================================================
--- trunk/docs/common-resources/en/src/main/xslt/xhtml-single-faq.xsl (rev 0)
+++ trunk/docs/common-resources/en/src/main/xslt/xhtml-single-faq.xsl 2009-01-19 15:40:20 UTC (rev 12338)
@@ -0,0 +1,13 @@
+<?xml version='1.0'?>
+
+<!--
+ Copyright 2008 JBoss, a division of Red Hat
+ License: LGPL
+ Author: Mark Newton <mark.newton(a)jboss.org>
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:import href="xhtml-single.xsl"/>
+<xsl:param name="generate.toc" select="'book toc'"/>
+
+</xsl:stylesheet>
Property changes on: trunk/docs/common-resources/en/src/main/xslt/xhtml-single-faq.xsl
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/docs/faq/pom.xml
===================================================================
--- trunk/docs/faq/pom.xml 2009-01-19 15:38:50 UTC (rev 12337)
+++ trunk/docs/faq/pom.xml 2009-01-19 15:40:20 UTC (rev 12338)
@@ -28,7 +28,44 @@
</pluginRepositories>
<build>
<pluginManagement>
- <plugins>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-spellChecker-plugin</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>spellChecker:check</id>
+ <phase>package</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>spellChecker:validate</id>
+ <phase>package</phase>
+ <goals>
+ <goal>validate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <outputDir>${project.build.directory}/log</outputDir>
+ <reportFileName>log.txt</reportFileName>
+ <dirForScan>${basedir}</dirForScan>
+ <fileForValidation>${basedir}/en/src/main/docbook/master.xml</fileForValidation>
+ <wellformdnessOnly>false</wellformdnessOnly>
+ <xmlSchema>http://www.docbook.org/xsd/4.3/docbook.xsd</xmlSchema>
+ <!--dictionaryFile>/media/WIndows_C/workspace_test/english.dic</dictionaryFile-->
+ <excludes>
+ <exclude>**/*.svn</exclude>
+ </excludes>
+ <includes>
+ <include>**/*.xml</include>
+ <include>**/*.html</include>
+ </includes>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
@@ -162,7 +199,7 @@
<format>
<formatName>html_single</formatName>
<stylesheetResource>
- ${xsl_html_single}
+ classpath:/common-resources/xslt/xhtml-single-faq.xsl
</stylesheetResource>
<imageCopyingRequired>
true
@@ -222,4 +259,4 @@
<module>en</module>
</modules>
-</project>
\ No newline at end of file
+</project>
17 years, 3 months
JBoss Rich Faces SVN: r12337 - trunk/framework/impl/src/main/java/org/ajax4jsf/util.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-01-19 10:38:50 -0500 (Mon, 19 Jan 2009)
New Revision: 12337
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/util/ELUtils.java
Log:
https://jira.jboss.org/jira/browse/RF-5772
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/util/ELUtils.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/util/ELUtils.java 2009-01-19 15:04:31 UTC (rev 12336)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/util/ELUtils.java 2009-01-19 15:38:50 UTC (rev 12337)
@@ -30,6 +30,8 @@
import java.lang.reflect.Type;
import java.util.Collection;
import java.util.HashMap;
+import java.util.Map;
+import java.util.ResourceBundle;
import javax.el.ELContext;
import javax.el.ValueExpression;
@@ -113,33 +115,42 @@
private static Class<?> getGenericCollectionType(FacesContext context, Object base, String propertyName) {
Class<?> genericPropertyClass = null;
- GenericsIntrospectionCache introspectionCache = GenericsIntrospectionCache.getInstance(context);
if (base != null && propertyName != null) {
Class<? extends Object> beanClass = base.getClass();
-
- synchronized (introspectionCache) {
- GenericsCacheEntry cacheEntry = introspectionCache.getGenericCacheEntry(beanClass);
+
+ //Map and ResourceBundle have special resolvers that we doesn't support
+ if (!Map.class.isAssignableFrom(beanClass) && !ResourceBundle.class.isAssignableFrom(beanClass)) {
- if (cacheEntry.genericPropertiesClasses == null) {
- cacheEntry.genericPropertiesClasses = new HashMap<String, Class<?>>();
- } else {
- genericPropertyClass = cacheEntry.genericPropertiesClasses.get(propertyName);
- }
-
- if (genericPropertyClass == null) {
- BeanInfo beanInfo = getBeanInfo(beanClass, cacheEntry);
+ GenericsIntrospectionCache introspectionCache = GenericsIntrospectionCache.getInstance(context);
- PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
- for (PropertyDescriptor pd : descriptors) {
- if (propertyName.equals(pd.getName())) {
- Method readMethod = pd.getReadMethod();
-
- genericPropertyClass = resolveType(readMethod.getGenericReturnType());
- break;
+ synchronized (introspectionCache) {
+ GenericsCacheEntry cacheEntry = introspectionCache.getGenericCacheEntry(beanClass);
+
+ if (cacheEntry.genericPropertiesClasses == null) {
+ cacheEntry.genericPropertiesClasses = new HashMap<String, Class<?>>();
+ } else {
+ genericPropertyClass = cacheEntry.genericPropertiesClasses.get(propertyName);
+ }
+
+ if (genericPropertyClass == null) {
+ if (!cacheEntry.genericPropertiesClasses.containsKey(propertyName)) {
+ BeanInfo beanInfo = getBeanInfo(beanClass, cacheEntry);
+
+ PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors();
+ for (PropertyDescriptor pd : descriptors) {
+ if (propertyName.equals(pd.getName())) {
+ Method readMethod = pd.getReadMethod();
+
+ genericPropertyClass = resolveType(readMethod.getGenericReturnType());
+ break;
+ }
+ }
+
+ cacheEntry.genericPropertiesClasses.put(propertyName, genericPropertyClass);
+ } else {
+ //property Class has been already resolved as null
}
}
-
- cacheEntry.genericPropertiesClasses.put(propertyName, genericPropertyClass);
}
}
}
17 years, 3 months
JBoss Rich Faces SVN: r12336 - trunk/framework/api/src/main/java/org/richfaces/model.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-01-19 10:04:31 -0500 (Mon, 19 Jan 2009)
New Revision: 12336
Modified:
trunk/framework/api/src/main/java/org/richfaces/model/CacheableTreeDataModel.java
trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java
Log:
https://jira.jboss.org/jira/browse/RF-5771
Modified: trunk/framework/api/src/main/java/org/richfaces/model/CacheableTreeDataModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/CacheableTreeDataModel.java 2009-01-19 15:01:08 UTC (rev 12335)
+++ trunk/framework/api/src/main/java/org/richfaces/model/CacheableTreeDataModel.java 2009-01-19 15:04:31 UTC (rev 12336)
@@ -223,4 +223,4 @@
return node;
}
-}
+}
\ No newline at end of file
Modified: trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java 2009-01-19 15:01:08 UTC (rev 12335)
+++ trunk/framework/api/src/main/java/org/richfaces/model/StackingTreeModel.java 2009-01-19 15:04:31 UTC (rev 12336)
@@ -292,13 +292,12 @@
if (treeRange == null || treeRange.processNode(argumentKey)) {
if (argumentKey != null) {
- getRoot().setRowKey(argumentKey);
processElement(context, dataVisitor, argument, argumentKey, last);
- getRoot().setRowKey(argumentKey);
- } else {
- getRoot().setRowKey(argumentKey);
}
+ //setup key in order for nested components to initialize data models
+ getRoot().setRowKey(context, argumentKey);
+
final ShiftingDataVisitor shiftingDataVisitor = new ShiftingDataVisitor(
new Visitor1(dataVisitor));
@@ -483,9 +482,13 @@
}
public void setRowKey(Object key) {
- setupKey(key, FacesContext.getCurrentInstance());
+ setRowKey(FacesContext.getCurrentInstance(), key);
}
+ public void setRowKey(FacesContext context, Object key) {
+ setupKey(key, context);
+ }
+
public void addStackingModel(StackingTreeModel model) {
this.models.put(model.id, model);
model.setParent(this);
@@ -712,7 +715,7 @@
UIComponent component, Converter converter) {
//force model leave
- setRowKey(null);
+ setRowKey(context, null);
String[] strings = ListRowKey.fromString(keyString);
int l = strings.length / 2;
17 years, 3 months
JBoss Rich Faces SVN: r12335 - trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2009-01-19 10:01:08 -0500 (Mon, 19 Jan 2009)
New Revision: 12335
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxPollTest.java
Log:
testAjaxSingleWithInternalValidationFailed reverted
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxPollTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxPollTest.java 2009-01-19 13:06:56 UTC (rev 12334)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxPollTest.java 2009-01-19 15:01:08 UTC (rev 12335)
@@ -26,7 +26,6 @@
import org.ajax4jsf.template.Template;
import org.richfaces.AutoTester;
import org.richfaces.SeleniumTestBase;
-import org.richfaces.AutoTester.TestSetupEntry;
import org.testng.Assert;
import org.testng.annotations.Test;
@@ -130,14 +129,8 @@
public void testAjaxSingleWithInternalValidationFailed(Template template) {
AutoTester tester = getAutoTester(this);
tester.renderPage(template, null);
- tester.reset();
- tester.setupControl(TestSetupEntry.ajaxSingle, Boolean.TRUE);
- tester.clickLoad();
writeStatus("Test ajaxSingle attribute in case of invalid children state");
- setInternalValidationFailed();
- sendAjax();
- tester.checkActionListener(false);
- tester.checkUpdateModel(false);
+ tester.testAjaxSingleWithInternalValidationFailed();
}
@Override
17 years, 3 months
JBoss Rich Faces SVN: r12334 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2009-01-19 08:06:56 -0500 (Mon, 19 Jan 2009)
New Revision: 12334
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tabPanel/tabPanelAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TabPanelTest.java
Log:
https://jira.jboss.org/jira/browse/RF-5560
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/tabPanel/tabPanelAutoTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java 2009-01-19 12:03:29 UTC (rev 12333)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java 2009-01-19 13:06:56 UTC (rev 12334)
@@ -427,12 +427,12 @@
private void changeValue() {
base.changeValue();
}
-
- private void setInternalValidation(boolean passed) {
+
+ public void setInternalValidation(boolean passed) {
setupControl(TestSetupEntry.validatorId, (passed) ? AutoTestBean.VALIDATOR_DEFAULT_ID : AutoTestBean.VALIDATOR_ID);
}
-
- private String getValidatorMessage() {
+
+ public String getValidatorMessage() {
String id = base.getParentId() + AUTOTEST_FORM_ID + MESSAGE_FOR_ID;
if (base.isPresent(id)) {
return base.getTextById(base.getParentId() + AUTOTEST_FORM_ID + MESSAGE_FOR_ID);
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-19 12:03:29 UTC (rev 12333)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/TabPanelTest.java 2009-01-19 13:06:56 UTC (rev 12334)
@@ -23,6 +23,7 @@
import java.util.HashMap;
import java.util.Map;
+import org.ajax4jsf.autotest.bean.AutoTestBean;
import org.ajax4jsf.template.Template;
import org.richfaces.AutoTester;
import org.richfaces.SeleniumTestBase;
@@ -135,6 +136,29 @@
}
@Test
+ public void testValidatorAndValidatorMessageAttributes(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, INIT_AJAX_CORE_TEST);
+ writeStatus("Check validator and validatorMessage attributes");
+
+ Assert.fail("https://jira.jboss.org/jira/browse/RF-5779");
+
+ tester.setInternalValidation(false);
+ tester.clickLoad();
+
+ clickAjaxCommandAndWait(getAutoTester(this).getClientId("") + "tab2_lbl");
+
+ String validatorMessage = tester.getValidatorMessage();
+ if ("".equals(validatorMessage)) {
+ Assert.fail("Validator attribute does not work. Validation passed, should be failed.");
+ }else if (!AutoTestBean.VALIDATOR_MESSAGE.equals(validatorMessage)) {
+ Assert.fail("ValidatorMessage attribute does not work. ValidationMessage expected: [" + AutoTestBean.VALIDATOR_MESSAGE+"].But was [" + validatorMessage + "]");
+ }
+
+ tester.checkValueChangeListener(false);
+ }
+
+ @Test
public void testSubmissionModesAndListeners(Template template) {
renderPage(template, RESET_METHOD);
17 years, 3 months
JBoss Rich Faces SVN: r12333 - in trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd: handler and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2009-01-19 07:03:29 -0500 (Mon, 19 Jan 2009)
New Revision: 12333
Added:
trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/utils/
trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/utils/PluginUtils.java
Modified:
trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/Component.java
trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/Components.java
trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/handler/ComponentsHandler.java
trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo/CreateScriptMojo.java
Log:
mova some methods to utils
Modified: trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/Component.java
===================================================================
--- trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/Component.java 2009-01-19 11:22:30 UTC (rev 12332)
+++ trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/Component.java 2009-01-19 12:03:29 UTC (rev 12333)
@@ -3,6 +3,10 @@
import java.util.ArrayList;
import java.util.List;
+/**
+ * @author Anton Belevich
+ *
+ */
public class Component {
private String componentName;
Modified: trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/Components.java
===================================================================
--- trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/Components.java 2009-01-19 11:22:30 UTC (rev 12332)
+++ trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/Components.java 2009-01-19 12:03:29 UTC (rev 12333)
@@ -3,6 +3,10 @@
import java.util.ArrayList;
import java.util.List;
+/**
+ * @author Anton Belevich
+ *
+ */
public class Components {
private String namespace;
Modified: trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/handler/ComponentsHandler.java
===================================================================
--- trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/handler/ComponentsHandler.java 2009-01-19 11:22:30 UTC (rev 12332)
+++ trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/handler/ComponentsHandler.java 2009-01-19 12:03:29 UTC (rev 12333)
@@ -1,11 +1,8 @@
package org.richfaces.cdk.rd.handler;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
-import org.apache.maven.plugin.logging.Log;
import org.richfaces.cdk.rd.Component;
import org.richfaces.cdk.rd.Components;
import org.xml.sax.SAXException;
@@ -17,8 +14,6 @@
*/
public class ComponentsHandler extends DefaultHandler{
- private Log log;
-
private List <Components> components;
private String tempString;
@@ -52,9 +47,6 @@
private void collectStyles(Component component) {
for(String style : component.getStyles()) {
if(!this.styles.contains(style)) {
- if (getLog() != null) {
- getLog().info("collect styles from: " + component.getComponentName() + " component");
- }
this.styles.add(style);
}
}
@@ -63,9 +55,6 @@
private void collectScripts(Component component) {
for(String script : component.getScripts()) {
if(!this.scripts.contains(script)) {
- if (getLog() != null) {
- getLog().info("collect script from: " + component.getComponentName() + " component");
- }
this.scripts.add(script);
}
}
@@ -86,13 +75,4 @@
public void setComponents(List<Components> components) {
this.components = components;
}
-
- public Log getLog() {
- return log;
- }
-
- public void setLog(Log log) {
- this.log = log;
- }
-
}
Modified: 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-19 11:22:30 UTC (rev 12332)
+++ trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/mojo/CreateScriptMojo.java 2009-01-19 12:03:29 UTC (rev 12333)
@@ -60,7 +60,10 @@
import org.richfaces.cdk.rd.Components;
import org.richfaces.cdk.rd.JarResourceScanner;
import org.richfaces.cdk.rd.handler.ComponentsHandler;
+import org.richfaces.cdk.rd.utils.PluginUtils;
+import com.sun.swing.internal.plaf.metal.resources.metal;
+
/**
* @author Anton Belevich
*
@@ -143,6 +146,7 @@
private ArtifactMetadataSource metadataSource;
+
public void execute() throws MojoExecutionException {
try {
@@ -150,19 +154,19 @@
Artifact richfacesImpl = createDependencyArtifact("richfaces-impl", project.getVersion(), "jar");
List <FileObject> richfaces = new ArrayList<FileObject>();
-
FileObject jarRichfacesUI = resolveArtifact(richfacesUI);
richfaces.add(jarRichfacesUI);
FileObject jarRichfacesImpl = resolveArtifact(richfacesImpl);
richfaces.add(jarRichfacesImpl);
- FileObject [] configs = resolveConfigsFromJar(jarRichfacesUI);
- List <Components> components = processConfigs(configs, new ArrayList <Components>());
- ComponentsHandler handler = findComponents(webSourceDirectory, components);
-
+ FileObject [] configs = PluginUtils.resolveConfigsFromJar(jarRichfacesUI, PluginUtils.DEFAULT_CONFIG_PATTERNS);
+ Digester defaultDigester = getDigester();
+ List <Components> components = PluginUtils.processConfigs(configs, defaultDigester);
+
+ ComponentsHandler handler = findComponents(webSourceDirectory, components, PluginUtils.DEFAULT_PROCESS_INCLUDES, new String[0]);
List result = handler.getScripts();
- mergeScripts(result, richfaces, outputScriptDirectory);
+ mergeScripts(result, richfaces, outputScriptDirectory);
for (Iterator iterator = result.iterator(); iterator.hasNext();) {
getLog().info("collect: " + iterator.next());
}
@@ -173,49 +177,21 @@
}
- public List <Components> processConfigs(FileObject [] configs, List collector) {
-
- for (FileObject config: configs) {
-
- Digester digester = new Digester();
- digester.addObjectCreate("components", Components.class);
- digester.addCallMethod("components/namespace", "setNamespace", 0);
- 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.addSetNext("components/component", "addComponent");
- InputStream configInputStream = null;
+ public Digester getDigester() {
+ return PluginUtils.createDefaultDigester();
+ }
- try {
- configInputStream = config.getContent().getInputStream();
- collector.add(digester.parse(configInputStream));
+ public ComponentsHandler findComponents (File webSourceDir, List <Components> components, String [] includes, String [] excludes) {
- } catch (Exception e) {
- getLog().error(e);
- } finally {
- try {
- configInputStream.close();
- } catch (IOException e) {
- getLog().error(e);
- }
- }
-
- }
- return collector;
- }
-
- public ComponentsHandler findComponents (File webSourceDir, List <Components> components) {
-
DirectoryScanner scanner = new DirectoryScanner();
scanner.setBasedir(webSourceDir);
- scanner.setIncludes(new String []{"**/*.xhtml"});
+ scanner.setIncludes(includes);
+ scanner.setExcludes(excludes);
scanner.addDefaultExcludes();
scanner.scan();
String [] collectedFiles = scanner.getIncludedFiles();
ComponentsHandler handler = new ComponentsHandler();
- handler.setLog(getLog());
handler.setComponents(components);
try {
@@ -301,63 +277,28 @@
return jarFileObject;
}
- public FileObject [] resolveConfigsFromJar(FileObject jarFileObject) {
- FileObject [] result = new FileObject[0];
-
- try {
- JarResourceScanner jarScanner = new JarResourceScanner();
- jarScanner.setBaseFile(jarFileObject);
- jarScanner.setPatterns(new String[]{ "**/*.component-dependencies.xml"});
- jarScanner.doScan();
- result = (FileObject [])jarScanner.getResult().toArray(new FileObject[jarScanner.getResult().size()]);
-
- } catch (IOException e) {
- getLog().error(e);
- }
- return result;
- }
- public void mergeFiles(File dest, List <FileObject> jarFileObjects, String scriptPath) throws Exception{
-
- for(FileObject sourceFileObjects : jarFileObjects){
-
- FileOutputStream out = new FileOutputStream(dest, true);
- try {
- FileObject scriptFileObject = sourceFileObjects.resolveFile(scriptPath);
- if(scriptFileObject.exists()) {
- InputStream in = scriptFileObject.getContent().getInputStream();
- try {
- IOUtil.copy(in, out);
- if (true) {
- out.write('\n');
- }
- } finally {
- IOUtil.close(in);
- in = null;
- }
- }
- } finally {
- IOUtil.close(out);
- out = null;
- }
- }
- }
-
protected void mergeScripts(List <String> scripts, List <FileObject> jarFileObjects, File outputScriptDirectory) {
File assemblyScriptFile = new File(outputScriptDirectory, scriptPackName + ".js");
- if(!assemblyScriptFile.exists()) {
- try {
- assemblyScriptFile.createNewFile();
- } catch (IOException e) {
- getLog().error("Error create file: " + assemblyScriptFile.getAbsolutePath(), e);
+
+ 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(), e);
}
+
for(String script: scripts) {
try {
if(script.endsWith(".js")) {
- mergeFiles(assemblyScriptFile, jarFileObjects, script);
+ getLog().info("merge file: " + script + " in to " + assemblyScriptFile.getAbsolutePath());
+ PluginUtils.mergeFiles(assemblyScriptFile, jarFileObjects, script);
} else {
Set <Artifact> artifacts = createProjectDependenciesArtifacts();
@@ -388,8 +329,9 @@
// restore old ContextClassLoader
Thread.currentThread().setContextClassLoader(oldClassLoader);
-
- mergeFiles(assemblyScriptFile, jarFileObjects, path);
+
+ getLog().info("merge file: " + path + " in to " + assemblyScriptFile.getAbsolutePath());
+ PluginUtils.mergeFiles(assemblyScriptFile, jarFileObjects, path);
}
} catch (Exception e) {
getLog().error(e);
Added: 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 (rev 0)
+++ trunk/sandbox/cdk/maven-resource-dependency-plugin/src/main/java/org/richfaces/cdk/rd/utils/PluginUtils.java 2009-01-19 12:03:29 UTC (rev 12333)
@@ -0,0 +1,92 @@
+package org.richfaces.cdk.rd.utils;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+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;
+
+public class PluginUtils {
+
+ public static String [] DEFAULT_CONFIG_PATTERNS = new String [] {"**/*.component-dependencies.xml"};
+
+ public static String [] DEFAULT_PROCESS_INCLUDES = new String [] {"**/*.xhtml"};
+
+
+
+ public static void mergeFiles(File dest, List <FileObject> jarFileObjects, String scriptPath) throws Exception{
+
+ for(FileObject sourceFileObjects : jarFileObjects){
+
+ FileOutputStream out = new FileOutputStream(dest, true);
+ try {
+ FileObject scriptFileObject = sourceFileObjects.resolveFile(scriptPath);
+ if(scriptFileObject.exists()) {
+ InputStream in = scriptFileObject.getContent().getInputStream();
+ try {
+ IOUtil.copy(in, out);
+ if (true) {
+ 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();
+ jarScanner.setBaseFile(jarFileObject);
+ jarScanner.setPatterns(patterns);
+ jarScanner.doScan();
+ result = (FileObject [])jarScanner.getResult().toArray(new FileObject[jarScanner.getResult().size()]);
+
+ return result;
+ }
+
+ public static List <Components> processConfigs(FileObject [] configs, Digester digester) throws Exception{
+
+ List collector = new ArrayList<Components>();
+ for (FileObject config: configs) {
+ InputStream configInputStream = null;
+ try {
+ configInputStream = config.getContent().getInputStream();
+ collector.add(digester.parse(configInputStream));
+
+ } finally {
+ if(configInputStream != null) {
+ configInputStream.close();
+ }
+ }
+ }
+
+ return collector;
+ }
+
+ public static Digester createDefaultDigester() {
+ Digester digester = new Digester();
+ digester.addObjectCreate("components", Components.class);
+ digester.addCallMethod("components/namespace", "setNamespace", 0);
+ 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.addSetNext("components/component", "addComponent");
+ return digester;
+ }
+}
+
17 years, 3 months
JBoss Rich Faces SVN: r12332 - trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2009-01-19 06:22:30 -0500 (Mon, 19 Jan 2009)
New Revision: 12332
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java
Log:
Fix ajaxSingleWithInternlValidationFailure test
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java 2009-01-19 11:05:41 UTC (rev 12331)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/AutoTester.java 2009-01-19 11:22:30 UTC (rev 12332)
@@ -177,6 +177,7 @@
clickLoad();
// setInternalValidation(true);
+ base.setInternalValidationFailed();
base.sendAjax();
checkActionListener(false);
17 years, 3 months