Hi,

what will be the differences between myfaces-webapptest and myfaces-test?

Tom


----- Original Nachricht ----
Von:     Gerhard <gerhard.petra...@gmail.com>
An:      MyFaces Discussion <users@myfaces.apache.org>
Datum:   10.09.2010 12:15
Betreff: Re: How to test custom ExtVal constrains with new Myfaces Test

> hi tom,
> 
> i haven?t checked the latest impl. of myfaces-test - the original impl. was
> too simple. so i had to fix some parts.
> for now you could use our internal infrastructure [1]. (if you are using
> jsf
> 2, you have to create a stand-alone test-project based on jsf 1.2.)
> 
> we don't plan to upgrade the internal test infrastructure to jsf 2, because
> we plan to switch to the upcoming myfaces-webapptest.
> (it allows executing the tests in combination with myfaces-core as well as
> mojarra -> the tests will be more reliable.)
> 
> regards,
> gerhard
> 
> [1]
> https://svn.apache.org/repos/asf/myfaces/extensions/validator/trunk/test-mod
> ules/
> 
> http://www.irian.at
> 
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
> 
> Professional Support for Apache MyFaces
> 
> 
> 2010/9/10 <mynewsgro...@arcor.de>
> 
> > Hi,
> >
> > I had a look into https://issues.apache.org/jira/browse/EXTVAL-4, which
> is
> > about testing ExtVal itself using Shale.
> >
> > Adopting this for testing my own custom ExtVal contraints using Myfaces
> > Test 1.0.0 doesn't work, it seems ExtVal and the mock value expressions
> do
> > not work together. Or am I missing something?
> >
> > Thanks,
> > Tom
> >
> > ---
> >
> > public class CustomCrossValidationsTest extends
> > AbstractJsfConfigurableMockTestCase {
> >
> >        // simple class with 2 string properties
> >        private DummyDialogDaten daten;
> >
> >        private HtmlInputText input1;
> >        private HtmlInputText input2;
> >
> >        @Override
> >        protected void setUpRenderKit() throws Exception {
> >
> >                RenderKitFactory renderKitFactory = (RenderKitFactory)
> > FactoryFinder.getFactory(FactoryFinder.RENDER_KIT_FACTORY);
> >                renderKit = new ExtValRenderKit(new MockRenderKit());
> >
> >  renderKitFactory.addRenderKit(RenderKitFactory.HTML_BASIC_RENDER_KIT,
> > renderKit);
> >
> >                Renderer renderer = new TextRenderer();
> >                renderKit.addRenderer("javax.faces.Input",
> > "javax.faces.Text", renderer);
> >        }
> >
> >        @Before
> >        @Override
> >        public void setUp() throws Exception {
> >
> >                super.setUp();
> >
> >                lifecycle.addPhaseListener(new
> > BeanValidationStartupListener());
> >                lifecycle.addPhaseListener(new
> > PropertyValidationModuleStartupListener());
> >                lifecycle.addPhaseListener(new ExtValStartupListener());
> >
> >                daten = new DummyDialogDaten();
> >
> >                HtmlForm form = new HtmlForm();
> >                form.setId("form");
> >                facesContext.getViewRoot().getChildren().add(form);
> >                input1 = new HtmlInputText();
> >                input1.setId("input1");
> >                input1.addValidator(new BeanValidator());
> >                form.getChildren().add(input1);
> >                input2 = new HtmlInputText();
> >                input2.setId("input2");
> >                input1.addValidator(new BeanValidator());
> >                form.getChildren().add(input2);
> >        }
> >
> >        @Override
> >        public void tearDown() throws Exception {
> >                super.tearDown();
> >                daten = null;
> >                input1 = null;
> >                input2 = null;
> >        }
> >
> >        @Test
> >        public void test() {
> >
> >
> >  facesContext.getExternalContext().getRequestMap().put("testBean",
> daten);
> >
> >                // Startup-Listener ausfuehren
> >                lifecycle.execute(facesContext);
> >
> >                ValueExpression exp =
> > createValueExpression("#{testBean.string1}");
> >                input1.setValueExpression("value", exp);
> >
> >                exp = createValueExpression("#{testBean.string2}");
> >                input2.setValueExpression("value", exp);
> >
> >                input1.setSubmittedValue("");
> >                input2.setSubmittedValue("");
> >
> >                // validate
> >                input1.validate(facesContext);
> >                input2.validate(facesContext);
> >
> >        // update model since it is necessary for crossval
> >                input1.updateModel(facesContext);
> >                input2.updateModel(facesContext);
> >
> >                processCrossValidation();
> >        }
> >
> >        protected ValueExpression createValueExpression(String valueExp) {
> >                return new MockValueExpression(valueExp, String.class);
> >                // or using which returns MockCompositeValueExpression
> >                // ExpressionFactory factory =
> >                // facesContext.getApplication().getExpressionFactory();
> >                // return
> > factory.createValueExpression(facesContext.getELContext(),
> >                // valueExp, String.class);
> >        }
> >
> >        protected void processCrossValidation() {
> >                new CrossValidationPhaseListener().afterPhase(new
> > PhaseEvent(facesContext, PhaseId.ANY_PHASE, lifecycle));
> >        }
> > }
> >
> >
> >
> > Heute erleben, was morgen Trend wird - das kann man auf der IFA in
> Berlin.
> > Oder auf arcor.de: Wir stellen Ihnen die wichtigsten News, Trends und
> > Gadgets der IFA vor. Natürlich mit dabei: das brandneue IPTV-Angebot von
> > Vodafone! Alles rund um die Internationale Funkausstellung in Berlin
> finden
> > Sie hier: http://www.arcor.de/rd/footer.ifa2010
> >
> 

Heute erleben, was morgen Trend wird - das kann man auf der IFA in Berlin. Oder 
auf arcor.de: Wir stellen Ihnen die wichtigsten News, Trends und Gadgets der 
IFA vor. Natürlich mit dabei: das brandneue IPTV-Angebot von Vodafone! Alles 
rund um die Internationale Funkausstellung in Berlin finden Sie hier: 
http://www.arcor.de/rd/footer.ifa2010

Reply via email to