Author: nbelaevski
Date: 2010-01-19 14:32:12 -0500 (Tue, 19 Jan 2010)
New Revision: 16334
Added:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/XhtmlAttributesParsingTest.java
Modified:
root/cdk/trunk/plugins/annotations/pom.xml
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Attribute.java
root/cdk/trunk/plugins/generator/pom.xml
root/cdk/trunk/plugins/generator/src/main/script/SchemaAttributesParserTask.groovy
root/examples-sandbox/trunk/backwardCompatibility/pom.xml
root/examples-sandbox/trunk/components/ajax/pom.xml
root/examples-sandbox/trunk/pom.xml
root/examples/trunk/components/repeater-demo/pom.xml
root/examples/trunk/pom.xml
root/framework/trunk/commons/
root/framework/trunk/legacy-tests/pom.xml
root/framework/trunk/version-matrix/pom.xml
root/ui/trunk/version-matrix/pom.xml
Log:
JSF version updated to 2.0.3-SNAPSHOT
XhtmlAttributesParsingTest added with required changes in pom.xml file
Modified: root/cdk/trunk/plugins/annotations/pom.xml
===================================================================
--- root/cdk/trunk/plugins/annotations/pom.xml 2010-01-19 13:41:53 UTC (rev 16333)
+++ root/cdk/trunk/plugins/annotations/pom.xml 2010-01-19 19:32:12 UTC (rev 16334)
@@ -28,7 +28,7 @@
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.0.3-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
Modified:
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Attribute.java
===================================================================
---
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Attribute.java 2010-01-19
13:41:53 UTC (rev 16333)
+++
root/cdk/trunk/plugins/attributes/src/main/java/org/richfaces/cdk/attributes/Attribute.java 2010-01-19
19:32:12 UTC (rev 16334)
@@ -172,4 +172,12 @@
}
return true;
}
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return super.toString() + " " + getName();
+ }
}
Modified: root/cdk/trunk/plugins/generator/pom.xml
===================================================================
--- root/cdk/trunk/plugins/generator/pom.xml 2010-01-19 13:41:53 UTC (rev 16333)
+++ root/cdk/trunk/plugins/generator/pom.xml 2010-01-19 19:32:12 UTC (rev 16334)
@@ -36,7 +36,7 @@
<version>1.0</version>
<executions>
<execution>
- <phase>process-resources</phase>
+ <phase>generate-resources</phase>
<goals>
<goal>execute</goal>
</goals>
@@ -44,7 +44,7 @@
<properties>
<sourceSchema>src/main/resources/META-INF/schema/xhtml-el.xsd</sourceSchema>
<
targetNamespace>http://richfaces.org/cdk/xhtml-el</targetNamespace>
-
<outputFile>META-INF/cdk/attributes/xhtml-el.xml</outputFile>
+
<outputFile>generated-resources/META-INF/cdk/attributes/xhtml-el.xml</outputFile>
</properties>
<classpath>
<element>
@@ -92,6 +92,18 @@
</configuration> </plugin
-->
</plugins>
+ <resources>
+ <resource>
+ <directory>
+ src/main/resources
+ </directory>
+ </resource>
+ <resource>
+ <directory>
+ ${project.build.directory}/generated-resources
+ </directory>
+ </resource>
+ </resources>
</build>
<dependencies>
<dependency>
@@ -140,7 +152,7 @@
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.0.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
Modified:
root/cdk/trunk/plugins/generator/src/main/script/SchemaAttributesParserTask.groovy
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/script/SchemaAttributesParserTask.groovy 2010-01-19
13:41:53 UTC (rev 16333)
+++
root/cdk/trunk/plugins/generator/src/main/script/SchemaAttributesParserTask.groovy 2010-01-19
19:32:12 UTC (rev 16334)
@@ -37,7 +37,7 @@
String sourceSchemaFileName = project.basedir.getAbsolutePath() + '/' +
sourceSchemaParam;
def outputFileParam = project.properties['outputFile'];
- String outputFileName = project.build.outputDirectory + '/' + outputFileParam;
+ String outputFileName = project.build.directory + '/' + outputFileParam;
log.info("Parsing: " + sourceSchemaFileName);
log.info("Writing attributes XML data to: " + outputFileName);
Added:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/XhtmlAttributesParsingTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/XhtmlAttributesParsingTest.java
(rev 0)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/XhtmlAttributesParsingTest.java 2010-01-19
19:32:12 UTC (rev 16334)
@@ -0,0 +1,188 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.richfaces.cdk.templatecompiler;
+
+import static org.junit.Assert.assertTrue;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.TreeSet;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Unmarshaller;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.richfaces.cdk.attributes.Attribute;
+import org.richfaces.cdk.attributes.Element;
+import org.richfaces.cdk.attributes.Schema;
+import org.richfaces.cdk.attributes.SchemaSet;
+import org.richfaces.cdk.attributes.Attribute.Kind;
+
+import com.google.common.base.Predicate;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class XhtmlAttributesParsingTest {
+
+ private Schema xhtmlSchema;
+
+ private void verifyAttributesByPredicate(Collection<Attribute> attributes,
Predicate<Attribute> predicate) {
+ for (Attribute attribute : attributes) {
+ Assert.assertTrue(attribute.getName(), predicate.apply(attribute));
+ }
+ }
+
+ private Collection<Attribute>
findAttributesByPredicate(Predicate<Attribute> predicate) {
+ List<Attribute> result = new ArrayList<Attribute>();
+
+ Collection<Element> elements = xhtmlSchema.getElements().values();
+ for (Element element : elements) {
+ Collection<Attribute> attributes = element.getAttributes().values();
+ for (Attribute attribute : attributes) {
+ if (predicate.apply(attribute)) {
+ result.add(attribute);
+ }
+ }
+ }
+
+ verifyAttributesByPredicate(result, predicate);
+
+ return result;
+ }
+
+ private Collection<String> getNamesCollection(Collection<Attribute>
attributes) {
+ Collection<String> result = new TreeSet<String>();
+ for (Attribute attribute : attributes) {
+ result.add(attribute.getName());
+ }
+
+ return result;
+ }
+
+ private static final class AttributeNullDataPredicate implements
Predicate<Attribute> {
+
+ @Override
+ public boolean apply(Attribute attribute) {
+ return attribute.getName() == null || attribute.getKind() == null;
+ }
+ }
+
+ private static final class AttributeNamePredicate implements
Predicate<Attribute> {
+
+ public AttributeNamePredicate(String name) {
+ super();
+ this.name = name;
+ }
+
+ private String name;
+
+ @Override
+ public boolean apply(Attribute attribute) {
+ return name.equals(attribute.getName());
+ }
+ }
+
+ private static final class AttributeKindPredicate implements
Predicate<Attribute> {
+
+ private Kind kind;
+
+ public AttributeKindPredicate(Kind kind) {
+ super();
+ this.kind = kind;
+ }
+
+ @Override
+ public boolean apply(Attribute attribute) {
+ return kind.equals(attribute.getKind());
+ }
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ ClassLoader contextCL = Thread.currentThread().getContextClassLoader();
+ URL parsedSchemaDataResource =
contextCL.getResource("META-INF/cdk/attributes/xhtml-el.xml");
+
+ JAXBContext jc = JAXBContext.newInstance(SchemaSet.class);
+ Unmarshaller unmarshaller = jc.createUnmarshaller();
+
+ SchemaSet schemaSet = (SchemaSet)
unmarshaller.unmarshal(parsedSchemaDataResource);
+ // TODO make constants
+ xhtmlSchema =
schemaSet.getSchemas().get("http://richfaces.org/cdk/xhtml-el");
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ xhtmlSchema = null;
+ }
+
+ @Test
+ public void testAttributeDataIsNonNull() throws Exception {
+ Collection<Attribute> foundAttributes = findAttributesByPredicate(new
AttributeNullDataPredicate());
+ assertTrue(foundAttributes.isEmpty());
+ }
+
+ @Test
+ public void testAttributeKinds() throws Exception {
+ AttributeKindPredicate booleanAttributePredicate = new
AttributeKindPredicate(Kind.BOOLEAN);
+ AttributeKindPredicate genericAttributePredicate = new
AttributeKindPredicate(Kind.GENERIC);
+ AttributeKindPredicate uriAttributePredicate = new
AttributeKindPredicate(Kind.URI);
+
+ Collection<Attribute> booleanAttributes =
findAttributesByPredicate(booleanAttributePredicate);
+ Collection<Attribute> genericAttributes =
findAttributesByPredicate(genericAttributePredicate);
+ Collection<Attribute> uriAttributes =
findAttributesByPredicate(uriAttributePredicate);
+
+ Collection<String> booleanAttributesNames =
getNamesCollection(booleanAttributes);
+ Collection<String> genericAttributesNames =
getNamesCollection(genericAttributes);
+ Collection<String> uriAttributesNames = getNamesCollection(uriAttributes);
+
+ System.out.println("XhtmlAttributesParsingTest.testAttributeKinds(), BOOLEAN
attribute names: "
+ + booleanAttributesNames);
+ System.out.println("XhtmlAttributesParsingTest.testAttributeKinds(), URI
attribute names: "
+ + uriAttributesNames);
+
+ for (String booleanAttributeName : booleanAttributesNames) {
+ Collection<Attribute> foundAttributes = findAttributesByPredicate(new
AttributeNamePredicate(
+ booleanAttributeName));
+ verifyAttributesByPredicate(foundAttributes, booleanAttributePredicate);
+ }
+
+ for (String genericAttributeName : genericAttributesNames) {
+ Collection<Attribute> foundAttributes = findAttributesByPredicate(new
AttributeNamePredicate(
+ genericAttributeName));
+ verifyAttributesByPredicate(foundAttributes, genericAttributePredicate);
+ }
+
+ for (String uriAttributeName : uriAttributesNames) {
+ Collection<Attribute> foundAttributes = findAttributesByPredicate(new
AttributeNamePredicate(
+ uriAttributeName));
+ verifyAttributesByPredicate(foundAttributes, uriAttributePredicate);
+ }
+ }
+
+}
Modified: root/examples/trunk/components/repeater-demo/pom.xml
===================================================================
--- root/examples/trunk/components/repeater-demo/pom.xml 2010-01-19 13:41:53 UTC (rev
16333)
+++ root/examples/trunk/components/repeater-demo/pom.xml 2010-01-19 19:32:12 UTC (rev
16334)
@@ -32,7 +32,7 @@
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>mojarra-jsf-impl</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.0.3-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
Modified: root/examples/trunk/pom.xml
===================================================================
--- root/examples/trunk/pom.xml 2010-01-19 13:41:53 UTC (rev 16333)
+++ root/examples/trunk/pom.xml 2010-01-19 19:32:12 UTC (rev 16334)
@@ -52,13 +52,13 @@
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.0.3-SNAPSHOT</version>
<!--scope>provided</scope-->
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.0.3-SNAPSHOT</version>
<!--scope>provided</scope-->
</dependency>
<dependency>
@@ -109,13 +109,13 @@
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.0.3-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.0.3-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Modified: root/examples-sandbox/trunk/backwardCompatibility/pom.xml
===================================================================
--- root/examples-sandbox/trunk/backwardCompatibility/pom.xml 2010-01-19 13:41:53 UTC (rev
16333)
+++ root/examples-sandbox/trunk/backwardCompatibility/pom.xml 2010-01-19 19:32:12 UTC (rev
16334)
@@ -121,13 +121,13 @@
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.0.3-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.0.3-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
Modified: root/examples-sandbox/trunk/components/ajax/pom.xml
===================================================================
--- root/examples-sandbox/trunk/components/ajax/pom.xml 2010-01-19 13:41:53 UTC (rev
16333)
+++ root/examples-sandbox/trunk/components/ajax/pom.xml 2010-01-19 19:32:12 UTC (rev
16334)
@@ -65,12 +65,12 @@
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.0.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.0.3-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
Modified: root/examples-sandbox/trunk/pom.xml
===================================================================
--- root/examples-sandbox/trunk/pom.xml 2010-01-19 13:41:53 UTC (rev 16333)
+++ root/examples-sandbox/trunk/pom.xml 2010-01-19 19:32:12 UTC (rev 16334)
@@ -52,13 +52,13 @@
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.0.3-SNAPSHOT</version>
<!--scope>provided</scope-->
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.0.3-SNAPSHOT</version>
<!--scope>provided</scope-->
</dependency>
<dependency>
Property changes on: root/framework/trunk/commons
___________________________________________________________________
Name: svn:ignore
- .classpath
.project
.settings
target
+ .classpath
.project
.settings
target
bin
.clover
Modified: root/framework/trunk/legacy-tests/pom.xml
===================================================================
--- root/framework/trunk/legacy-tests/pom.xml 2010-01-19 13:41:53 UTC (rev 16333)
+++ root/framework/trunk/legacy-tests/pom.xml 2010-01-19 19:32:12 UTC (rev 16334)
@@ -47,7 +47,7 @@
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.0.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
Modified: root/framework/trunk/version-matrix/pom.xml
===================================================================
--- root/framework/trunk/version-matrix/pom.xml 2010-01-19 13:41:53 UTC (rev 16333)
+++ root/framework/trunk/version-matrix/pom.xml 2010-01-19 19:32:12 UTC (rev 16334)
@@ -161,12 +161,12 @@
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.0.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.0.3-SNAPSHOT</version>
</dependency>
<dependency>
@@ -259,7 +259,7 @@
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymockclassextension</artifactId>
- <version>2.4</version>
+ <version>2.5.2</version>
</dependency>
</dependencies>
Modified: root/ui/trunk/version-matrix/pom.xml
===================================================================
--- root/ui/trunk/version-matrix/pom.xml 2010-01-19 13:41:53 UTC (rev 16333)
+++ root/ui/trunk/version-matrix/pom.xml 2010-01-19 19:32:12 UTC (rev 16334)
@@ -122,12 +122,12 @@
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.0.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
- <version>2.0.2-SNAPSHOT</version>
+ <version>2.0.3-SNAPSHOT</version>
</dependency>
<!-- Dependencies of JSF 2.0 -->