Author: alexsmirnov
Date: 2010-12-09 21:25:27 -0500 (Thu, 09 Dec 2010)
New Revision: 20490
Added:
branches/RF-8742-1/ui/validator/api/src/main/java/org/richfaces/javascript/Message.java
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/LengthValidatorTest.java
Modified:
branches/RF-8742-1/ui/validator/api/src/main/java/org/richfaces/validator/FacesObjectDescriptor.java
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorImpl.java
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptBase.java
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/validator/BaseFacesObjectDescriptor.java
branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/csv.xml
branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/csv.js
branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/csv.library.properties
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetValidatorTest.java
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/MockTestBase.java
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/ValidatorTestBase.java
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetComponentScriptTest.java
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java
Log:
RESOLVED - issue RF-9217: CSV: development tests for client side(qunit)
https://jira.jboss.org/browse/RF-9217
Added:
branches/RF-8742-1/ui/validator/api/src/main/java/org/richfaces/javascript/Message.java
===================================================================
---
branches/RF-8742-1/ui/validator/api/src/main/java/org/richfaces/javascript/Message.java
(rev 0)
+++
branches/RF-8742-1/ui/validator/api/src/main/java/org/richfaces/javascript/Message.java 2010-12-10
02:25:27 UTC (rev 20490)
@@ -0,0 +1,47 @@
+/**
+ *
+ */
+package org.richfaces.javascript;
+
+import javax.faces.application.FacesMessage;
+
+/**
+ * @author asmirnov
+ *
+ */
+public final class Message {
+
+ private final int severity;
+ private final String detail;
+ private final String summary;
+
+ public Message(int severity,String detail,String summary) {
+ this.severity = severity;
+ this.detail = detail;
+ this.summary = summary;
+ }
+ public Message(FacesMessage msg) {
+ this.severity = msg.getSeverity().getOrdinal();
+ this.summary = msg.getSummary();
+ this.detail = msg.getDetail();
+ }
+ /**
+ * @return the severity
+ */
+ public int getSeverity() {
+ return severity;
+ }
+ /**
+ * @return the detail
+ */
+ public String getDetail() {
+ return detail;
+ }
+ /**
+ * @return the summary
+ */
+ public String getSummary() {
+ return summary;
+ }
+
+}
Property changes on:
branches/RF-8742-1/ui/validator/api/src/main/java/org/richfaces/javascript/Message.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified:
branches/RF-8742-1/ui/validator/api/src/main/java/org/richfaces/validator/FacesObjectDescriptor.java
===================================================================
---
branches/RF-8742-1/ui/validator/api/src/main/java/org/richfaces/validator/FacesObjectDescriptor.java 2010-12-10
01:00:49 UTC (rev 20489)
+++
branches/RF-8742-1/ui/validator/api/src/main/java/org/richfaces/validator/FacesObjectDescriptor.java 2010-12-10
02:25:27 UTC (rev 20490)
@@ -2,8 +2,9 @@
import java.util.Map;
-import javax.faces.application.FacesMessage;
+import org.richfaces.javascript.Message;
+
/**
* <p class="changed_added_4_0">
* Inmlementations of this interface describe JSF or JSR-303 validators. Because JSF
supports 2 types of validators,
@@ -40,5 +41,5 @@
*
* @return
*/
- FacesMessage getMessage();
+ Message getMessage();
}
Modified:
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorImpl.java
===================================================================
---
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorImpl.java 2010-12-10
01:00:49 UTC (rev 20489)
+++
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorImpl.java 2010-12-10
02:25:27 UTC (rev 20490)
@@ -45,6 +45,7 @@
import javax.faces.event.BehaviorEvent;
import javax.faces.render.ClientBehaviorRenderer;
import javax.faces.render.RenderKit;
+import javax.faces.validator.BeanValidator;
import javax.faces.validator.Validator;
import org.richfaces.application.ServiceTracker;
@@ -274,15 +275,18 @@
FacesValidatorService facesValidatorService =
ServiceTracker.getService(facesContext,
FacesValidatorService.class);
for (Validator validator : facesValidators) {
-
validators.add(facesValidatorService.getValidatorDescription(facesContext, validator));
+ if (validator instanceof BeanValidator) {
+ ValueExpression valueExpression =
component.getValueExpression(VALUE);
+ if (null != valueExpression) {
+ BeanValidatorService beanValidatorService =
ServiceTracker.getService(facesContext,
+ BeanValidatorService.class);
+
validators.addAll(beanValidatorService.getConstrains(facesContext, valueExpression,
getGroups()));
+ }
+ } else {
+
validators.add(facesValidatorService.getValidatorDescription(facesContext, validator));
+ }
}
}
- ValueExpression valueExpression = component.getValueExpression(VALUE);
- if (null != valueExpression) {
- BeanValidatorService beanValidatorService =
ServiceTracker.getService(facesContext,
- BeanValidatorService.class);
- validators.addAll(beanValidatorService.getConstrains(facesContext,
valueExpression, getGroups()));
- }
return validators;
} else {
throw new FacesException("Component " +
component.getClass().getName()
Modified:
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptBase.java
===================================================================
---
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptBase.java 2010-12-10
01:00:49 UTC (rev 20489)
+++
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/renderkit/html/ValidatorScriptBase.java 2010-12-10
02:25:27 UTC (rev 20490)
@@ -13,7 +13,7 @@
protected static final String EVENT = "event";
protected static final JSReference EVENT_LITERAL = new JSReference(EVENT);
protected static final String DISABLE_AJAX = "disableAjax";
- protected static final String EOL = "\n;";
+ protected static final String EOL = ";\n";
protected static final String CLIENT_ID = "clientId";
protected static final JSReference CLIENT_ID_LITERAL = new JSReference(CLIENT_ID);
protected static final String SOURCE_ID = "sourceId";
Modified:
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/validator/BaseFacesObjectDescriptor.java
===================================================================
---
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/validator/BaseFacesObjectDescriptor.java 2010-12-10
01:00:49 UTC (rev 20489)
+++
branches/RF-8742-1/ui/validator/ui/src/main/java/org/richfaces/validator/BaseFacesObjectDescriptor.java 2010-12-10
02:25:27 UTC (rev 20490)
@@ -4,6 +4,8 @@
import javax.faces.application.FacesMessage;
+import org.richfaces.javascript.Message;
+
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
@@ -11,12 +13,12 @@
private final Class<? extends T> converterClass;
private Map<String, Object> parameters = Maps.newHashMap();
- private final FacesMessage message;
+ private final Message message;
public BaseFacesObjectDescriptor(Class<? extends T> converterClass,
FacesMessage message) {
this.converterClass = converterClass;
- this.message = message;
+ this.message = new Message(message);
}
public Class<?> getImplementationClass() {
@@ -27,7 +29,7 @@
return parameters;
}
- public FacesMessage getMessage() {
+ public Message getMessage() {
return message;
}
Modified: branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/csv.xml
===================================================================
--- branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/csv.xml 2010-12-10
01:00:49 UTC (rev 20489)
+++ branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/csv.xml 2010-12-10
02:25:27 UTC (rev 20490)
@@ -6,10 +6,6 @@
<name>csv.reslib</name>
<library>org.richfaces</library>
</resource>
- <resource>
- <name>number-converter.js</name>
- <library>org.richfaces</library>
- </resource>
<function>RichFaces.csv.convertNumber</function>
</component>
<component>
@@ -18,10 +14,6 @@
<name>csv.reslib</name>
<library>org.richfaces</library>
</resource>
- <resource>
- <name>length-validator.js</name>
- <library>org.richfaces</library>
- </resource>
<function>RichFaces.csv.validateLength</function>
</component>
</scripts>
\ No newline at end of file
Modified:
branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/csv.js
===================================================================
---
branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/csv.js 2010-12-10
01:00:49 UTC (rev 20489)
+++
branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/resources/org.richfaces/csv.js 2010-12-10
02:25:27 UTC (rev 20490)
@@ -2,38 +2,38 @@
rf.csv = rf.csv || {};
- var _messages = {};
var RE_MESSAGE_PATTERN = /\{(\d+)\}/g;
+ function _interpolateMessage(customMessage, values) {
+ var message = customMessage || "";
+ if (message) {
+ var msgObject =
message.replace(RE_MESSAGE_PATTERN,"\n$1\n").split("\n");
+ var value;
+ for (var i=1; i<msgObject.length; i+=2) {
+ value = values[msgObject[i]];
+ msgObject[i] = typeof value == "undefined" ? "" : value;
+ }
+ message = msgObject.join('');
+ }
+ return message;
+ }
+
$.extend(rf.csv, {
RE_DIGITS: /^-?\d+$/,
RE_FLOAT: /^(-?\d+)?(\.(\d+)?(e[+-]?\d+)?)?$/,
MESSAGE_EVENT_NAME: "onmessage."+rf.Event.RICH_NAMESPACE,
// Messages API
- addMessage: function (messagesObject) {
- $.extend(_messages, messagesObject);
+ getMessage :function(facesMessage,values){
+ return
{detail:_interpolateMessage(facesMessage.detail,values),summary:_interpolateMessage(facesMessage.summary,values)};
},
- getMessage: function(customMessage, messageId, values) {
- var message = customMessage || _messages[messageId] || "";
- if (message) {
- var msgObject =
message.replace(RE_MESSAGE_PATTERN,"\n$1\n").split("\n");
- var value;
- for (var i=1; i<msgObject.length; i+=2) {
- value = values[msgObject[i]];
- msgObject[i] = typeof value == "undefined" ? "" : value;
- }
- message = msgObject.join('');
- }
- return {message:message};
- },
sendMessage: function (componentId, message) {
- rf.Event.fireById(document, MESSAGE_EVENT_NAME, message);
- rf.Event.fireById(componentId, MESSAGE_EVENT_NAME, message);
+ rf.Event.fireById(document, rf.csv.MESSAGE_EVENT_NAME, message);
+ rf.Event.fireById(componentId, rf.csv.MESSAGE_EVENT_NAME, message);
},
clearMessage: function (componentId) {
- rf.Event.fireById(document, MESSAGE_EVENT_NAME, message);
- rf.Event.fireById(componentId, MESSAGE_EVENT_NAME, message);
+ rf.Event.fireById(document, rf.csv.MESSAGE_EVENT_NAME, message);
+ rf.Event.fireById(componentId, rf.csv.MESSAGE_EVENT_NAME, message);
},
getValue: function (clientId, element){
var value;
@@ -82,6 +82,16 @@
result = value=='true' ? true : value.length<1 ? null : false;
return result;
},
+ // Validators
+ validateLength: function(value,message,params){
+ if (params.maximum && value.length > params.maximum) {
+ throw rf.csv.getMessage(message, [params.minimum,params.maximum]);
+ }
+ if (params.minimum && value.length < params.minimum) {
+ throw rf.csv.getMessage(message, [params.minimum,params.maximum]);
+ }
+
+ },
addFormValidators: function (formId, callValidatorFunctions) {
}
Modified:
branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/csv.library.properties
===================================================================
---
branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/csv.library.properties 2010-12-10
01:00:49 UTC (rev 20489)
+++
branches/RF-8742-1/ui/validator/ui/src/main/resources/META-INF/richfaces/org.richfaces/csv.library.properties 2010-12-10
02:25:27 UTC (rev 20490)
@@ -1 +1 @@
-resources=jquery.js, richfaces.js, richfaces-event.js, org.richfaces:richfaces-csv.js
\ No newline at end of file
+resources=jquery.js, richfaces.js, richfaces-event.js, org.richfaces:csv.js
\ No newline at end of file
Modified:
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetValidatorTest.java
===================================================================
---
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetValidatorTest.java 2010-12-10
01:00:49 UTC (rev 20489)
+++
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetValidatorTest.java 2010-12-10
02:25:27 UTC (rev 20490)
@@ -5,10 +5,11 @@
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
+import java.util.Arrays;
import java.util.Collection;
import javax.el.ValueExpression;
-import javax.faces.application.FacesMessage;
+import javax.faces.validator.BeanValidator;
import javax.faces.validator.Validator;
import javax.validation.groups.Default;
@@ -20,6 +21,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.richfaces.application.ServiceTracker;
+import org.richfaces.javascript.Message;
import org.richfaces.validator.BeanValidatorService;
import org.richfaces.validator.FacesValidatorService;
import org.richfaces.validator.ValidatorDescriptor;
@@ -39,7 +41,7 @@
@RunWith(MockTestRunner.class)
public class BehaviorGetValidatorTest extends BehaviorTestBase {
- private static final FacesMessage VALIDATION_ERROR = new
FacesMessage("Validation Error");
+ private static final Message VALIDATION_ERROR = new
Message(3,"Error","Validation Error");
private static final Class<?>[] DEFAULT_GROUP = { Default.class };
@@ -96,6 +98,7 @@
}
private void setupBeanValidator(ValidatorDescriptor... validators) {
+ expect(input.getValidators()).andStubReturn(new Validator[]{new
BeanValidator()});
expect(validatorService.getConstrains(environment.getFacesContext(), expression,
DEFAULT_GROUP)).andStubReturn(
Lists.newArrayList(validators));
@@ -133,7 +136,6 @@
@Test
public void testBeanValidators() throws Exception {
- setupComponentValidator();
setupBeanValidator(beanValidatorDescriptor);
Collection<ValidatorDescriptor> validators = checkValidator();
assertEquals(1, validators.size());
Modified:
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/MockTestBase.java
===================================================================
---
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/MockTestBase.java 2010-12-10
01:00:49 UTC (rev 20489)
+++
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/MockTestBase.java 2010-12-10
02:25:27 UTC (rev 20490)
@@ -12,6 +12,7 @@
import org.junit.Rule;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.richfaces.javascript.Message;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableList.Builder;
@@ -34,11 +35,17 @@
@Before
public void setUp() {
- this.facesEnvironment = MockFacesEnvironment.createEnvironment();
+ this.facesEnvironment =
MockFacesEnvironment.createEnvironment().withApplication().resetToNice();
component = facesEnvironment.createMock(UIComponent.class);
+ recordMocks();
facesEnvironment.replay();
}
+ protected void recordMocks() {
+ // template method to record mock objects
+
+ }
+
@After
public void tearDown() {
this.facesEnvironment.verify();
@@ -46,8 +53,8 @@
this.facesEnvironment = null;
}
- protected Object getErrorMessage() {
- return ImmutableMap.of("detail","error");
+ protected Message getErrorMessage() {
+ return new Message(2,"error","script error");
}
protected Object getJavaScriptOptions() {
Added:
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/LengthValidatorTest.java
===================================================================
---
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/LengthValidatorTest.java
(rev 0)
+++
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/LengthValidatorTest.java 2010-12-10
02:25:27 UTC (rev 20490)
@@ -0,0 +1,63 @@
+/**
+ *
+ */
+package org.richfaces.javascript.client.validator;
+
+import static org.easymock.EasyMock.anyObject;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.validator.LengthValidator;
+import javax.faces.validator.Validator;
+
+import org.junit.runners.Parameterized.Parameters;
+import org.richfaces.javascript.client.TestCriteria;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class LengthValidatorTest extends ValidatorTestBase {
+
+ private static final String MINIMUM = "minimum";
+ private static final String MAXIMUM = "maximum";
+ /**
+ * @param criteria
+ */
+ public LengthValidatorTest(TestCriteria criteria) {
+ super(criteria);
+ }
+
+ /* (non-Javadoc)
+ * @see
org.richfaces.javascript.client.validator.ValidatorTestBase#createValidator()
+ */
+ @Override
+ protected Validator createValidator() {
+ LengthValidator validator = new LengthValidator();
+ Map<String, Object> options = criteria.getOptions();
+ if(options.containsKey(MINIMUM)){
+ validator.setMinimum((Integer) options.get(MINIMUM));
+ }
+ if(options.containsKey(MAXIMUM)){
+ validator.setMaximum((Integer) options.get(MAXIMUM));
+ }
+ return validator;
+ }
+
+ /* (non-Javadoc)
+ * @see org.richfaces.javascript.client.MockTestBase#getJavaScriptFunctionName()
+ */
+ @Override
+ protected String getJavaScriptFunctionName() {
+ return "validateLength";
+ }
+
+ @Parameters
+ public static List<TestCriteria[]> parameters() {
+ return options(pass(""),pass("aaa"),pass("123"),
+
pass("",MINIMUM,2),pass("vv",MINIMUM,2),pass("vvv",MINIMUM,2),
+
pass("",MAXIMUM,2),pass("vv",MAXIMUM,2),pass("123",MAXIMUM,2),
+
pass("",MINIMUM,3,MAXIMUM,5),pass("ddd",MINIMUM,3,MAXIMUM,5),pass("dddd",MINIMUM,3,MAXIMUM,5),pass("abcdefg",MINIMUM,3,MAXIMUM,5));
+ }
+}
Property changes on:
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/LengthValidatorTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified:
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/ValidatorTestBase.java
===================================================================
---
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/ValidatorTestBase.java 2010-12-10
01:00:49 UTC (rev 20489)
+++
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/javascript/client/validator/ValidatorTestBase.java 2010-12-10
02:25:27 UTC (rev 20490)
@@ -1,17 +1,42 @@
package org.richfaces.javascript.client.validator;
+import static org.easymock.EasyMock.expect;
import static org.junit.Assert.*;
+import java.util.Collections;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
import javax.validation.ValidationException;
+
+import net.sourceforge.htmlunit.corejs.javascript.JavaScriptException;
+import net.sourceforge.htmlunit.corejs.javascript.NativeObject;
+
+import org.ajax4jsf.javascript.JSFunction;
import org.junit.Test;
import org.richfaces.javascript.client.MockTestBase;
import org.richfaces.javascript.client.TestCriteria;
+import com.gargoylesoftware.htmlunit.ScriptException;
+
public abstract class ValidatorTestBase extends MockTestBase {
+ private static final Converter NUMBER_CONVERTER = new Converter() {
+
+ public String getAsString(FacesContext context, UIComponent component, Object
value) {
+
+ return String.valueOf(value);
+ }
+
+ public Object getAsObject(FacesContext context, UIComponent component, String
value) {
+ return Double.valueOf(value);
+ }
+ };
+
public ValidatorTestBase(TestCriteria criteria) {
super(criteria);
}
@@ -28,15 +53,31 @@
try {
validateOnClient();
assertFalse("JSF validator throws exception for value:
"+criteria.getValue(),true);
- } catch (Exception e2) {
+ } catch (ScriptException e2) {
// both methods throws exceptions - it's ok.
+ e2.printStackTrace();
+ Throwable cause = e2.getCause();
+ assertTrue(cause instanceof JavaScriptException);
+ NativeObject value = (NativeObject)
((JavaScriptException)cause).getValue();
+ assertEquals(getErrorMessage().getDetail(),
value.get("detail"));
}
}
}
- protected void validateOnClient() throws ValidationException {
-
+ protected Object validateOnClient() throws ValidationException {
+ JSFunction clientSideFunction = new JSFunction("RichFaces.csv." +
getJavaScriptFunctionName(),criteria.getValue(),getErrorMessage(),getJavaScriptOptions());
+ return qunit.runScript(clientSideFunction.toScript());
+
}
protected abstract Validator createValidator();
+
+
+ @Override
+ protected void recordMocks() {
+ super.recordMocks();
+ expect(component.getAttributes()).andStubReturn(Collections.EMPTY_MAP);
+
expect(component.getClientId(facesEnvironment.getFacesContext())).andStubReturn("testComponent");
+
expect(facesEnvironment.getApplication().createConverter("javax.faces.Number")).andStubReturn(NUMBER_CONVERTER);
+ }
}
Modified:
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetComponentScriptTest.java
===================================================================
---
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetComponentScriptTest.java 2010-12-10
01:00:49 UTC (rev 20489)
+++
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererGetComponentScriptTest.java 2010-12-10
02:25:27 UTC (rev 20490)
@@ -200,11 +200,11 @@
}
private LibraryScriptFunction createValidatorFunction() {
- return createFunction(REGEX_VALIDATOR,
ClientValidatorRenderer.CONVERTED_VALUE_VAR, VALIDATOR_MESSAGE);
+ return createFunction(REGEX_VALIDATOR,
ClientValidatorRenderer.CONVERTED_VALUE_VAR, FACES_VALIDATOR_MESSAGE);
}
private LibraryScriptFunction createConverterFunction() {
- return createFunction(NUMBER_CONVERTER, ClientValidatorRenderer.VALUE_VAR,
VALIDATOR_MESSAGE);
+ return createFunction(NUMBER_CONVERTER, ClientValidatorRenderer.VALUE_VAR,
FACES_VALIDATOR_MESSAGE);
}
private LibraryScriptFunction createFunction(final String name, String var,
FacesMessage validatorMessage) {
Modified:
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java
===================================================================
---
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java 2010-12-10
01:00:49 UTC (rev 20489)
+++
branches/RF-8742-1/ui/validator/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java 2010-12-10
02:25:27 UTC (rev 20490)
@@ -8,6 +8,7 @@
import org.jboss.test.faces.mock.Mock;
import org.richfaces.component.behavior.BehaviorTestBase;
import org.richfaces.component.behavior.ClientValidatorBehavior;
+import org.richfaces.javascript.Message;
import org.richfaces.resource.ResourceKey;
import com.google.common.collect.ImmutableMap;
@@ -17,7 +18,8 @@
protected static final String CLIENT_VALIDATORS_JS =
"clientValidators.js";
protected static final String ORG_RICHFACES = "org.richfaces";
protected static final String REGEX_VALIDATOR = "regexValidator";
- protected static final FacesMessage VALIDATOR_MESSAGE = new
FacesMessage("Validator Message");
+ protected static final FacesMessage FACES_VALIDATOR_MESSAGE = new
FacesMessage("Validator Message");
+ protected static final Message VALIDATOR_MESSAGE = new
Message(FACES_VALIDATOR_MESSAGE);
protected static final Map<String, ? extends Object> VALIDATOR_PARAMS =
ImmutableMap.of("foo", "value", "bar", 10);
protected static final Iterable<ResourceKey> CLIENT_VALIDATOR_LIBRARY =
Collections.singleton(ResourceKey.create(CLIENT_VALIDATORS_JS,ORG_RICHFACES));