Author: alexsmirnov
Date: 2010-10-13 19:44:25 -0400 (Wed, 13 Oct 2010)
New Revision: 19563
Added:
branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ValidatorLookup.java
branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/behavior/AjaxBehaviorWrapper.java
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetConverterTest.java
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetValidatorTest.java
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorTestBase.java
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/GetScriptTest.java
Removed:
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/ClientValidatorBehaviorTest.java
Modified:
branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorBehavior.java
branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorImpl.java
Log:
OPEN - issue RF-9506: ClientValidatorBehavior unit tests and implementation.
https://jira.jboss.org/browse/RF-9506
Added:
branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ValidatorLookup.java
===================================================================
---
branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ValidatorLookup.java
(rev 0)
+++
branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ValidatorLookup.java 2010-10-13
23:44:25 UTC (rev 19563)
@@ -0,0 +1,25 @@
+package org.richfaces.validator;
+
+import java.util.Collection;
+
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+import javax.validation.metadata.ConstraintDescriptor;
+
+/**
+ * <p class="changed_added_4_0">This interface describes service that
gets Bean Validator constrains for EL-expressions</p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public interface ValidatorLookup {
+
+ /**
+ * <p class="changed_added_4_0">Get all constrains for given
EL-expression</p>
+ * @param context
+ * @param expression
+ * @return
+ */
+ Iterable<ConstraintDescriptor<?>> getConstrains(FacesContext context,
ValueExpression expression);
+
+ Collection<String> validateExpression(FacesContext context,ValueExpression
expression, Object newValue);
+}
Property changes on:
branches/RF-8742/ui/validator/api/src/main/java/org/richfaces/validator/ValidatorLookup.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/behavior/AjaxBehaviorWrapper.java
===================================================================
---
branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/behavior/AjaxBehaviorWrapper.java
(rev 0)
+++
branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/behavior/AjaxBehaviorWrapper.java 2010-10-13
23:44:25 UTC (rev 19563)
@@ -0,0 +1,17 @@
+package org.richfaces.component.behavior;
+
+import javax.faces.component.behavior.ClientBehaviorBase;
+import javax.faces.component.behavior.ClientBehaviorContext;
+
+public class AjaxBehaviorWrapper extends ClientBehaviorBase {
+
+ public AjaxBehaviorWrapper() {
+ super();
+ }
+
+ public String getAjaxScript(ClientBehaviorContext context) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
\ No newline at end of file
Property changes on:
branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/behavior/AjaxBehaviorWrapper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorBehavior.java
===================================================================
---
branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorBehavior.java 2010-10-13
22:25:05 UTC (rev 19562)
+++
branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorBehavior.java 2010-10-13
23:44:25 UTC (rev 19563)
@@ -2,32 +2,33 @@
import java.util.Collection;
-import javax.faces.component.UIMessage;
import javax.faces.component.behavior.ClientBehavior;
import javax.faces.component.behavior.ClientBehaviorContext;
import javax.faces.convert.Converter;
+/**
+ * <p class="changed_added_4_0">Interface for JSF Behavior that creates
scripts for client-side validation</p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
public interface ClientValidatorBehavior extends ClientBehavior {
+
+ public static final String BEHAVIOR_TYPE =
"org.richfaces.behavior.ClientValidator";
+
/**
- * <p class="changed_added_4_0">
- * This method looks up all {@link UIMessage} components associated with input for
which this behavior belongs to
- * </p>
- *
+ * <p class="changed_added_4_0">Get JavaScript code for AJAX
request.</p>
* @param context
- * @return non-null collection of {@link UIMessage} components associated with target
input.
- * @throws MessageNotFoundException
- * if no {@link UIMessage} component points to target UIInput and no
UIMessages found on page.
+ * @return
*/
- Collection<UIMessage> findMessages(ClientBehaviorContext context) throws
MessageNotFoundException;
-
+ String getAjaxScript(ClientBehaviorContext context);
/**
* <p class="changed_added_4_0">
* Look up for converter associated with target UIInput
* </p>
*
* @param context
- * @return
+ * @return {@link Converter} instance or null if conversion not required.
*/
Converter getConverter(ClientBehaviorContext context) throws
ConverterNotFoundException;
Modified:
branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorImpl.java
===================================================================
---
branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorImpl.java 2010-10-13
22:25:05 UTC (rev 19562)
+++
branches/RF-8742/ui/validator/ui/src/main/java/org/richfaces/component/behavior/ClientValidatorImpl.java 2010-10-13
23:44:25 UTC (rev 19563)
@@ -28,8 +28,7 @@
import javax.faces.FacesException;
import javax.faces.component.ActionSource;
import javax.faces.component.EditableValueHolder;
-import javax.faces.component.UIMessage;
-import javax.faces.component.behavior.ClientBehaviorBase;
+import javax.faces.component.behavior.AjaxBehavior;
import javax.faces.component.behavior.ClientBehaviorContext;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
@@ -48,11 +47,11 @@
* @author asmirnov(a)exadel.com
*
*/
-public class ClientValidatorImpl extends ClientBehaviorBase implements
ClientValidatorBehavior {
+public class ClientValidatorImpl extends AjaxBehaviorWrapper implements
ClientValidatorBehavior {
- public static final String BEHAVIOR_TYPE =
"org.richfaces.behavior.ClientValidator";
-
private static final Logger LOG = RichfacesLogger.COMPONENTS.getLogger();
+
+ private AjaxBehavior ajaxBehavior;
@Override
public String getScript(ClientBehaviorContext behaviorContext) {
@@ -101,15 +100,6 @@
return renderer;
}
- /*
- * (non-Javadoc)
- *
- * @see
org.richfaces.component.behavior.ClientValidatorBehavior#findMessages(javax.faces.component.behavior.
- * ClientBehaviorContext)
- */
- public Collection<UIMessage> findMessages(ClientBehaviorContext context) throws
MessageNotFoundException {
- return Collections.emptySet();
- }
/*
* (non-Javadoc)
Copied:
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetConverterTest.java
(from rev 19557,
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/ClientValidatorBehaviorTest.java)
===================================================================
---
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetConverterTest.java
(rev 0)
+++
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetConverterTest.java 2010-10-13
23:44:25 UTC (rev 19563)
@@ -0,0 +1,82 @@
+package org.richfaces.component.behavior;
+import static org.easymock.EasyMock.*;
+import static org.junit.Assert.*;
+
+import javax.faces.convert.Converter;
+import javax.faces.convert.NumberConverter;
+
+import org.jboss.test.faces.mock.Mock;
+import org.jboss.test.faces.mock.MockTestRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+/**
+ * <p class="changed_added_4_0">This class tests client validator
behavior.
+ * as it described at
https://community.jboss.org/wiki/ClientSideValidation # Server-side
rendering algorithm</p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+(a)RunWith(MockTestRunner.class)
+public class BehaviorGetConverterTest extends BehaviorTestBase {
+
+
+ @Mock
+ private Converter converter;
+
+ /**
+ * <p class="changed_added_4_0">Server-side rendering algorithm .3 -
determine client-side converter</p>
+ * @throws Exception
+ */
+ @Test
+ public void testGetClientConverterFromComponent() throws Exception {
+ NumberConverter converter = new NumberConverter();
+ expect(input.getConverter()).andReturn(converter);
+ checkConverter(converter);
+ }
+
+ /**
+ * <p class="changed_added_4_0">Server-side rendering algorithm .3 -
determine client-side converter</p>
+ * @throws Exception
+ */
+ @Test
+ public void testGetClientConverterByType() throws Exception {
+ setupConverterFromApplication(converter);
+ checkConverter(converter);
+ }
+
+ private void setupConverterFromApplication(Converter converter) {
+ expect(input.getConverter()).andReturn(null);
+ expect(input.getValueExpression("value")).andReturn(expression);
+
expect((Class)(expression.getType(environment.getElContext()))).andReturn(Number.class);
+
expect(environment.getApplication().createConverter(Number.class)).andReturn(converter);
+ }
+
+ @Test(expected=ConverterNotFoundException.class)
+ public void testGetConverterNotExists() throws Exception {
+ setupConverterFromApplication(null);
+ checkConverter(null);
+ }
+
+ @Test
+ public void testSetConverterForString() throws Exception {
+ expect(input.getConverter()).andReturn(null);
+ expect(input.getValueExpression("value")).andReturn(expression);
+
expect((Class)(expression.getType(environment.getElContext()))).andReturn(String.class);
+ checkConverter(null);
+ }
+
+ private void checkConverter(Converter converter) throws ConverterNotFoundException {
+ setupBehaviorContext(input);
+ controller.replay();
+ Converter converter2 = behavior.getConverter(behaviorContext);
+ controller.verify();
+ if(null == converter){
+ assertNull(converter2);
+ } else {
+ assertSame(converter,converter2);
+ }
+ }
+
+
+}
Added:
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetValidatorTest.java
===================================================================
---
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetValidatorTest.java
(rev 0)
+++
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetValidatorTest.java 2010-10-13
23:44:25 UTC (rev 19563)
@@ -0,0 +1,51 @@
+package org.richfaces.component.behavior;
+import javax.faces.validator.Validator;
+
+import org.jboss.test.faces.mock.Mock;
+import org.jboss.test.faces.mock.MockTestRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+/**
+ * <p class="changed_added_4_0">This class tests client validator
behavior.
+ * as it described at
https://community.jboss.org/wiki/ClientSideValidation # Server-side
rendering algorithm</p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+(a)RunWith(MockTestRunner.class)
+public class BehaviorGetValidatorTest extends BehaviorTestBase {
+
+
+ @Mock
+ private Validator validator;
+ /**
+ * <p class="changed_added_4_0">Component does not define any
validators.</p>
+ * @throws Exception
+ */
+ @Test
+ public void testEmptyValidators() throws Exception {
+ setupComponentValidator(null);
+ setupBeanValidator(null);
+ checkValidator();
+ }
+
+ private void setupComponentValidator(Validator validator) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * <p class="changed_added_4_0">Component defines JSF validator
only.</p>
+ * @throws Exception
+ */
+ @Test
+ public void testComponentValidator() throws Exception {
+
+ }
+
+ @Test
+ public void testBeanValidators() throws Exception {
+
+ }
+}
Property changes on:
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorGetValidatorTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorTestBase.java
===================================================================
---
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorTestBase.java
(rev 0)
+++
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorTestBase.java 2010-10-13
23:44:25 UTC (rev 19563)
@@ -0,0 +1,53 @@
+package org.richfaces.component.behavior;
+
+import static org.easymock.EasyMock.*;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
+import javax.faces.component.behavior.ClientBehaviorContext;
+import javax.faces.render.ClientBehaviorRenderer;
+
+import org.jboss.test.faces.mock.Environment;
+import org.jboss.test.faces.mock.Environment.Feature;
+import org.jboss.test.faces.mock.Mock;
+import org.jboss.test.faces.mock.MockController;
+import org.jboss.test.faces.mock.MockFacesEnvironment;
+import org.junit.Before;
+
+public class BehaviorTestBase {
+
+ @Mock()
+ @Environment({ Feature.APPLICATION, Feature.RENDER_KIT })
+ protected MockFacesEnvironment environment;
+ @Mock
+ protected UIInput input;
+ @Mock
+ protected ClientBehaviorContext behaviorContext;
+ @Mock
+ protected ClientBehaviorRenderer behaviorRenderer;
+ protected MockController controller;
+ protected ClientValidatorImpl behavior;
+ @Mock
+ protected ValueExpression expression;
+
+ public BehaviorTestBase() {
+ super();
+ }
+
+ @Before
+ public void setUp() {
+ behavior = createBehavior();
+ }
+
+ protected ClientBehaviorContext setupBehaviorContext(UIComponent component) {
+ expect(behaviorContext.getComponent()).andStubReturn(component);
+
expect(behaviorContext.getFacesContext()).andStubReturn(environment.getFacesContext());
+ return behaviorContext;
+ }
+
+ private ClientValidatorImpl createBehavior() {
+ return new ClientValidatorImpl();
+ }
+
+}
\ No newline at end of file
Property changes on:
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/BehaviorTestBase.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/ClientValidatorBehaviorTest.java
===================================================================
---
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/ClientValidatorBehaviorTest.java 2010-10-13
22:25:05 UTC (rev 19562)
+++
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/ClientValidatorBehaviorTest.java 2010-10-13
23:44:25 UTC (rev 19563)
@@ -1,178 +0,0 @@
-package org.richfaces.component.behavior;
-import static org.easymock.EasyMock.*;
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.faces.FacesException;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIInput;
-import javax.faces.component.UIOutput;
-import javax.faces.component.UIViewRoot;
-import javax.faces.component.behavior.ClientBehaviorContext;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-
-import org.jboss.test.faces.mock.Environment;
-import org.jboss.test.faces.mock.Environment.Feature;
-import org.jboss.test.faces.mock.Mock;
-import org.jboss.test.faces.mock.MockController;
-import org.jboss.test.faces.mock.MockFacesEnvironment;
-import org.jboss.test.faces.mock.MockTestRunner;
-import org.jboss.test.faces.mock.Stub;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.richfaces.component.mock.MockUIForm;
-import org.richfaces.component.mock.MockUIMessage;
-
-
-/**
- * <p class="changed_added_4_0">This class tests client validator
behavior.
- * as it described at
https://community.jboss.org/wiki/ClientSideValidation # Server-side
rendering algorithm</p>
- * @author asmirnov(a)exadel.com
- *
- */
-(a)RunWith(MockTestRunner.class)
-public class ClientValidatorBehaviorTest {
-
- private final class DummyConverter implements Converter {
- public String getAsString(FacesContext context, UIComponent component, Object
value) {
- return value.toString();
- }
-
- public Object getAsObject(FacesContext context, UIComponent component, String
value) {
- return value;
- }
- }
-
- private static final String CLIENT_VALIDATION_FUNCTION = "rf.csv.v";
-
- private static final String FORM_ID = "formId";
-
- private static final String INPUT_ID = "inputId";
-
- private static final String MESSAGE_ID = "messageId";
-
- @Stub
- protected UIOutput output;
-
- @Mock()
- @Environment({Feature.APPLICATION})
- protected MockFacesEnvironment environment;
-
- @Mock
- protected UIInput input;
-
- @Mock
- protected UIViewRoot root;
-
- @Mock
- protected MockUIForm form;
-
- @Mock
- protected MockUIMessage message;
-
- @Mock
- protected ClientBehaviorContext behaviorContext;
-
- protected MockController controller;
-
- protected ClientValidatorImpl behavior;
-
- @Before
- public void setUp() {
- behavior = createBehavior();
- }
-
- /**
- * <p class="changed_added_4_0">Server-side rendering algorithm
.1</p>
- */
- @Test(expected=FacesException.class)
- public void testGetScriptForIllegalComponent() {
- getScript(output);
- }
-
- /**
- * <p class="changed_added_4_0">Server-side rendering algorithm
.2</p>
- * @throws Exception
- */
- @Test
- public void testGetScriptWithoutMessageComponent() throws Exception {
- buildForm(false);
- assertEquals(0, getScript(input).length());
- }
-
- /**
- * <p class="changed_added_4_0">Server-side rendering algorithm .3 -
determine client-side converter</p>
- * @throws Exception
- */
- @Test
- public void testGetClientConverter() throws Exception {
-
- }
- /**
- * <p class="changed_added_4_0">Server-side rendering algorithm
.3</p>
- * @throws Exception
- */
- @Test
- public void testGetScriptWithoutClientConverter() throws Exception {
- buildForm(true);
- expect(input.getConverter()).andStubReturn(new DummyConverter());
- String script = getScript(input);// ajax-only validator.
- assertFalse(script.contains(CLIENT_VALIDATION_FUNCTION));
- }
-
- /**
- * <p class="changed_added_4_0">Server-side rendering algorithm
.3</p>
- * @throws Exception
- */
- @Test
- public void testGetScriptWithClientConverter() throws Exception {
-
- }
-
- private String getScript(UIComponent component) {
- ClientBehaviorContext clientBehaviorContext = setupBehaviorContext(component);
- controller.replay();
- String script = behavior.getScript(clientBehaviorContext);
- controller.verify();
- return script;
- }
-
- private ClientBehaviorContext setupBehaviorContext(UIComponent component) {
- expect(behaviorContext.getComponent()).andStubReturn(component);
-
expect(behaviorContext.getFacesContext()).andStubReturn(environment.getFacesContext());
- return behaviorContext;
- }
-
- private void buildForm(boolean withMessage) {
- expect(environment.getFacesContext().getViewRoot()).andStubReturn(root);
- expect(form.getId()).andStubReturn(FORM_ID);
- List<UIComponent> formChildren = new ArrayList<UIComponent>();
- expect(form.getChildren()).andStubReturn(formChildren);
- expect(input.getId()).andStubReturn(INPUT_ID);
- expect(input.getParent()).andStubReturn(form);
- formChildren.add(input);
- expect(output.getParent()).andStubReturn(form);
- formChildren.add(output);
- if(withMessage){
- expect(message.getId()).andStubReturn(MESSAGE_ID);
- expect(message.getFor()).andStubReturn(INPUT_ID);
- expect(message.getParent()).andStubReturn(form);
- formChildren.add(message);
- }
-// root.getChildren().add(form);
- }
-
- private ClientValidatorImpl createBehavior() {
- return new ClientValidatorImpl();
- }
-
- @Test
- public void testDecode() {
- fail("Not yet implemented");
- }
-
-}
Added:
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/GetScriptTest.java
===================================================================
---
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/GetScriptTest.java
(rev 0)
+++
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/GetScriptTest.java 2010-10-13
23:44:25 UTC (rev 19563)
@@ -0,0 +1,86 @@
+package org.richfaces.component.behavior;
+import static org.easymock.EasyMock.*;
+import static org.junit.Assert.*;
+
+import javax.faces.FacesException;
+import javax.faces.component.UICommand;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIOutput;
+import javax.faces.component.behavior.ClientBehaviorContext;
+import javax.faces.render.RenderKit;
+
+import org.jboss.test.faces.mock.Mock;
+import org.jboss.test.faces.mock.MockTestRunner;
+import org.jboss.test.faces.mock.Stub;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.richfaces.renderkit.html.ClientValidatorRenderer;
+import org.richfaces.renderkit.html.FormClientValidatorRenderer;
+
+
+/**
+ * <p class="changed_added_4_0">This class tests client validator
behavior.
+ * as it described at
https://community.jboss.org/wiki/ClientSideValidation # Server-side
rendering algorithm</p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+(a)RunWith(MockTestRunner.class)
+public class GetScriptTest extends BehaviorTestBase {
+
+
+ private static final String CLIENT_VALIDATION_FUNCTION = "rf.csv.v";
+
+
+
+ @Stub
+ protected UIOutput output;
+
+ @Mock
+ protected UICommand command;
+
+ /**
+ * <p class="changed_added_4_0">Server-side rendering algorithm
.1</p>
+ */
+ @Test(expected=FacesException.class)
+ public void testGetScriptForIllegalComponent() {
+ getScript(output);
+ }
+
+
+ /**
+ * <p class="changed_added_4_0">Delegate getScript call to
ClientValidatorRenderer</p>
+ * @throws Exception
+ */
+ @Test
+ public void testGetScriptForInput() throws Exception {
+ testGetScriptDelegate(ClientValidatorRenderer.RENDERER_TYPE, input);
+ }
+
+ /**
+ * <p class="changed_added_4_0">Server-side rendering algorithm
.3</p>
+ * @throws Exception
+ */
+ @Test
+ public void testGetScriptForAction() throws Exception {
+ testGetScriptDelegate(FormClientValidatorRenderer.RENDERER_TYPE, command);
+ }
+
+ private void testGetScriptDelegate(String rendererType, UIComponent component) {
+ RenderKit renderKit = environment.getRenderKit();
+
expect(renderKit.getClientBehaviorRenderer(rendererType)).andReturn(behaviorRenderer);
+ expect(behaviorRenderer.getScript(behaviorContext,
behavior)).andReturn(CLIENT_VALIDATION_FUNCTION);
+ String script = getScript(component);// ajax-only validator.
+ assertEquals(CLIENT_VALIDATION_FUNCTION,script);
+ }
+
+ private String getScript(UIComponent component) {
+ ClientBehaviorContext clientBehaviorContext = setupBehaviorContext(component);
+ controller.replay();
+ String script = behavior.getScript(clientBehaviorContext);
+ controller.verify();
+ return script;
+ }
+
+
+
+}
Property changes on:
branches/RF-8742/ui/validator/ui/src/test/java/org/richfaces/component/behavior/GetScriptTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain