JBoss Rich Faces SVN: r16303 - branches/sandbox/rf-demo-ftest-iexplore/src/test/java/org/jboss/richfaces/integrationTest.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-01-15 07:12:19 -0500 (Fri, 15 Jan 2010)
New Revision: 16303
Modified:
branches/sandbox/rf-demo-ftest-iexplore/src/test/java/org/jboss/richfaces/integrationTest/RichfacesSelenium.java
Log:
- RichFacesSelenium - added no delay before first doAjax()
Modified: branches/sandbox/rf-demo-ftest-iexplore/src/test/java/org/jboss/richfaces/integrationTest/RichfacesSelenium.java
===================================================================
--- branches/sandbox/rf-demo-ftest-iexplore/src/test/java/org/jboss/richfaces/integrationTest/RichfacesSelenium.java 2010-01-15 12:07:59 UTC (rev 16302)
+++ branches/sandbox/rf-demo-ftest-iexplore/src/test/java/org/jboss/richfaces/integrationTest/RichfacesSelenium.java 2010-01-15 12:12:19 UTC (rev 16303)
@@ -43,7 +43,7 @@
final AssertionError fail = new AssertionError("Fails with Permission denied when trying to execute jQuery");
final T start = null;
- return Wait.timeout(Wait.DEFAULT_TIMEOUT).interval(1000).failWith(fail).waitForChangeAndReturn(start,
+ return Wait.noDelay().timeout(Wait.DEFAULT_TIMEOUT).interval(1000).failWith(fail).waitForChangeAndReturn(start,
new Retrieve<T>() {
boolean exceptionLogged = false;
14 years, 3 months
JBoss Rich Faces SVN: r16302 - branches/community/3.3.X/test-applications/selenium-testing-lib/src/main/java/org/jboss/test/selenium/waiting.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-01-15 07:07:59 -0500 (Fri, 15 Jan 2010)
New Revision: 16302
Modified:
branches/community/3.3.X/test-applications/selenium-testing-lib/src/main/java/org/jboss/test/selenium/waiting/Wait.java
Log:
- richfaces-selenium - added noDelay()/withDelay(boolean) methods to define delay after start of waiting and first condition testing (RFPL-320)
Modified: branches/community/3.3.X/test-applications/selenium-testing-lib/src/main/java/org/jboss/test/selenium/waiting/Wait.java
===================================================================
--- branches/community/3.3.X/test-applications/selenium-testing-lib/src/main/java/org/jboss/test/selenium/waiting/Wait.java 2010-01-15 11:43:16 UTC (rev 16301)
+++ branches/community/3.3.X/test-applications/selenium-testing-lib/src/main/java/org/jboss/test/selenium/waiting/Wait.java 2010-01-15 12:07:59 UTC (rev 16302)
@@ -186,6 +186,30 @@
}
/**
+ * Constructs preset instance of waiting (@see Waiting) with no delay by
+ * interval between start waiting and first test for conditions.
+ *
+ * @return Waiting instance initialized with no delay
+ */
+ public static Waiting noDelay() {
+ return getDefault().withDelay(false);
+ }
+
+ /**
+ * Constructs preset instance of waiting (@see Waiting) and set that testing
+ * condition should or shouldn't be delayed of one interval after the start
+ * of waiting.
+ *
+ * @param isDelayed
+ * true if condition testing should be delayed; false otherwise
+ * @return Waiting instance initialized with delay if isDelayed is set to
+ * true; with no delay otherwise
+ */
+ public static Waiting withDelay(boolean isDelayed) {
+ return getDefault().withDelay(isDelayed);
+ }
+
+ /**
* Will wait for default amount of time. Default timeout specified in
* Wait.DEFAULT_TIMEOUT
*/
@@ -263,6 +287,12 @@
private long timeout = DEFAULT_TIMEOUT;
/**
+ * Indicates when the first test for the condition should be delayed
+ * after waiting starts.
+ */
+ public boolean isDelayed = true;
+
+ /**
* Failure indicates waiting timeout.
*
* If is set to null, no failure will be thrown after timeout.
@@ -371,8 +401,37 @@
public Waiting dontFail() {
return failWith((Throwable) null);
}
+
+ /**
+ * Sets no delay by interval between start waiting and first test for
+ * conditions.
+ *
+ * @return Waiting instance initialized with no delay
+ */
+ public Waiting noDelay() {
+ return withDelay(false);
+ }
/**
+ * Set if testing condition should be delayed of one interval after the
+ * start of waiting.
+ *
+ * @param isDelayed
+ * true if condition testing should be delayed; false
+ * otherwise
+ * @return Waiting instance initialized with delay if isDelayed is set
+ * to true; with no delay otherwise
+ */
+ public Waiting withDelay(boolean isDelayed) {
+ if (isDelayed == this.isDelayed) {
+ return this;
+ }
+ Waiting copy = this.copy();
+ copy.isDelayed = isDelayed;
+ return copy;
+ }
+
+ /**
* Stars loop waiting to satisfy condition.
*
* @param condition
@@ -380,15 +439,22 @@
*/
public void until(Condition condition) {
long start = System.currentTimeMillis();
- long end = start + timeout;
+ long end = start + this.timeout;
+ boolean delay = this.isDelayed;
while (System.currentTimeMillis() < end) {
+ if (!delay && condition.isTrue())
+ return;
+ delay = false;
try {
- Thread.sleep(interval);
+ Thread.sleep(this.interval);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
- if (condition.isTrue())
- return;
+ if (System.currentTimeMillis() >= end) {
+ if (condition.isTrue()) {
+ return;
+ }
+ }
}
fail();
}
@@ -475,6 +541,7 @@
copy.interval = this.interval;
copy.timeout = this.timeout;
copy.failure = this.failure;
+ copy.isDelayed = this.isDelayed;
return copy;
}
}
14 years, 3 months
JBoss Rich Faces SVN: r16301 - root/framework/trunk/impl/src/main/resources/META-INF/resources.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-01-15 06:43:16 -0500 (Fri, 15 Jan 2010)
New Revision: 16301
Added:
root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-event.js
Log:
Richfaces.Event Api was added (draft)
Added: root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-event.js
===================================================================
--- root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-event.js (rev 0)
+++ root/framework/trunk/impl/src/main/resources/META-INF/resources/richfaces-event.js 2010-01-15 11:43:16 UTC (rev 16301)
@@ -0,0 +1,43 @@
+(function(jQuery, richfaces) {
+ richfaces.event = richfaces.Event || {};
+
+ jQuery.extend(richfaces.Event, {
+ ready : function(fn) {
+ return $(document).ready(fn);
+ /*
+ function callback(jQueryReference) {
+ this; // document
+ }
+ */
+ },
+ bind : function(selector, type, fn, data) {
+ // type: namespace can be used, like onclick.rf.conponentName
+ return jQuery(selector).bind(type, data, fn);
+ },
+ bindOne: function(selector, type, fn, data) {
+ // type: namespace can be used, like onclick.rf.conponentName
+ return jQuery(selector).one(type, data, fn);
+ },
+ unbind : function(selector, type, fn) {
+ // type: namespace can be used, like onclick.rf.conponentName
+ return jQuery(selector).unbind(type, fn);
+ },
+ fire : function(selector, event, data) {
+ return jQuery(selector).trigger(event, data);
+ },
+ callHandler : function(selector, event, data) {
+ return jQuery(selector).triggerHandler(event, data);
+ }
+
+ });
+
+})(jQuery, RichFaces);
+
+/*
+fn : function (eventObject) {
+ this; // dom element
+}
+*/
+
+// API usage example:
+// RichFaces.Event.bind(selector, type, fn, data);
14 years, 3 months
JBoss Rich Faces SVN: r16300 - in root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk: model and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-01-14 20:22:00 -0500 (Thu, 14 Jan 2010)
New Revision: 16300
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ValidatorProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ValidatorModel.java
Log:
default constructor
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ValidatorProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ValidatorProcessor.java 2010-01-14 19:05:04 UTC (rev 16299)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ValidatorProcessor.java 2010-01-15 01:22:00 UTC (rev 16300)
@@ -41,9 +41,7 @@
public void process(TypeElement element) throws CdkProcessingException {
Validator validator = element.getAnnotation(Validator.class);
- ValidatorModel validatorModel = new ValidatorModel("my_validator", new ClassDescription(Object.class));
- validatorModel.setValidatorId(validator.id());
- validatorModel.setValidatorClass(new ClassDescription(element.getQualifiedName().toString()));
+ ValidatorModel validatorModel = new ValidatorModel(validator.id(), new ClassDescription(element.getQualifiedName().toString()));
setDescription(element, validatorModel);
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ValidatorModel.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ValidatorModel.java 2010-01-14 19:05:04 UTC (rev 16299)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ValidatorModel.java 2010-01-15 01:22:00 UTC (rev 16300)
@@ -37,6 +37,9 @@
private ClassDescription validatorClass;
+ public ValidatorModel() {
+ }
+
public ValidatorModel(String validatorId, ClassDescription validatorClass) {
setValidatorId(validatorId);
setValidatorClass(validatorClass);
14 years, 3 months
JBoss Rich Faces SVN: r16299 - in root/cdk/trunk/plugins/generator/src: main/java/org/richfaces/cdk/model and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-01-14 14:05:04 -0500 (Thu, 14 Jan 2010)
New Revision: 16299
Added:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/AnnotationProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ConverterProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ValidatorProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyConverter.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyValidator.java
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ConverterProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConverterModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Key.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ComponentProcessorTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ModelBeanTest.java
Log:
https://jira.jboss.org/jira/browse/RF-8232
Tags support - Tests for convertor & validator processors
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ConverterProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ConverterProcessor.java 2010-01-14 18:14:34 UTC (rev 16298)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ConverterProcessor.java 2010-01-14 19:05:04 UTC (rev 16299)
@@ -21,16 +21,16 @@
package org.richfaces.cdk.apt;
-import java.lang.annotation.Annotation;
+import org.richfaces.cdk.CdkProcessingException;
+import org.richfaces.cdk.annotations.Converter;
+import org.richfaces.cdk.model.ClassDescription;
+import org.richfaces.cdk.model.ConverterModel;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.lang.model.element.TypeElement;
+import javax.lang.model.type.MirroredTypeException;
+import java.lang.annotation.Annotation;
-import org.richfaces.cdk.CdkProcessingException;
-import org.richfaces.cdk.annotations.Converter;
-import org.richfaces.cdk.model.ConverterModel;
-import org.richfaces.cdk.model.ClassDescription;
-
/**
* @author akolonitsky
* @since Jan 4, 2010
@@ -44,7 +44,12 @@
ConverterModel converterModel = new ConverterModel();
converterModel.setConverterId(converter.id());
- converterModel.setConverterForClass(converter.forClass());
+
+ try {
+ converterModel.setConverterForClass(new ClassDescription(converter.forClass().getName()));
+ } catch (MirroredTypeException e) {
+ converterModel.setConverterForClass(new ClassDescription(e.getTypeMirror().toString()));
+ }
converterModel.setConverterClass(new ClassDescription(element.getQualifiedName().toString()));
setDescription(element, converterModel);
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2010-01-14 18:14:34 UTC (rev 16298)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ComponentModel.java 2010-01-14 19:05:04 UTC (rev 16299)
@@ -210,8 +210,8 @@
* <p class="changed_added_4_0"></p>
* @param generate the generate to set
*/
- public void setGenerate(boolean exists) {
- this.generate = exists;
+ public void setGenerate(boolean generate) {
+ this.generate = generate;
}
/**
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConverterModel.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConverterModel.java 2010-01-14 18:14:34 UTC (rev 16298)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConverterModel.java 2010-01-14 19:05:04 UTC (rev 16299)
@@ -38,7 +38,7 @@
private ClassDescription converterClass;
- private Class<?> converterForClass;
+ private ClassDescription converterForClass;
public ConverterModel() {
}
@@ -57,11 +57,11 @@
}
@Merge(false)
- public Class<?> getConverterForClass() {
+ public ClassDescription getConverterForClass() {
return converterForClass;
}
- public void setConverterForClass(Class<?> converterForClass) {
+ public void setConverterForClass(ClassDescription converterForClass) {
this.converterForClass = converterForClass;
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Key.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Key.java 2010-01-14 18:14:34 UTC (rev 16298)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/Key.java 2010-01-14 19:05:04 UTC (rev 16299)
@@ -30,8 +30,9 @@
*
* @author asmirnov(a)exadel.com
*/
-@SuppressWarnings("serial")
public class Key implements Serializable {
+ private static final long serialVersionUID = -8199984910177820771L;
+
private final String type;
/**
Added: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/AnnotationProcessorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/AnnotationProcessorTest.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/AnnotationProcessorTest.java 2010-01-14 19:05:04 UTC (rev 16299)
@@ -0,0 +1,90 @@
+/**
+ * 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.apt;
+
+import org.richfaces.cdk.CdkTestBase;
+import org.richfaces.cdk.CdkContext;
+import org.richfaces.cdk.CdkContextBase;
+import org.richfaces.cdk.StandardSources;
+import org.richfaces.cdk.RichFacesConventions;
+import org.richfaces.cdk.NamingConventions;
+import org.richfaces.cdk.ModelValidator;
+import org.richfaces.cdk.CdkException;
+import org.richfaces.cdk.CdkProcessingException;
+import org.richfaces.cdk.CdkClassLoader;
+import org.richfaces.cdk.annotations.Family;
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.ComponentModel;
+import com.google.common.collect.ImmutableList;
+
+import javax.el.ELContext;
+import javax.faces.component.UIComponent;
+
+/**
+ * @author akolonitsky
+ * @since Jan 14, 2010
+ */
+public abstract class AnnotationProcessorTest extends CdkTestBase {
+
+ protected ComponentLibrary prepareMockCompilationContext(String javaFilePath) throws Exception {
+ CdkContext cdkContext = createMockContext();
+ CdkProcessor processor = new CdkProcessor();
+ AptBuilder compiler = new AptBuilder();
+
+ compiler.init(cdkContext);
+ processor.init(cdkContext);
+ compiler.process(ImmutableList.of(getJavaFile(javaFilePath)), processor);
+
+ return cdkContext.getLibrary();
+ }
+
+ protected CdkContext createMockContext() throws Exception {
+ CdkContextBase baseContext = new CdkContextBase(createClassLoader());
+ baseContext.setSourceFolders(StandardSources.JAVA_SOURCES, testSourceDirectory);
+ RichFacesConventions richFacesConventions = new RichFacesConventions();
+ baseContext.setWorker(NamingConventions.class, richFacesConventions);
+ baseContext.setWorker(ModelValidator.class, new ModelValidator() {
+
+ @Override
+ public void init(CdkContext context) {
+
+ }
+
+ @Override
+ public void verify(ComponentLibrary library) throws CdkException {
+ }
+ });
+ baseContext.sendError(new CdkProcessingException());
+
+ return baseContext;
+ }
+
+ @Override
+ protected CdkClassLoader createClassLoader() throws Exception {
+ return new CdkClassLoader(ImmutableList.of(getLibraryFile("test.source.properties"),
+ getLibraryFile(ComponentModel.class),
+ getLibraryFile(ELContext.class),
+ getLibraryFile(Family.class),
+ getLibraryFile(UIComponent.class)),
+ this.getClass().getClassLoader());
+ }
+}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ComponentProcessorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ComponentProcessorTest.java 2010-01-14 18:14:34 UTC (rev 16298)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ComponentProcessorTest.java 2010-01-14 19:05:04 UTC (rev 16299)
@@ -25,34 +25,16 @@
package org.richfaces.cdk.apt;
-import static org.easymock.EasyMock.*;
import static org.junit.Assert.*;
import java.util.Collection;
-import java.util.Collections;
import java.util.Map;
-import javax.el.ELContext;
-import javax.faces.component.UIComponent;
-
-import org.junit.Ignore;
import org.junit.Test;
-import org.richfaces.cdk.CdkClassLoader;
import org.richfaces.cdk.CdkContext;
-import org.richfaces.cdk.CdkContextBase;
-import org.richfaces.cdk.CdkException;
-import org.richfaces.cdk.CdkProcessingException;
-import org.richfaces.cdk.CdkTestBase;
-import org.richfaces.cdk.ModelValidator;
-import org.richfaces.cdk.NamingConventions;
-import org.richfaces.cdk.RichFacesConventions;
-import org.richfaces.cdk.StandardSources;
-import org.richfaces.cdk.annotations.Family;
import org.richfaces.cdk.model.ComponentModel;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.Property;
-import org.richfaces.cdk.xmlconfig.FragmentParser;
-import org.richfaces.cdk.xmlconfig.JAXBBinding;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
@@ -64,7 +46,7 @@
* @author asmirnov(a)exadel.com
*
*/
-public class ComponentProcessorTest extends CdkTestBase {
+public class ComponentProcessorTest extends AnnotationProcessorTest {
private static final String COMPONENT_CLASS_JAVA = "org/richfaces/cdk/test/component/AbstractTestComponent.java";
private static final String FACES_COMPONENT_CLASS_JAVA = "org/richfaces/cdk/test/component/UITestCommand.java";
@@ -77,17 +59,7 @@
*/
@Test
public void testProcess() throws Exception {
-
- // Prepare Mock compilation context.
- CdkContext cdkContext = createMockContext();
- CdkProcessor processor = new CdkProcessor();
- AptBuilder compiler = new AptBuilder();
-
- compiler.init(cdkContext);
- processor.init(cdkContext);
- compiler.process(ImmutableList.of(getJavaFile(COMPONENT_CLASS_JAVA)), processor);
-
- ComponentLibrary library = cdkContext.getLibrary();
+ ComponentLibrary library = prepareMockCompilationContext(COMPONENT_CLASS_JAVA);
Collection<ComponentModel> components = library.getComponents();
assertEquals(1, components.size());
@@ -107,17 +79,7 @@
*/
@Test
public void testProcessFacesComponent() throws Exception {
-
- // Prepare Mock compilation context.
- CdkContext cdkContext = createMockContext();
- CdkProcessor processor = new CdkProcessor();
- AptBuilder compiler = new AptBuilder();
-
- compiler.init(cdkContext);
- processor.init(cdkContext);
- compiler.process(ImmutableList.of(getJavaFile(FACES_COMPONENT_CLASS_JAVA)), processor);
-
- ComponentLibrary library = cdkContext.getLibrary();
+ ComponentLibrary library = prepareMockCompilationContext(FACES_COMPONENT_CLASS_JAVA);
Collection<ComponentModel> components = library.getComponents();
assertEquals(1, components.size());
@@ -128,34 +90,4 @@
assertEquals(0, attributes.size());
}
- private CdkContext createMockContext() throws Exception {
- CdkContextBase baseContext = new CdkContextBase(createClassLoader());
- baseContext.setSourceFolders(StandardSources.JAVA_SOURCES, testSourceDirectory);
- RichFacesConventions richFacesConventions = new RichFacesConventions();
- baseContext.setWorker(NamingConventions.class, richFacesConventions);
- baseContext.setWorker(ModelValidator.class, new ModelValidator() {
-
- @Override
- public void init(CdkContext context) {
-
- }
-
- @Override
- public void verify(ComponentLibrary library) throws CdkException {
- }
- });
- baseContext.sendError(new CdkProcessingException());
-
- return baseContext;
- }
-
- protected CdkClassLoader createClassLoader() throws Exception {
- return new CdkClassLoader(ImmutableList.of(getLibraryFile("test.source.properties"),
- getLibraryFile(ComponentModel.class),
- getLibraryFile(ELContext.class),
- getLibraryFile(Family.class),
- getLibraryFile(UIComponent.class)),
- this.getClass().getClassLoader());
- }
-
}
Added: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ConverterProcessorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ConverterProcessorTest.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ConverterProcessorTest.java 2010-01-14 19:05:04 UTC (rev 16299)
@@ -0,0 +1,68 @@
+/**
+ * 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.apt;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+import org.richfaces.cdk.CdkClassLoader;
+import org.richfaces.cdk.CdkContext;
+import org.richfaces.cdk.CdkContextBase;
+import org.richfaces.cdk.CdkException;
+import org.richfaces.cdk.CdkProcessingException;
+import org.richfaces.cdk.CdkTestBase;
+import org.richfaces.cdk.ModelValidator;
+import org.richfaces.cdk.NamingConventions;
+import org.richfaces.cdk.RichFacesConventions;
+import org.richfaces.cdk.StandardSources;
+import org.richfaces.cdk.annotations.Family;
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.ComponentModel;
+import org.richfaces.cdk.model.ConverterModel;
+import org.richfaces.cdk.model.ClassDescription;
+
+import javax.el.ELContext;
+import javax.faces.component.UIComponent;
+import java.util.Collection;
+
+/**
+ * @author akolonitsky
+ * @since Jan 14, 2010
+ */
+public class ConverterProcessorTest extends AnnotationProcessorTest {
+ private static final String COMPONENT_CLASS_JAVA = "org/richfaces/cdk/test/component/MyConverter.java";
+
+ @Test
+ public void testProcess() throws Exception {
+ ComponentLibrary library = prepareMockCompilationContext(COMPONENT_CLASS_JAVA);
+ Collection<ConverterModel> converters = library.getConverters();
+
+ assertEquals(3, converters.size());
+
+ ConverterModel converterModel = Iterables.get(converters, 0);
+ ClassDescription forClass = converterModel.getConverterForClass();
+ if (forClass != null && !Object.class.getName().equals(forClass.getName())) {
+ assertEquals(Integer.class.getName(), forClass.getName());
+ }
+ }
+}
Added: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ValidatorProcessorTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ValidatorProcessorTest.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/apt/ValidatorProcessorTest.java 2010-01-14 19:05:04 UTC (rev 16299)
@@ -0,0 +1,52 @@
+/**
+ * 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.apt;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.ValidatorModel;
+
+import java.util.Collection;
+
+/**
+ * @author akolonitsky
+ * @since Jan 14, 2010
+ */
+public class ValidatorProcessorTest extends AnnotationProcessorTest {
+ private static final String VALIDATOR_CLASS_JAVA = "org/richfaces/cdk/test/component/MyValidator.java";
+
+ @Test
+ public void testProcess() throws Exception {
+ ComponentLibrary library = prepareMockCompilationContext(VALIDATOR_CLASS_JAVA);
+ Collection<ValidatorModel> validators = library.getValidators();
+
+ assertEquals(2, validators.size());
+
+ for (ValidatorModel model: validators) {
+ String id = model.getValidatorId();
+ if (id != null && !id.isEmpty()) {
+ assertEquals("my_validator", model.getValidatorId());
+ }
+ }
+ }
+}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.java 2010-01-14 18:14:34 UTC (rev 16298)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.java 2010-01-14 19:05:04 UTC (rev 16299)
@@ -22,20 +22,13 @@
package org.richfaces.cdk.xmlconfig.testmodel;
import org.junit.Test;
-import org.junit.Ignore;
-import org.richfaces.cdk.CdkContextBase;
+import org.richfaces.cdk.model.ClassDescription;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ComponentModel;
+import org.richfaces.cdk.model.ConverterModel;
import org.richfaces.cdk.model.RenderKitModel;
import org.richfaces.cdk.model.RendererModel;
-import org.richfaces.cdk.model.ConverterModel;
-import org.richfaces.cdk.model.ClassDescription;
-import org.richfaces.cdk.xmlconfig.JAXBBinding;
-import org.richfaces.cdk.xmlconfig.FacesConfigGenerator;
-import org.richfaces.cdk.xmlconfig.JaxbTestBase;
-import org.richfaces.cdk.xmlconfig.model.FacesConfigAdapter;
-import javax.xml.transform.stream.StreamResult;
import java.io.StringWriter;
/**
@@ -48,7 +41,7 @@
public void testMarshalResultStringT() throws Exception {
ComponentLibrary library = new ComponentLibrary();
- ComponentModel component = new ComponentModel( new ComponentModel.Type("foo.bar"));
+ ComponentModel component = new ComponentModel(new ComponentModel.Type("foo.bar"));
library.getComponents().add(component);
RenderKitModel renderKit = library.addRenderKit("HTML");
RendererModel renderer = new RendererModel(new RendererModel.Type("foo.Renderer"));
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ModelBeanTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ModelBeanTest.java 2010-01-14 18:14:34 UTC (rev 16298)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ModelBeanTest.java 2010-01-14 19:05:04 UTC (rev 16299)
@@ -21,27 +21,25 @@
package org.richfaces.cdk.xmlconfig.testmodel;
-import org.richfaces.cdk.xmlconfig.JaxbTestBase;
-import org.richfaces.cdk.xmlconfig.JAXBBinding;
+import org.custommonkey.xmlunit.Diff;
+import org.custommonkey.xmlunit.Validator;
+import org.junit.Assert;
+import org.richfaces.cdk.CdkContextBase;
+import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.xmlconfig.FacesConfigGenerator;
+import org.richfaces.cdk.xmlconfig.JAXBBinding;
+import org.richfaces.cdk.xmlconfig.JaxbTestBase;
import org.richfaces.cdk.xmlconfig.model.FacesConfigAdapter;
-import org.richfaces.cdk.model.ComponentLibrary;
-import org.richfaces.cdk.CdkContextBase;
-import org.xml.sax.SAXException;
import org.xml.sax.InputSource;
-import org.custommonkey.xmlunit.Validator;
-import org.custommonkey.xmlunit.Diff;
-import org.junit.Assert;
+import org.xml.sax.SAXException;
import javax.xml.transform.stream.StreamResult;
-import java.io.StringWriter;
import java.io.File;
import java.io.IOException;
-import java.io.StringReader;
-import java.io.InputStreamReader;
import java.io.InputStream;
-import java.net.URL;
-import java.net.MalformedURLException;
+import java.io.InputStreamReader;
+import java.io.StringReader;
+import java.io.StringWriter;
/**
* @author akolonitsky
Added: root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyConverter.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyConverter.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyConverter.java 2010-01-14 19:05:04 UTC (rev 16299)
@@ -0,0 +1,87 @@
+/**
+ * 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.test.component;
+
+import org.richfaces.cdk.annotations.Converter;
+
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+
+/**
+ * @author akolonitsky
+ * @since Jan 14, 2010
+ */
+@Converter(id = "my_converter", forClass = Integer.class)
+public class MyConverter implements javax.faces.convert.Converter{
+
+ @Override
+ public Object getAsObject(FacesContext context, UIComponent component, String value) {
+ return null;
+ }
+
+ @Override
+ public String getAsString(FacesContext context, UIComponent component, Object value) {
+ return null;
+ }
+}
+
+@Converter(forClass = Integer.class)
+class MyConverter01 implements javax.faces.convert.Converter{
+
+ @Override
+ public Object getAsObject(FacesContext context, UIComponent component, String value) {
+ return null;
+ }
+
+ @Override
+ public String getAsString(FacesContext context, UIComponent component, Object value) {
+ return null;
+ }
+}
+
+@Converter(id = "my_converter_02")
+class MyConverter02 implements javax.faces.convert.Converter{
+
+ @Override
+ public Object getAsObject(FacesContext context, UIComponent component, String value) {
+ return null;
+ }
+
+ @Override
+ public String getAsString(FacesContext context, UIComponent component, Object value) {
+ return null;
+ }
+}
+
+@Converter
+class MyConverter03 implements javax.faces.convert.Converter{
+
+ @Override
+ public Object getAsObject(FacesContext context, UIComponent component, String value) {
+ return null;
+ }
+
+ @Override
+ public String getAsString(FacesContext context, UIComponent component, Object value) {
+ return null;
+ }
+}
Added: root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyValidator.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyValidator.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/test/component/MyValidator.java 2010-01-14 19:05:04 UTC (rev 16299)
@@ -0,0 +1,50 @@
+/**
+ * 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.test.component;
+
+import org.richfaces.cdk.annotations.Validator;
+
+import javax.faces.validator.ValidatorException;
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+
+/**
+ * @author akolonitsky
+ * @since Jan 14, 2010
+ */
+@Validator(id = "my_validator")
+public class MyValidator implements javax.faces.validator.Validator {
+
+ @Override
+ public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
+
+ }
+}
+
+@Validator
+class MyValidator01 implements javax.faces.validator.Validator {
+
+ @Override
+ public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
+
+ }
+}
14 years, 3 months
JBoss Rich Faces SVN: r16298 - in branches/enterprise/3.3.X/framework/impl/src: test/java/org/ajax4jsf/io/parser and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-01-14 13:14:34 -0500 (Thu, 14 Jan 2010)
New Revision: 16298
Modified:
branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java
branches/enterprise/3.3.X/framework/impl/src/test/java/org/ajax4jsf/io/parser/FastParserTest.java
Log:
RFPL-237
porting RF-7344 to enterprise branch
Modified: branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java
===================================================================
--- branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java 2010-01-14 16:50:06 UTC (rev 16297)
+++ branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java 2010-01-14 18:14:34 UTC (rev 16298)
@@ -507,7 +507,7 @@
if (haveHead) {
// <title> or <base> in the head
if (!("title".equalsIgnoreCase(name.rawname) || "base"
- .equalsIgnoreCase(element.rawname) || "meta"
+ .equalsIgnoreCase(name.rawname) || "meta"
.equalsIgnoreCase(name.rawname))) {
insertResources(name.prefix, name.uri);
}
Modified: branches/enterprise/3.3.X/framework/impl/src/test/java/org/ajax4jsf/io/parser/FastParserTest.java
===================================================================
--- branches/enterprise/3.3.X/framework/impl/src/test/java/org/ajax4jsf/io/parser/FastParserTest.java 2010-01-14 16:50:06 UTC (rev 16297)
+++ branches/enterprise/3.3.X/framework/impl/src/test/java/org/ajax4jsf/io/parser/FastParserTest.java 2010-01-14 18:14:34 UTC (rev 16298)
@@ -118,8 +118,8 @@
assertTrue(resultString.indexOf("<title>")<resultString.lastIndexOf("<link"));
assertTrue(resultString.indexOf("</head>")>resultString.lastIndexOf("</script"));
assertTrue(resultString.indexOf("</head>")>resultString.lastIndexOf("<link"));
- assertTrue(resultString.indexOf("<meta")>resultString.lastIndexOf("</script"));
- assertTrue(resultString.indexOf("<meta")>resultString.lastIndexOf("<link"));
+ assertTrue(resultString.indexOf("<meta")<resultString.lastIndexOf("</script"));
+ assertTrue(resultString.indexOf("<meta")<resultString.lastIndexOf("<link"));
}
/**
14 years, 3 months
JBoss Rich Faces SVN: r16297 - in branches/community/3.3.X/samples/richfaces-demo/src/main: webapp/richfaces/dataFilterSlider/examples and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2010-01-14 11:50:06 -0500 (Thu, 14 Jan 2010)
New Revision: 16297
Modified:
branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/datafilterslider/DemoInventoryList.java
branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/dataFilterSlider/examples/filterData.xhtml
Log:
https://jira.jboss.org/jira/browse/RF-8206
Modified: branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/datafilterslider/DemoInventoryList.java
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/datafilterslider/DemoInventoryList.java 2010-01-14 16:08:21 UTC (rev 16296)
+++ branches/community/3.3.X/samples/richfaces-demo/src/main/java/org/richfaces/demo/datafilterslider/DemoInventoryList.java 2010-01-14 16:50:06 UTC (rev 16297)
@@ -4,9 +4,11 @@
import java.util.List;
import javax.faces.component.UIData;
+import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import org.richfaces.component.UIDataFltrSlider;
+import org.richfaces.function.RichFunction;
public class DemoInventoryList {
@@ -119,62 +121,32 @@
public List getCarMakeIndex() {
return carMakeIndex;
}
-
+
public void setCarMakeIndex(List carMakeIndex) {
this.carMakeIndex = carMakeIndex;
}
- private UIData carMakeIndexUIData;
+ List carInventory = null;
-
- public UIData getCarMakeIndexUIData() {
- return carMakeIndexUIData;
+ public void setCarInventory(List carInventory) {
+ this.carInventory = carInventory;
}
- public void setCarMakeIndexUIData(UIData carMakeIndexUIData) {
- this.carMakeIndexUIData = carMakeIndexUIData;
- }
-
- public Object getCarInventory() {
-
- if (uiData == null){
+ public List getCarInventory() {
+ if (carInventory == null){
loadCarTable("1");
}
-
- return getUiData().getValue();
-
+ return carInventory;
}
protected void loadCarMakeIndex() {
-
carMakeIndex = dataFilterSliderDao.getAllCarMakes();
}
- UIData uiData;
-
-
- public UIData getUiData() {
- if(uiData == null){
- uiData = new UIData();
- }
- return uiData;
- }
-
- public void setUiData(UIData uiData) {
- this.uiData = uiData;
- }
-
public void loadCarTable(String id) {
- try{
-
- getUiData().setValue(dataFilterSliderDao.getCarsById(id));
-
- }catch(Exception e){
- e.printStackTrace();
- }
+ setCarInventory(dataFilterSliderDao.getCarsById(id));
}
-
private static final String carMileageColumnName = "Mileage";
private static final String carMileageMktAvgColumnName = "MktAvg";
private static final String carPriceColumnName = "Price";
@@ -218,24 +190,20 @@
loadCarTable(filterValue);
}
- UIDataFltrSlider dataFilterSlider;
-
-
- public UIDataFltrSlider getDataFilterSlider() {
- return dataFilterSlider;
- }
-
- public void setDataFilterSlider(UIDataFltrSlider dataFilterSlider) {
- this.dataFilterSlider = dataFilterSlider;
- }
-
public void filterCarList(ActionEvent event) {
+ String sliderId = FacesContext.getCurrentInstance().
+ getExternalContext().getRequestParameterMap().get("sliderId");
+ UIDataFltrSlider slider=null;
- UIDataFltrSlider slider = getDataFilterSlider();
- slider.resetDataTable();
-
+ if (sliderId!=null){
+ slider = (UIDataFltrSlider)RichFunction.findComponent(sliderId);
+ slider.resetDataTable();
+ }
+
try{
- filterValue = String.valueOf(carMakeIndexUIData.getRowIndex());
+ filterValue = FacesContext.getCurrentInstance().
+ getExternalContext().getRequestParameterMap().get("rowKey");
+
filterRule = getAttribute(event, "filterRule");
if (filterRule.equals("showTable")){
@@ -244,8 +212,10 @@
}catch(Exception e){
e.printStackTrace();
}
-
- slider.filterDataTable(slider.getHandleValue());
+
+ if (slider!=null){
+ slider.filterDataTable(slider.getHandleValue());
+ }
}
private static String getAttribute(ActionEvent event, String name) {
@@ -258,7 +228,7 @@
public int getGenRandom() {
return dataFilterSliderDao.genRand();
}
-
+
public void setGenRandom(int genRandom) {
this.genRandom = genRandom;
}
Modified: branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/dataFilterSlider/examples/filterData.xhtml
===================================================================
--- branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/dataFilterSlider/examples/filterData.xhtml 2010-01-14 16:08:21 UTC (rev 16296)
+++ branches/community/3.3.X/samples/richfaces-demo/src/main/webapp/richfaces/dataFilterSlider/examples/filterData.xhtml 2010-01-14 16:50:06 UTC (rev 16297)
@@ -14,31 +14,31 @@
<h:form id="form1">
<a4j:queue />
- <rich:dataFilterSlider sliderListener="#{dfsBean.doSlide}"
- binding="#{inventoryList.dataFilterSlider}" for="carList"
+ <rich:dataFilterSlider for="carList"
forValRef="inventoryList.carInventory" filterBy="getMileage"
manualInput="true" onSlide="true" onChange="true" storeResults="true"
width="200px" startRange="10000" endRange="60000" increment="10000"
- trailer="true" handleValue="60000"/>
+ trailer="true" handleValue="60000" id="slider"/>
<rich:spacer height="15" />
- <h:dataTable id="carIndex" rows="10"
- binding="#{inventoryList.carMakeIndexUIData}"
+ <rich:dataTable id="carIndex" rows="10"
+ rowKeyVar="rowKey"
value="#{inventoryList.carMakeIndex}" var="category"
styleClass="list-table1" columnClasses="column-index"
rowClasses="list-row3">
- <h:column>
+ <rich:column>
<a4j:commandLink actionListener="#{inventoryList.filterCarList}"
reRender="carList">
<h:outputText value="#{category}" />
<f:attribute name="filterRule" value="showTable" />
-
+ <f:param name="sliderId" value="slider"/>
+ <f:param name="rowKey" value="#{rowKey}"/>
</a4j:commandLink>
- </h:column>
+ </rich:column>
- </h:dataTable>
+ </rich:dataTable>
<rich:spacer height="15" />
<rich:dataTable width="300" id="carList" rows="10"
14 years, 3 months
JBoss Rich Faces SVN: r16296 - in root/cdk/trunk/plugins: generator and 8 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-01-14 11:08:21 -0500 (Thu, 14 Jan 2010)
New Revision: 16296
Added:
root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Validator.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ValidatorProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorAdapter.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorBean.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ModelBeanTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.xml
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.xml
Modified:
root/cdk/trunk/plugins/generator/pom.xml
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ConverterProcessor.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConverterModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ValidatorModel.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesConfigBean.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestBase.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JaxbTestBase.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.java
Log:
Added: root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Validator.java
===================================================================
--- root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Validator.java (rev 0)
+++ root/cdk/trunk/plugins/annotations/src/main/java/org/richfaces/cdk/annotations/Validator.java 2010-01-14 16:08:21 UTC (rev 16296)
@@ -0,0 +1,21 @@
+package org.richfaces.cdk.annotations;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+
+/**
+ * @author akolonitsky
+ * @since Jan 13, 2010
+ */
+(a)Retention(RetentionPolicy.CLASS)
+(a)Target(ElementType.TYPE)
+@Inherited
+public @interface Validator {
+
+ public static final String NAME = "org.richfaces.cdk.annotations.Validator";
+
+ public String id() default "";
+}
Modified: root/cdk/trunk/plugins/generator/pom.xml
===================================================================
--- root/cdk/trunk/plugins/generator/pom.xml 2010-01-14 15:46:34 UTC (rev 16295)
+++ root/cdk/trunk/plugins/generator/pom.xml 2010-01-14 16:08:21 UTC (rev 16296)
@@ -100,6 +100,13 @@
<version>4.6</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>xmlunit</groupId>
+ <artifactId>xmlunit</artifactId>
+ <scope>test</scope>
+ <version>1.2</version>
+ </dependency>
+
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java 2010-01-14 15:46:34 UTC (rev 16295)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/CdkProcessor.java 2010-01-14 16:08:21 UTC (rev 16296)
@@ -59,6 +59,7 @@
.of(ComponentProcessor.class,
FacesComponentProcessor.class,
BehaviorProcessor.class,
+ ValidatorProcessor.class,
ConverterProcessor.class);
/**
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ConverterProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ConverterProcessor.java 2010-01-14 15:46:34 UTC (rev 16295)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ConverterProcessor.java 2010-01-14 16:08:21 UTC (rev 16296)
@@ -29,6 +29,7 @@
import org.richfaces.cdk.CdkProcessingException;
import org.richfaces.cdk.annotations.Converter;
import org.richfaces.cdk.model.ConverterModel;
+import org.richfaces.cdk.model.ClassDescription;
/**
* @author akolonitsky
@@ -40,10 +41,14 @@
@Override
public void process(TypeElement element) throws CdkProcessingException {
Converter converter = element.getAnnotation(Converter.class);
+
ConverterModel converterModel = new ConverterModel();
converterModel.setConverterId(converter.id());
converterModel.setConverterForClass(converter.forClass());
+ converterModel.setConverterClass(new ClassDescription(element.getQualifiedName().toString()));
+
setDescription(element, converterModel);
+
getLibrary().getConverters().add(converterModel);
}
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ValidatorProcessor.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ValidatorProcessor.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/apt/ValidatorProcessor.java 2010-01-14 16:08:21 UTC (rev 16296)
@@ -0,0 +1,57 @@
+/**
+ * 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.apt;
+
+import org.richfaces.cdk.CdkProcessingException;
+import org.richfaces.cdk.annotations.Validator;
+import org.richfaces.cdk.model.ClassDescription;
+import org.richfaces.cdk.model.ValidatorModel;
+
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.element.TypeElement;
+import java.lang.annotation.Annotation;
+
+/**
+ * @author akolonitsky
+ * @since Jan 13, 2010
+ */
+@SupportedAnnotationTypes({"javax.faces.component.FacesComponent", Validator.NAME})
+public class ValidatorProcessor extends ProcessorBase implements CdkAnnotationProcessor {
+
+ @Override
+ public void process(TypeElement element) throws CdkProcessingException {
+ Validator validator = element.getAnnotation(Validator.class);
+
+ ValidatorModel validatorModel = new ValidatorModel("my_validator", new ClassDescription(Object.class));
+ validatorModel.setValidatorId(validator.id());
+ validatorModel.setValidatorClass(new ClassDescription(element.getQualifiedName().toString()));
+
+ setDescription(element, validatorModel);
+
+ getLibrary().getValidators().add(validatorModel);
+ }
+
+ @Override
+ public Class<? extends Annotation> getProcessedAnnotation() {
+ return Validator.class;
+ }
+}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConverterModel.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConverterModel.java 2010-01-14 15:46:34 UTC (rev 16295)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ConverterModel.java 2010-01-14 16:08:21 UTC (rev 16296)
@@ -36,14 +36,14 @@
private String converterId;
- private Class<?> converterClass;
+ private ClassDescription converterClass;
private Class<?> converterForClass;
public ConverterModel() {
}
- public ConverterModel(String converterId, Class<?> converterClass) {
+ public ConverterModel(String converterId, ClassDescription converterClass) {
this.converterId = converterId;
this.converterClass = converterClass;
}
@@ -66,11 +66,11 @@
}
@Merge(false)
- public Class<?> getConverterClass() {
+ public ClassDescription getConverterClass() {
return converterClass;
}
- public void setConverterClass(Class<?> converterClass) {
+ public void setConverterClass(ClassDescription converterClass) {
this.converterClass = converterClass;
}
@@ -82,7 +82,6 @@
@Override
public void merge(ConverterModel other) {
ComponentLibrary.merge(this, other);
-
}
@Override
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ValidatorModel.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ValidatorModel.java 2010-01-14 15:46:34 UTC (rev 16295)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/model/ValidatorModel.java 2010-01-14 16:08:21 UTC (rev 16296)
@@ -21,8 +21,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-
-
package org.richfaces.cdk.model;
import org.richfaces.cdk.CdkException;
@@ -32,58 +30,47 @@
* @author asmirnov(a)exadel.com
*
*/
-@SuppressWarnings("serial")
-public class ValidatorModel implements ModelElement<ValidatorModel> {
- private Type type;
+public class ValidatorModel extends ModelElementBase implements ModelElement<ValidatorModel> {
+ private static final long serialVersionUID = -6097027070372673266L;
- public ValidatorModel() {
+ private String validatorId;
+
+ private ClassDescription validatorClass;
+
+ public ValidatorModel(String validatorId, ClassDescription validatorClass) {
+ setValidatorId(validatorId);
+ setValidatorClass(validatorClass);
}
- /**
- * <p class="changed_added_4_0"></p>
- * @param type the type to set
- */
- public ValidatorModel(Type type) {
- this.type = type;
+ public String getValidatorId() {
+ return validatorId;
}
- @Override
- public <R, P> R accept(LibraryVisitor<R, P> visitor, P param) throws CdkException {
- return visitor.visit(this, param);
+ public void setValidatorId(String validatorId) {
+ this.validatorId = validatorId;
}
- /*
- * (non-Javadoc)
- * @see org.richfaces.cdk.model.ModelElement#getType()
- */
- public Type getType() {
- return type;
+ @Merge(false)
+ public ClassDescription getValidatorClass() {
+ return validatorClass;
}
-
- /**
- * <p class="changed_added_4_0"></p>
- * @param type the type to set
- */
- public void setType(Type type) {
- this.type = type;
+ public void setValidatorClass(ClassDescription validatorClass) {
+ this.validatorClass = validatorClass;
}
@Override
- public void merge(ValidatorModel other) {
+ public <R, P> R accept(LibraryVisitor<R, P> visitor, P param) throws CdkException {
+ return visitor.visit(this, param);
+ }
- // TODO Auto-generated method stub
+ @Override
+ public void merge(ValidatorModel other) {
+ ComponentLibrary.merge(this, other);
}
@Override
public boolean same(ValidatorModel other) {
- return null != getType() && getType().equals(other.getType());
+ return null != getValidatorId() && getValidatorId().equals(other.getValidatorId());
}
-
- public static final class Type extends Key {
- public Type(String name) {
- super(name);
- }
- }
-
}
Modified: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesConfigBean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesConfigBean.java 2010-01-14 15:46:34 UTC (rev 16295)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/FacesConfigBean.java 2010-01-14 16:08:21 UTC (rev 16296)
@@ -37,6 +37,7 @@
import org.richfaces.cdk.model.EventModel;
import org.richfaces.cdk.model.Extensible;
import org.richfaces.cdk.model.ConverterModel;
+import org.richfaces.cdk.model.ValidatorModel;
import com.google.common.collect.Lists;
@@ -59,6 +60,10 @@
@XmlJavaTypeAdapter(ConverterAdapter.class)
private List<ConverterModel> converters = Lists.newArrayList();
+ @XmlElement(name = "validator", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ @XmlJavaTypeAdapter(ValidatorAdapter.class)
+ private List<ValidatorModel> validators = Lists.newArrayList();
+
@XmlAttribute
private String version = "2.0";
@@ -146,6 +151,14 @@
this.converters = converters;
}
+ public List<ValidatorModel> getValidators() {
+ return validators;
+ }
+
+ public void setValidators(List<ValidatorModel> validators) {
+ this.validators = validators;
+ }
+
/**
* <p class="changed_added_4_0"></p>
*
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorAdapter.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorAdapter.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorAdapter.java 2010-01-14 16:08:21 UTC (rev 16296)
@@ -0,0 +1,41 @@
+/**
+ * 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.xmlconfig.model;
+
+import org.richfaces.cdk.model.ValidatorModel;
+
+/**
+ * @author akolonitsky
+ * @since Jan 13, 2010
+ */
+public class ValidatorAdapter extends AdapterBase<ValidatorBean, ValidatorModel>{
+
+ @Override
+ protected Class<? extends ValidatorBean> getBeanClass(ValidatorModel model) {
+ return ValidatorBean.class;
+ }
+
+ @Override
+ protected Class<? extends ValidatorModel> getModelClass(ValidatorBean bean) {
+ return ValidatorModel.class;
+ }
+}
Added: root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorBean.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorBean.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/xmlconfig/model/ValidatorBean.java 2010-01-14 16:08:21 UTC (rev 16296)
@@ -0,0 +1,94 @@
+/**
+ * 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.xmlconfig.model;
+
+import org.richfaces.cdk.model.ConfigExtension;
+import org.richfaces.cdk.model.ComponentLibrary;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import java.util.List;
+
+import com.google.common.collect.Lists;
+
+/**
+ * @author akolonitsky
+ * @since Jan 13, 2010
+ */
+@XmlType(name = "faces-config-validatorType", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE,
+ propOrder={"validatorId", "validatorClass", "attributes", "extension"})
+(a)XmlJavaTypeAdapter(ValidatorAdapter.class)
+public class ValidatorBean extends ExtensibleBean<ValidatorBean.ValidatorExtension> {
+
+ private String validatorId;
+
+ private String validatorClass;
+
+ private List<PropertyBase> attributes = Lists.newArrayList();
+
+ @XmlElement(name = "validator-id", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ public String getValidatorId() {
+ return validatorId;
+ }
+
+ public void setValidatorId(String validatorId) {
+ this.validatorId = validatorId;
+ }
+
+ @XmlElement(name = "validator-class", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ public String getValidatorClass() {
+ return validatorClass;
+ }
+
+ public void setValidatorClass(String validatorClass) {
+ this.validatorClass = validatorClass;
+ }
+
+
+ @XmlElements({
+ @XmlElement(name = "property", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE, type = PropertyBean.class),
+ @XmlElement(name = "attribute", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE, type = AttributeBean.class)
+ })
+ public List<PropertyBase> getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(List<PropertyBase> property) {
+ this.attributes = property;
+ }
+
+ @Override
+ @XmlElement(name = "validator-extension", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE)
+ public ValidatorExtension getExtension() {
+ return super.getExtension();
+ }
+
+ @Override
+ public void setExtension(ValidatorExtension extension) {
+ super.setExtension(extension);
+ }
+
+ public static class ValidatorExtension extends ConfigExtension {
+ }
+}
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestBase.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestBase.java 2010-01-14 15:46:34 UTC (rev 16295)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/CdkTestBase.java 2010-01-14 16:08:21 UTC (rev 16296)
@@ -47,7 +47,7 @@
* @author asmirnov(a)exadel.com
*
*/
-public class CdkTestBase {
+public abstract class CdkTestBase {
protected Iterable<File> testSourceDirectory;
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JaxbTestBase.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JaxbTestBase.java 2010-01-14 15:46:34 UTC (rev 16295)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/JaxbTestBase.java 2010-01-14 16:08:21 UTC (rev 16296)
@@ -1,22 +1,14 @@
package org.richfaces.cdk.xmlconfig;
+import org.richfaces.cdk.CdkTestBase;
+
+import javax.xml.bind.JAXB;
import java.io.ByteArrayOutputStream;
import java.io.StringReader;
-import javax.xml.bind.JAXB;
-
-import org.junit.After;
-import org.junit.Before;
-import org.richfaces.cdk.CdkTestBase;
-
-public class JaxbTestBase extends CdkTestBase {
+public abstract class JaxbTestBase extends CdkTestBase {
protected static final String XML_PROLOG = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
- public JaxbTestBase() {
- super();
- }
-
-
protected <T> T unmarshal(Class<T> type, String src) {
StringBuilder xml = new StringBuilder(XML_PROLOG);
Modified: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.java 2010-01-14 15:46:34 UTC (rev 16295)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.java 2010-01-14 16:08:21 UTC (rev 16296)
@@ -22,12 +22,14 @@
package org.richfaces.cdk.xmlconfig.testmodel;
import org.junit.Test;
+import org.junit.Ignore;
import org.richfaces.cdk.CdkContextBase;
import org.richfaces.cdk.model.ComponentLibrary;
import org.richfaces.cdk.model.ComponentModel;
import org.richfaces.cdk.model.RenderKitModel;
import org.richfaces.cdk.model.RendererModel;
import org.richfaces.cdk.model.ConverterModel;
+import org.richfaces.cdk.model.ClassDescription;
import org.richfaces.cdk.xmlconfig.JAXBBinding;
import org.richfaces.cdk.xmlconfig.FacesConfigGenerator;
import org.richfaces.cdk.xmlconfig.JaxbTestBase;
@@ -40,37 +42,25 @@
* @author akolonitsky
* @since Jan 10, 2010
*/
-public class ConverterBeanTest extends JaxbTestBase {
+public class ConverterBeanTest extends ModelBeanTest {
@Test
public void testMarshalResultStringT() throws Exception {
- CdkContextBase contextBase = new CdkContextBase(createClassLoader());
- JAXBBinding jaxbBinding = new JAXBBinding();
-
- jaxbBinding.init(contextBase);
-
ComponentLibrary library = new ComponentLibrary();
- // add component
ComponentModel component = new ComponentModel( new ComponentModel.Type("foo.bar"));
library.getComponents().add(component);
-
- // add render kit
RenderKitModel renderKit = library.addRenderKit("HTML");
-
- // add renderer
RendererModel renderer = new RendererModel(new RendererModel.Type("foo.Renderer"));
renderKit.getRenderers().add(renderer);
-
- // add converter
- ConverterModel converterModel = new ConverterModel("my_converter", Object.class);
+ ConverterModel converterModel = new ConverterModel("my_converter", new ClassDescription(Object.class));
library.getConverters().add(converterModel);
- StringWriter writer = new StringWriter();
- StreamResult result = new StreamResult(writer);
- FacesConfigAdapter adapter = new FacesConfigAdapter();
+ // Jaxb marshaling
+ StringWriter facesConfig = generateFacesConfig(library);
- jaxbBinding.marshal(result, FacesConfigGenerator.FACES_SCHEMA_LOCATION, adapter.marshal(library));
- System.out.println(writer.toString());
+ // Checks
+ checkXmlStructure(facesConfig);
+// validateXml(facesConfig);
}
}
Added: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ModelBeanTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ModelBeanTest.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ModelBeanTest.java 2010-01-14 16:08:21 UTC (rev 16296)
@@ -0,0 +1,94 @@
+/**
+ * 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.xmlconfig.testmodel;
+
+import org.richfaces.cdk.xmlconfig.JaxbTestBase;
+import org.richfaces.cdk.xmlconfig.JAXBBinding;
+import org.richfaces.cdk.xmlconfig.FacesConfigGenerator;
+import org.richfaces.cdk.xmlconfig.model.FacesConfigAdapter;
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.CdkContextBase;
+import org.xml.sax.SAXException;
+import org.xml.sax.InputSource;
+import org.custommonkey.xmlunit.Validator;
+import org.custommonkey.xmlunit.Diff;
+import org.junit.Assert;
+
+import javax.xml.transform.stream.StreamResult;
+import java.io.StringWriter;
+import java.io.File;
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.InputStreamReader;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.MalformedURLException;
+
+/**
+ * @author akolonitsky
+ * @since Jan 13, 2010
+ */
+public abstract class ModelBeanTest extends JaxbTestBase {
+
+ protected void validateXml(StringWriter facesConfig) throws SAXException {
+ InputSource is = new InputSource(facesConfig.toString());
+ Validator validator = new Validator(is);
+ validator.useXMLSchema(true);
+ File source = null;
+// try {
+// source = null; //new InputStream(new URL(ComponentLibrary.FACES_CONFIG_SCHEMA_LOCATION));
+// } catch (MalformedURLException e) {
+// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+// }
+ if (source == null) {
+ return;
+ }
+ validator.setJAXP12SchemaSource(source);
+
+ validator.assertIsValid();
+ }
+
+ protected void checkXmlStructure(StringWriter writer) throws SAXException, IOException {
+ Class<?> testClass = this.getClass();
+ InputStream expectedFacesConfigFile = testClass.getResourceAsStream(testClass.getSimpleName() + ".xml");
+ if (expectedFacesConfigFile == null) {
+ return;
+ }
+
+ Diff xmlDiff = new Diff(
+ new StringReader(writer.toString()),
+ new InputStreamReader(expectedFacesConfigFile));
+
+ Assert.assertTrue("XML was not similar", xmlDiff.similar());
+ }
+
+ protected StringWriter generateFacesConfig(ComponentLibrary library) throws Exception {
+ StringWriter writer = new StringWriter();
+ StreamResult result = new StreamResult(writer);
+
+ JAXBBinding jaxbBinding = new JAXBBinding();
+ jaxbBinding.init(new CdkContextBase(createClassLoader()));
+ jaxbBinding.marshal(result, FacesConfigGenerator.FACES_SCHEMA_LOCATION,
+ new FacesConfigAdapter().marshal(library));
+ return writer;
+ }
+}
Added: root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.java
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.java (rev 0)
+++ root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.java 2010-01-14 16:08:21 UTC (rev 16296)
@@ -0,0 +1,53 @@
+/**
+ * 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.xmlconfig.testmodel;
+
+import org.junit.Test;
+import org.richfaces.cdk.model.ClassDescription;
+import org.richfaces.cdk.model.ComponentLibrary;
+import org.richfaces.cdk.model.ValidatorModel;
+
+import java.io.StringWriter;
+
+/**
+ * @author akolonitsky
+ * @since Jan 13, 2010
+ */
+public class ValidatorBeanTest extends ModelBeanTest {
+
+ @Test
+ public void testMarshal() throws Exception {
+ ComponentLibrary library = new ComponentLibrary();
+
+ ValidatorModel validatorModel = new ValidatorModel("my_validator", new ClassDescription(Object.class));
+ library.getValidators().add(validatorModel);
+
+ // Jaxb marshaling
+ StringWriter facesConfig = generateFacesConfig(library);
+
+ // Checks
+ checkXmlStructure(facesConfig);
+// validateXml(facesConfig);
+ }
+
+
+}
Added: root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.xml
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.xml (rev 0)
+++ root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ConverterBeanTest.xml 2010-01-14 16:08:21 UTC (rev 16296)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<faces-config metadata-complete="false" version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:cdk="http://richfaces.org/cdk/extensions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <component>
+ <component-type>foo.bar</component-type>
+ <component-extension>
+ <cdk:generate>false</cdk:generate>
+ </component-extension>
+ </component>
+ <converter>
+ <converter-id>my_converter</converter-id>
+ <converter-class>java.lang.Object</converter-class>
+ <converter-extension/>
+ </converter>
+ <faces-config-extension/>
+ <render-kit>
+ <render-kit-id>HTML</render-kit-id>
+ <renderer>
+ <renderer-type>foo.Renderer</renderer-type>
+ <renderer-extension>
+ <cdk:renders-children>false</cdk:renders-children>
+ </renderer-extension>
+ </renderer>
+ <render-kit-extension/>
+ </render-kit>
+</faces-config>
\ No newline at end of file
Added: root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.xml
===================================================================
--- root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.xml (rev 0)
+++ root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/xmlconfig/testmodel/ValidatorBeanTest.xml 2010-01-14 16:08:21 UTC (rev 16296)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<faces-config metadata-complete="false" version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:cdk="http://richfaces.org/cdk/extensions" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <faces-config-extension/>
+ <validator>
+ <validator-id>my_validator</validator-id>
+ <validator-class>java.lang.Object</validator-class>
+ <validator-extension/>
+ </validator>
+</faces-config>
\ No newline at end of file
14 years, 3 months
JBoss Rich Faces SVN: r16295 - branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/renderkit/compiler.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-01-14 10:46:34 -0500 (Thu, 14 Jan 2010)
New Revision: 16295
Modified:
branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/renderkit/compiler/ClassElement.java
Log:
RFPL-227
porting RF-7992 to enterprise branch
Modified: branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/renderkit/compiler/ClassElement.java
===================================================================
--- branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/renderkit/compiler/ClassElement.java 2010-01-14 15:34:15 UTC (rev 16294)
+++ branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/renderkit/compiler/ClassElement.java 2010-01-14 15:46:34 UTC (rev 16295)
@@ -56,7 +56,8 @@
* @see org.ajax4jsf.renderkit.compiler.ElementBase#encode(org.ajax4jsf.renderkit.compiler.TemplateContext)
*/
public void encode(TemplateContext context) throws IOException {
- context.getWriter().writeText(getString(context), null);
+ // To fix https://jira.jboss.org/jira/browse/RF-7992 , writeText was replaced by 'write'
+ context.getWriter().write(getString(context));
}
/**
14 years, 3 months
JBoss Rich Faces SVN: r16294 - in branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf: webapp/nekko and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-01-14 10:34:15 -0500 (Thu, 14 Jan 2010)
New Revision: 16294
Modified:
branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java
branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/io/parser/ParsingStateManager.java
branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java
branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/webapp/tidy/TidyParser.java
Log:
RFPL-237
porting RF-7344 to enterprise branch
Modified: branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java
===================================================================
--- branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java 2010-01-14 15:27:05 UTC (rev 16293)
+++ branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/io/parser/FastHtmlParser.java 2010-01-14 15:34:15 UTC (rev 16294)
@@ -132,6 +132,13 @@
if (log.isDebugEnabled()) {
log.debug("Found <title> element");
}
+ } else if (context.getLastMatched() == stateManager.META) {
+ context.send();
+ haveHead = true;
+ haveHtml = true;
+ if (log.isDebugEnabled()) {
+ log.debug("Found <meta> element");
+ }
} else if (context.getLastMatched() == stateManager.BASE) {
context.send();
haveHead = true;
Modified: branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/io/parser/ParsingStateManager.java
===================================================================
--- branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/io/parser/ParsingStateManager.java 2010-01-14 15:27:05 UTC (rev 16293)
+++ branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/io/parser/ParsingStateManager.java 2010-01-14 15:34:15 UTC (rev 16294)
@@ -99,6 +99,8 @@
ParserState BASE = new KeywordState("base",ELEMENT);
+ ParserState META = new KeywordState("meta",ELEMENT);
+
// Html content
ParserState HTML = new KeywordState("tml",ELEMENT);
@@ -111,7 +113,7 @@
// Inicialize parsing states
DOCUMENT.nextStates = new ParserState[]{LT,DOCUMENT};
// after < possible ! & / or start element
- LT.nextStates = new ParserState[]{EXCLAM,PISTART,CLOSINGELEMENT,H,TITLE,BASE,ELEMENT,DOCUMENT};
+ LT.nextStates = new ParserState[]{EXCLAM,PISTART,CLOSINGELEMENT,H,META,TITLE,BASE,ELEMENT,DOCUMENT};
//
EXCLAM.nextStates = new ParserState[]{COMMENTSTART,CDATASTART,DOCTYPESTART,DOCUMENT};
// doctype declaration
@@ -156,6 +158,7 @@
H.nextStates = new ParserState[]{HEAD,HTML,ENDELEMENT,INELEMENT,ELEMENT,LT,DOCUMENT};
HEAD.nextStates = new ParserState[]{HEAD,ENDELEMENT,INELEMENT,ELEMENT};
HTML.nextStates = new ParserState[]{HTML,ENDELEMENT,INELEMENT,ELEMENT};
+ META.nextStates = new ParserState[]{META,ENDELEMENT,INELEMENT,ELEMENT};
TITLE.nextStates = new ParserState[]{TITLE,ENDELEMENT,INELEMENT,ELEMENT};
BASE.nextStates = new ParserState[]{BASE,ENDELEMENT,INELEMENT,ELEMENT};
}
Modified: branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java
===================================================================
--- branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java 2010-01-14 15:27:05 UTC (rev 16293)
+++ branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/webapp/nekko/NekkoParser.java 2010-01-14 15:34:15 UTC (rev 16294)
@@ -358,6 +358,7 @@
} else if (haveHead) {
// <title> or <base> in the head
if (!("title".equalsIgnoreCase(element.rawname) || "base"
+ .equalsIgnoreCase(element.rawname) || "meta"
.equalsIgnoreCase(element.rawname))) {
insertResources(element.prefix, element.uri);
}
@@ -506,6 +507,7 @@
if (haveHead) {
// <title> or <base> in the head
if (!("title".equalsIgnoreCase(name.rawname) || "base"
+ .equalsIgnoreCase(element.rawname) || "meta"
.equalsIgnoreCase(name.rawname))) {
insertResources(name.prefix, name.uri);
}
Modified: branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/webapp/tidy/TidyParser.java
===================================================================
--- branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/webapp/tidy/TidyParser.java 2010-01-14 15:27:05 UTC (rev 16293)
+++ branches/enterprise/3.3.X/framework/impl/src/main/java/org/ajax4jsf/webapp/tidy/TidyParser.java 2010-01-14 15:34:15 UTC (rev 16294)
@@ -232,6 +232,7 @@
if (child instanceof Element) {
String nodeName = ((Element) child).getNodeName();
if (!("title".equalsIgnoreCase(nodeName) || "base"
+ .equalsIgnoreCase(nodeName) || "meta"
.equalsIgnoreCase(nodeName))) {
break;
}
14 years, 3 months